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:
@ -1316,7 +1316,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||
val = GET_OPERAND(uint32, I32, 0);
|
||||
frame_ip += 2;
|
||||
|
||||
if (val < 0 || val >= (int32)tbl_inst->cur_size) {
|
||||
if ((uint32)val >= tbl_inst->cur_size) {
|
||||
wasm_set_exception(module, "undefined element");
|
||||
goto got_exception;
|
||||
}
|
||||
@ -1344,10 +1344,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||
cur_func_type = cur_func->u.func_import->func_type;
|
||||
else
|
||||
cur_func_type = cur_func->u.func->func_type;
|
||||
if (!wasm_type_equal(cur_type, cur_func_type)) {
|
||||
|
||||
if (cur_type != cur_func_type) {
|
||||
wasm_set_exception(module, "indirect call type mismatch");
|
||||
goto got_exception;
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_TAIL_CALL != 0
|
||||
if (opcode == WASM_OP_RETURN_CALL_INDIRECT)
|
||||
goto call_func_from_return_call;
|
||||
|
||||
Reference in New Issue
Block a user