Use pre-created exec_env for instantiation and module_malloc/free (#2047)
Use pre-created exec_env for instantiation and module_malloc/free, use the same exec_env of the current thread to avoid potential unexpected behavior. And remove unnecessary shared_mem_lock in wasm_module_free, which may cause dead lock.
This commit is contained in:
@ -400,7 +400,8 @@ void
|
||||
wasm_unload(WASMModule *module);
|
||||
|
||||
WASMModuleInstance *
|
||||
wasm_instantiate(WASMModule *module, bool is_sub_inst, uint32 stack_size,
|
||||
wasm_instantiate(WASMModule *module, bool is_sub_inst,
|
||||
WASMExecEnv *exec_env_main, uint32 stack_size,
|
||||
uint32 heap_size, char *error_buf, uint32 error_buf_size);
|
||||
|
||||
void
|
||||
@ -432,11 +433,6 @@ bool
|
||||
wasm_call_function(WASMExecEnv *exec_env, WASMFunctionInstance *function,
|
||||
unsigned argc, uint32 argv[]);
|
||||
|
||||
bool
|
||||
wasm_create_exec_env_and_call_function(WASMModuleInstance *module_inst,
|
||||
WASMFunctionInstance *function,
|
||||
unsigned argc, uint32 argv[]);
|
||||
|
||||
void
|
||||
wasm_set_exception(WASMModuleInstance *module, const char *exception);
|
||||
|
||||
@ -455,6 +451,20 @@ wasm_get_exception(WASMModuleInstance *module);
|
||||
bool
|
||||
wasm_copy_exception(WASMModuleInstance *module_inst, char *exception_buf);
|
||||
|
||||
uint32
|
||||
wasm_module_malloc_internal(WASMModuleInstance *module_inst,
|
||||
WASMExecEnv *exec_env, uint32 size,
|
||||
void **p_native_addr);
|
||||
|
||||
uint32
|
||||
wasm_module_realloc_internal(WASMModuleInstance *module_inst,
|
||||
WASMExecEnv *exec_env, uint32 ptr, uint32 size,
|
||||
void **p_native_addr);
|
||||
|
||||
void
|
||||
wasm_module_free_internal(WASMModuleInstance *module_inst,
|
||||
WASMExecEnv *exec_env, uint32 ptr);
|
||||
|
||||
uint32
|
||||
wasm_module_malloc(WASMModuleInstance *module_inst, uint32 size,
|
||||
void **p_native_addr);
|
||||
|
||||
Reference in New Issue
Block a user