Update API comments, refine footprint of wasm loader (#256)

and fix issues of get native stack boundary
This commit is contained in:
wenyongh
2020-05-15 17:44:36 +08:00
committed by GitHub
parent 1362b6d81f
commit a0bb761beb
4 changed files with 269 additions and 264 deletions

View File

@ -179,7 +179,9 @@ package_type_t
get_package_type(const uint8_t *buf, uint32_t size);
/**
* Load a WASM module from a specified byte buffer.
* Load a WASM module from a specified byte buffer. The byte buffer can be
* WASM binary data when interpreter or JIT is enabled, or AOT binary data
* when AOT is enabled. If it is AOT binary data, it must be 4-byte aligned.
*
* @param buf the byte buffer which contains the WASM binary data
* @param size the size of the buffer
@ -225,11 +227,13 @@ wasm_runtime_set_wasi_args(wasm_module_t module,
* Instantiate a WASM module.
*
* @param module the WASM module to instantiate
* @param stack_size the default stack size of the module instance, a stack
* will be created when function wasm_runtime_call_wasm() is called
* to run WASM function and the exec_env argument passed to
* wasm_runtime_call_wasm() is NULL. That means this parameter is
* ignored if exec_env is not NULL.
* @param stack_size the default stack size of the module instance when the
* exec env's operation stack isn't created by user, e.g. API
* wasm_application_execute_main() and wasm_application_execute_func()
* create the operation stack internally with the stack size specified
* here. And API wasm_runtime_create_exec_env() creates the operation
* stack with stack size specified by its parameter, the stack size
* specified here is ignored.
* @param heap_size the default heap size of the module instance, a heap will
* be created besides the app memory space. Both wasm app and native
* function can allocate memory from the heap. If heap_size is 0, the
@ -286,7 +290,7 @@ wasm_runtime_create_exec_env(wasm_module_inst_t module_inst,
/**
* Destroy the execution environment.
*
* @param env the execution environment to destroy
* @param exec_env the execution environment to destroy
*/
void
wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env);
@ -305,17 +309,18 @@ wasm_runtime_get_module_inst(wasm_exec_env_t exec_env);
* Call the given WASM function of a WASM module instance with
* arguments (bytecode and AoT).
*
* @param exec_env the execution environment to call the function
* @param exec_env the execution environment to call the function,
* which must be created from wasm_create_exec_env()
* @param function the function to be called
* @param function the function to call
* @param argc the number of arguments
* @param argv the arguments. If the function method has return value,
* @param argv the arguments. If the function has return value,
* the first (or first two in case 64-bit return value) element of
* argv stores the return value of the called WASM function after this
* function returns.
*
* @return true if success, false otherwise and exception will be thrown,
* the caller can call wasm_runtime_get_exception to get exception info.
* the caller can call wasm_runtime_get_exception to get the exception
* info.
*/
bool
wasm_runtime_call_wasm(wasm_exec_env_t exec_env,
@ -330,8 +335,9 @@ wasm_runtime_call_wasm(wasm_exec_env_t exec_env,
* @param argc the number of arguments
* @param argv the arguments array
*
* @return true if the main function is called, false otherwise and exception will be thrown,
* the caller can call wasm_runtime_get_exception to get exception info.
* @return true if the main function is called, false otherwise and exception
* will be thrown, the caller can call wasm_runtime_get_exception to get
* the exception info.
*/
bool
wasm_application_execute_main(wasm_module_inst_t module_inst,
@ -346,8 +352,9 @@ wasm_application_execute_main(wasm_module_inst_t module_inst,
* @param argc the number of arguments
* @param argv the arguments array
*
* @return true if the specified function is called, false otherwise and exception will be thrown,
* the caller can call wasm_runtime_get_exception to get exception info.
* @return true if the specified function is called, false otherwise and
* exception will be thrown, the caller can call wasm_runtime_get_exception
* to get the exception info.
*/
bool
wasm_application_execute_func(wasm_module_inst_t module_inst,