Normalize wasm types (#1378)

Normalize wasm types, for the two wasm types, if their parameter types
and result types are the same, we only save one copy, so as to reduce
the footprint and simplify the type comparison in opcode CALL_INDIRECT.

And fix issue in interpreter globals_instantiate, and remove used codes.
This commit is contained in:
FromLiQg
2022-08-18 17:52:02 +08:00
committed by GitHub
parent 9cf7b88bad
commit 88bb4f3c81
8 changed files with 75 additions and 35 deletions

View File

@ -2205,28 +2205,6 @@ aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count)
}
#endif /* end of OS_ENABLE_HW_BOUND_CHECK */
bool
aot_is_wasm_type_equal(AOTModuleInstance *module_inst, uint32 type1_idx,
uint32 type2_idx)
{
WASMType *type1, *type2;
AOTModule *module = (AOTModule *)module_inst->aot_module.ptr;
if (type1_idx >= module->func_type_count
|| type2_idx >= module->func_type_count) {
aot_set_exception(module_inst, "type index out of bounds");
return false;
}
if (type1_idx == type2_idx)
return true;
type1 = module->func_types[type1_idx];
type2 = module->func_types[type2_idx];
return wasm_type_equal(type1, type2);
}
bool
aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
uint32 *argv)

View File

@ -633,9 +633,6 @@ aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count);
*
* @return true if equal, false otherwise
*/
bool
aot_is_wasm_type_equal(AOTModuleInstance *module_inst, uint32 type1_idx,
uint32 type2_idx);
/**
* Invoke native function from aot code