Fix some more spelling issues (#3393)

This commit is contained in:
Benbuck Nason
2024-05-07 18:30:29 -07:00
committed by GitHub
parent ca61184ced
commit 1c2a8fca4e
37 changed files with 134 additions and 134 deletions

View File

@ -1,36 +1,36 @@
# Wasm Function
# Wasm Function
## Internal data structure
![](./images/wasm_function.svg)
## Module level data (function)
**WASMModule**: Data structure created for loading a module.
**WASMModule**: Data structure created for loading a module.
- `WASMImport *import_functions`: initialized from the Wasm file function section
- `WASMImport *import_functions`: initialized from the Wasm file import section. The runtime will try to solve the imports from the native API registration, refer to [Export native API to WASM application](../../../doc/export_native_api.md).
- `WASMImport *import_functions`: initialized from the Wasm file import section. The runtime will try to solve the imports from the native API registration, refer to [Export native API to WASM application](../../../doc/export_native_api.md).
**WASMFunction**: represent a Wasm function located in Wasm file code section. Track the links to the compiled function body.
**WASMFunction**: represent a Wasm function located in Wasm file code section. Track the links to the compiled function body.
**WASMImport**: represent a imported Wasm function which can be a solved as a native function or another Wasm module exported function.
## Instance level data (function)
**WASMModuleInstance**: Data structure created for instantiating a module
- `WASMModuleInstanceExtra::functions`: combined the imported and internal functions into single array of structure `WASMFunctionInstance`
- `WASMModuleInstance::import_func_ptrs`: pointer array for solved function imports. This array is referred during calling imported native function. Note it is initialzed with the module level solved imports, but may points to different native function later due to c-api calls.
- `WASMModuleInstance::import_func_ptrs`: pointer array for solved function imports. This array is referred during calling imported native function. Note it is initialized with the module level solved imports, but may points to different native function later due to c-api calls.
## Execution paths
**Interpreter**:
- Execute internal bytecode function:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
-> WASMFunctionInstance::func
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
-> WASMFunctionInstance::func
-> WASMFunction::code
```
- Execute imported function from other module:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
(WASMFunctionInstance flag indicates an import)
-> WASMFunctionInstance::import_func_inst
-> WASMModuleInstance(second)::func
@ -39,9 +39,9 @@
- Execute imported native function:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
(flag indicates imported native)
WASMModuleInstance::import_func_ptrs[..]
-> native function
```
```