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:
@ -1106,9 +1106,8 @@ wasm_interp_call_func_native(WASMModuleInstance *module_inst,
|
||||
if (!func_import->call_conv_wasm_c_api) {
|
||||
native_func_pointer = module_inst->import_func_ptrs[cur_func_index];
|
||||
}
|
||||
else if (module_inst->e->common.c_api_func_imports) {
|
||||
c_api_func_import =
|
||||
module_inst->e->common.c_api_func_imports + cur_func_index;
|
||||
else if (module_inst->c_api_func_imports) {
|
||||
c_api_func_import = module_inst->c_api_func_imports + cur_func_index;
|
||||
native_func_pointer = c_api_func_import->func_ptr_linked;
|
||||
}
|
||||
|
||||
@ -5427,8 +5426,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||
#ifndef OS_ENABLE_HW_BOUND_CHECK
|
||||
CHECK_BULK_MEMORY_OVERFLOW(addr, bytes, maddr);
|
||||
#else
|
||||
if ((uint64)(uint32)addr + bytes
|
||||
> (uint64)linear_mem_size)
|
||||
if ((uint64)(uint32)addr + bytes > linear_mem_size)
|
||||
goto out_of_bounds;
|
||||
maddr = memory->memory_data + (uint32)addr;
|
||||
#endif
|
||||
@ -5447,7 +5445,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||
if (offset + bytes > seg_len)
|
||||
goto out_of_bounds;
|
||||
|
||||
bh_memcpy_s(maddr, linear_mem_size - addr,
|
||||
bh_memcpy_s(maddr, (uint32)(linear_mem_size - addr),
|
||||
data + offset, (uint32)bytes);
|
||||
break;
|
||||
}
|
||||
@ -5479,11 +5477,11 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||
CHECK_BULK_MEMORY_OVERFLOW(src, len, msrc);
|
||||
CHECK_BULK_MEMORY_OVERFLOW(dst, len, mdst);
|
||||
#else
|
||||
if ((uint64)(uint32)src + len > (uint64)linear_mem_size)
|
||||
if ((uint64)(uint32)src + len > linear_mem_size)
|
||||
goto out_of_bounds;
|
||||
msrc = memory->memory_data + (uint32)src;
|
||||
|
||||
if ((uint64)(uint32)dst + len > (uint64)linear_mem_size)
|
||||
if ((uint64)(uint32)dst + len > linear_mem_size)
|
||||
goto out_of_bounds;
|
||||
mdst = memory->memory_data + (uint32)dst;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user