Refine looking up aot function with index (#3882)

* Refine looking up aot function with index

* refine the code
This commit is contained in:
Wenyong Huang
2024-10-29 10:58:11 +08:00
committed by GitHub
parent 483c57de9f
commit a3960c834d
4 changed files with 97 additions and 30 deletions

View File

@ -3383,21 +3383,8 @@ wasm_func_call(const wasm_func_t *func, const wasm_val_vec_t *params,
if (!(func_comm_rt = func->func_comm_rt)) {
AOTModuleInstance *inst_aot =
(AOTModuleInstance *)func->inst_comm_rt;
AOTModule *module_aot = (AOTModule *)inst_aot->module;
uint32 export_i = 0, export_func_j = 0;
for (; export_i < module_aot->export_count; ++export_i) {
AOTExport *export = module_aot->exports + export_i;
if (export->kind == EXPORT_KIND_FUNC) {
if (export->index == func->func_idx_rt) {
func_comm_rt =
aot_lookup_function(inst_aot, export->name);
((wasm_func_t *)func)->func_comm_rt = func_comm_rt;
break;
}
export_func_j++;
}
}
func_comm_rt = ((wasm_func_t *)func)->func_comm_rt =
aot_lookup_function_with_idx(inst_aot, func->func_idx_rt);
}
#endif
}

View File

@ -1579,8 +1579,7 @@ wasm_runtime_get_memory(WASMModuleInstanceCommon *module_inst, uint32 index)
#if WASM_ENABLE_AOT != 0
if (module_inst->module_type == Wasm_Module_AoT)
return aot_get_memory_with_index((AOTModuleInstance *)module_inst,
index);
return aot_get_memory_with_idx((AOTModuleInstance *)module_inst, index);
#endif
return NULL;