Remove unused argument in wasm_runtime_lookup_function and refactor WASMModuleInstance (#3218)
Remove the unused parameter `signature` from `wasm_runtime_lookup_function`. Refactor the layout of WASMModuleInstance structure: - move common data members `c_api_func_imports` and `cur_exec_env` from `WASMModuleInstanceExtraCommon` to `WASMModuleInstance` - In `WASMModuleInstance`, enlarge `reserved[3]` to `reserved[5]` in case that we need to add more fields in the future ps. https://github.com/bytecodealliance/wasm-micro-runtime/issues/2530 https://github.com/bytecodealliance/wasm-micro-runtime/issues/3202
This commit is contained in:
@ -656,7 +656,7 @@ functions_instantiate(const WASMModule *module, WASMModuleInstance *module_inst,
|
||||
if (function->import_module_inst) {
|
||||
function->import_func_inst =
|
||||
wasm_lookup_function(function->import_module_inst,
|
||||
import->u.function.field_name, NULL);
|
||||
import->u.function.field_name);
|
||||
}
|
||||
}
|
||||
#endif /* WASM_ENABLE_MULTI_MODULE */
|
||||
@ -1220,7 +1220,7 @@ lookup_post_instantiate_func(WASMModuleInstance *module_inst,
|
||||
WASMFunctionInstance *func;
|
||||
WASMFuncType *func_type;
|
||||
|
||||
if (!(func = wasm_lookup_function(module_inst, func_name, NULL)))
|
||||
if (!(func = wasm_lookup_function(module_inst, func_name)))
|
||||
/* Not found */
|
||||
return NULL;
|
||||
|
||||
@ -2967,8 +2967,8 @@ wasm_deinstantiate(WASMModuleInstance *module_inst, bool is_sub_inst)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (module_inst->e->common.c_api_func_imports)
|
||||
wasm_runtime_free(module_inst->e->common.c_api_func_imports);
|
||||
if (module_inst->c_api_func_imports)
|
||||
wasm_runtime_free(module_inst->c_api_func_imports);
|
||||
|
||||
if (!is_sub_inst) {
|
||||
#if WASM_ENABLE_WASI_NN != 0
|
||||
@ -2988,14 +2988,12 @@ wasm_deinstantiate(WASMModuleInstance *module_inst, bool is_sub_inst)
|
||||
}
|
||||
|
||||
WASMFunctionInstance *
|
||||
wasm_lookup_function(const WASMModuleInstance *module_inst, const char *name,
|
||||
const char *signature)
|
||||
wasm_lookup_function(const WASMModuleInstance *module_inst, const char *name)
|
||||
{
|
||||
uint32 i;
|
||||
for (i = 0; i < module_inst->export_func_count; i++)
|
||||
if (!strcmp(module_inst->export_functions[i].name, name))
|
||||
return module_inst->export_functions[i].function;
|
||||
(void)signature;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -3169,8 +3167,8 @@ wasm_call_function(WASMExecEnv *exec_env, WASMFunctionInstance *function,
|
||||
hw bound check is enabled */
|
||||
#endif
|
||||
|
||||
/* Set exec env so it can be later retrieved from instance */
|
||||
module_inst->e->common.cur_exec_env = exec_env;
|
||||
/* Set exec env, so it can be later retrieved from instance */
|
||||
module_inst->cur_exec_env = exec_env;
|
||||
|
||||
interp_call_wasm(module_inst, exec_env, function, argc, argv);
|
||||
return !wasm_copy_exception(module_inst, NULL);
|
||||
@ -4050,9 +4048,8 @@ llvm_jit_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
|
||||
|
||||
import_func = &module->import_functions[func_idx].u.function;
|
||||
if (import_func->call_conv_wasm_c_api) {
|
||||
if (module_inst->e->common.c_api_func_imports) {
|
||||
c_api_func_import =
|
||||
module_inst->e->common.c_api_func_imports + func_idx;
|
||||
if (module_inst->c_api_func_imports) {
|
||||
c_api_func_import = module_inst->c_api_func_imports + func_idx;
|
||||
func_ptr = c_api_func_import->func_ptr_linked;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user