Skip to content

Commit a0bb761

Browse files
authored
Update API comments, refine footprint of wasm loader (#256)
and fix issues of get native stack boundary
1 parent 1362b6d commit a0bb761

File tree

4 files changed

+270
-265
lines changed

4 files changed

+270
-265
lines changed

core/iwasm/include/wasm_export.h

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ package_type_t
179179
get_package_type(const uint8_t *buf, uint32_t size);
180180

181181
/**
182-
* Load a WASM module from a specified byte buffer.
182+
* Load a WASM module from a specified byte buffer. The byte buffer can be
183+
* WASM binary data when interpreter or JIT is enabled, or AOT binary data
184+
* when AOT is enabled. If it is AOT binary data, it must be 4-byte aligned.
183185
*
184186
* @param buf the byte buffer which contains the WASM binary data
185187
* @param size the size of the buffer
@@ -225,11 +227,13 @@ wasm_runtime_set_wasi_args(wasm_module_t module,
225227
* Instantiate a WASM module.
226228
*
227229
* @param module the WASM module to instantiate
228-
* @param stack_size the default stack size of the module instance, a stack
229-
* will be created when function wasm_runtime_call_wasm() is called
230-
* to run WASM function and the exec_env argument passed to
231-
* wasm_runtime_call_wasm() is NULL. That means this parameter is
232-
* ignored if exec_env is not NULL.
230+
* @param stack_size the default stack size of the module instance when the
231+
* exec env's operation stack isn't created by user, e.g. API
232+
* wasm_application_execute_main() and wasm_application_execute_func()
233+
* create the operation stack internally with the stack size specified
234+
* here. And API wasm_runtime_create_exec_env() creates the operation
235+
* stack with stack size specified by its parameter, the stack size
236+
* specified here is ignored.
233237
* @param heap_size the default heap size of the module instance, a heap will
234238
* be created besides the app memory space. Both wasm app and native
235239
* 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,
286290
/**
287291
* Destroy the execution environment.
288292
*
289-
* @param env the execution environment to destroy
293+
* @param exec_env the execution environment to destroy
290294
*/
291295
void
292296
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);
305309
* Call the given WASM function of a WASM module instance with
306310
* arguments (bytecode and AoT).
307311
*
308-
* @param exec_env the execution environment to call the function
312+
* @param exec_env the execution environment to call the function,
309313
* which must be created from wasm_create_exec_env()
310-
* @param function the function to be called
314+
* @param function the function to call
311315
* @param argc the number of arguments
312-
* @param argv the arguments. If the function method has return value,
316+
* @param argv the arguments. If the function has return value,
313317
* the first (or first two in case 64-bit return value) element of
314318
* argv stores the return value of the called WASM function after this
315319
* function returns.
316320
*
317321
* @return true if success, false otherwise and exception will be thrown,
318-
* the caller can call wasm_runtime_get_exception to get exception info.
322+
* the caller can call wasm_runtime_get_exception to get the exception
323+
* info.
319324
*/
320325
bool
321326
wasm_runtime_call_wasm(wasm_exec_env_t exec_env,
@@ -330,8 +335,9 @@ wasm_runtime_call_wasm(wasm_exec_env_t exec_env,
330335
* @param argc the number of arguments
331336
* @param argv the arguments array
332337
*
333-
* @return true if the main function is called, false otherwise and exception will be thrown,
334-
* the caller can call wasm_runtime_get_exception to get exception info.
338+
* @return true if the main function is called, false otherwise and exception
339+
* will be thrown, the caller can call wasm_runtime_get_exception to get
340+
* the exception info.
335341
*/
336342
bool
337343
wasm_application_execute_main(wasm_module_inst_t module_inst,
@@ -346,8 +352,9 @@ wasm_application_execute_main(wasm_module_inst_t module_inst,
346352
* @param argc the number of arguments
347353
* @param argv the arguments array
348354
*
349-
* @return true if the specified function is called, false otherwise and exception will be thrown,
350-
* the caller can call wasm_runtime_get_exception to get exception info.
355+
* @return true if the specified function is called, false otherwise and
356+
* exception will be thrown, the caller can call wasm_runtime_get_exception
357+
* to get the exception info.
351358
*/
352359
bool
353360
wasm_application_execute_func(wasm_module_inst_t module_inst,

0 commit comments

Comments
 (0)