Refine the wasm-c-api native func call process of aot mode (#640)

This commit is contained in:
Wenyong Huang
2021-05-26 20:57:30 +08:00
committed by GitHub
parent 1b34606940
commit ba922b0d0d
14 changed files with 459 additions and 67 deletions

View File

@ -1397,6 +1397,35 @@ wasm_runtime_create_exec_env_and_call_wasm(WASMModuleInstanceCommon *module_inst
return ret;
}
bool
wasm_runtime_create_exec_env_singleton(WASMModuleInstanceCommon *module_inst)
{
#if WASM_ENABLE_INTERP != 0
if (module_inst->module_type == Wasm_Module_Bytecode)
return wasm_create_exec_env_singleton((WASMModuleInstance *)module_inst);
#endif
#if WASM_ENABLE_AOT != 0
if (module_inst->module_type == Wasm_Module_AoT)
return aot_create_exec_env_singleton((AOTModuleInstance *)module_inst);
#endif
return false;
}
WASMExecEnv *
wasm_runtime_get_exec_env_singleton(WASMModuleInstanceCommon *module_inst)
{
#if WASM_ENABLE_INTERP != 0
if (module_inst->module_type == Wasm_Module_Bytecode)
return ((WASMModuleInstance *)module_inst)->exec_env_singleton;
#endif
#if WASM_ENABLE_AOT != 0
if (module_inst->module_type == Wasm_Module_AoT)
return (WASMExecEnv *)
((AOTModuleInstance *)module_inst)->exec_env_singleton.ptr;
#endif
return NULL;
}
void
wasm_runtime_set_exception(WASMModuleInstanceCommon *module_inst,
const char *exception)