mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-07-15 16:58:34 +00:00
cr suggestions and remove repeated memory64 flag checking in classic-interp
This commit is contained in:
parent
e3b57b90ac
commit
ba9402753d
|
@ -227,10 +227,9 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
if (is_memory64) {
|
if (is_memory64) {
|
||||||
argc1 = 3;
|
argc1 = 3;
|
||||||
uint64_t app_addr =
|
uint64 app_addr =
|
||||||
wasm_runtime_addr_native_to_app(module_inst, argv_offsets);
|
wasm_runtime_addr_native_to_app(module_inst, argv_offsets);
|
||||||
bh_memcpy_s(&(argv1[1]), sizeof(uint32) * 2, &app_addr,
|
PUT_I64_TO_ADDR(&argv[1], app_addr);
|
||||||
sizeof(uint64));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3693,6 +3693,10 @@ wasm_runtime_invoke_native_raw(WASMExecEnv *exec_env, void *func_ptr,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
*(uint32 *)argv_dst = arg_i32 = *argv_src++;
|
*(uint32 *)argv_dst = arg_i32 = *argv_src++;
|
||||||
|
/* TODO: memory64 if future there is a way for supporting
|
||||||
|
* wasm64 and wasm32 in libc at the same time, remove the
|
||||||
|
* macro control */
|
||||||
|
#if WASM_ENABLE_MEMORY64 == 0
|
||||||
if (signature) {
|
if (signature) {
|
||||||
if (signature[i + 1] == '*') {
|
if (signature[i + 1] == '*') {
|
||||||
/* param is a pointer */
|
/* param is a pointer */
|
||||||
|
@ -3722,13 +3726,13 @@ wasm_runtime_invoke_native_raw(WASMExecEnv *exec_env, void *func_ptr,
|
||||||
module, (uint64)arg_i32);
|
module, (uint64)arg_i32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VALUE_TYPE_I64:
|
case VALUE_TYPE_I64:
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
{
|
{
|
||||||
bh_memcpy_s(argv_dst, sizeof(uint64), argv_src,
|
PUT_I64_TO_ADDR((uint32 *)argv, GET_I64_FROM_ADDR(argv_src));
|
||||||
sizeof(uint32) * 2);
|
|
||||||
argv_src += 2;
|
argv_src += 2;
|
||||||
arg_i64 = *argv_dst;
|
arg_i64 = *argv_dst;
|
||||||
if (signature) {
|
if (signature) {
|
||||||
|
@ -4847,6 +4851,10 @@ wasm_runtime_invoke_native(WASMExecEnv *exec_env, void *func_ptr,
|
||||||
{
|
{
|
||||||
arg_i32 = *argv_src++;
|
arg_i32 = *argv_src++;
|
||||||
arg_i64 = arg_i32;
|
arg_i64 = arg_i32;
|
||||||
|
/* TODO: memory64 if future there is a way for supporting
|
||||||
|
* wasm64 and wasm32 in libc at the same time, remove the
|
||||||
|
* macro control */
|
||||||
|
#if WASM_ENABLE_MEMORY64 == 0
|
||||||
if (signature) {
|
if (signature) {
|
||||||
if (signature[i + 1] == '*') {
|
if (signature[i + 1] == '*') {
|
||||||
/* param is a pointer */
|
/* param is a pointer */
|
||||||
|
@ -4874,6 +4882,7 @@ wasm_runtime_invoke_native(WASMExecEnv *exec_env, void *func_ptr,
|
||||||
module, (uint64)arg_i32);
|
module, (uint64)arg_i32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (n_ints < MAX_REG_INTS)
|
if (n_ints < MAX_REG_INTS)
|
||||||
ints[n_ints++] = arg_i64;
|
ints[n_ints++] = arg_i64;
|
||||||
else
|
else
|
||||||
|
@ -4883,7 +4892,7 @@ wasm_runtime_invoke_native(WASMExecEnv *exec_env, void *func_ptr,
|
||||||
case VALUE_TYPE_I64:
|
case VALUE_TYPE_I64:
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
{
|
{
|
||||||
arg_i64 = *(uint64 *)argv_src;
|
arg_i64 = GET_I64_FROM_ADDR(argv_src);
|
||||||
argv_src += 2;
|
argv_src += 2;
|
||||||
if (signature) {
|
if (signature) {
|
||||||
/* TODO: memory64 pointer with length need a new symbol
|
/* TODO: memory64 pointer with length need a new symbol
|
||||||
|
|
|
@ -1510,7 +1510,11 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
|
/* TODO: multi-memories for now assuming the memory idx type is consistent
|
||||||
|
* across multi-memories */
|
||||||
bool is_memory64 = false;
|
bool is_memory64 = false;
|
||||||
|
if (memory)
|
||||||
|
is_memory64 = memory->is_memory64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||||
|
@ -4170,7 +4174,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
global = globals + global_idx;
|
global = globals + global_idx;
|
||||||
global_addr = get_global_addr(global_data, global);
|
global_addr = get_global_addr(global_data, global);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
if (module->memories[0]->is_memory64) {
|
if (is_memory64) {
|
||||||
aux_stack_top = *(uint64 *)(frame_sp - 2);
|
aux_stack_top = *(uint64 *)(frame_sp - 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4188,7 +4192,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
goto got_exception;
|
goto got_exception;
|
||||||
}
|
}
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
if (module->memories[0]->is_memory64) {
|
if (is_memory64) {
|
||||||
*(uint64 *)global_addr = aux_stack_top;
|
*(uint64 *)global_addr = aux_stack_top;
|
||||||
frame_sp -= 2;
|
frame_sp -= 2;
|
||||||
}
|
}
|
||||||
|
@ -4228,9 +4232,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(4);
|
CHECK_MEMORY_OVERFLOW(4);
|
||||||
|
@ -4247,9 +4248,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(8);
|
CHECK_MEMORY_OVERFLOW(8);
|
||||||
|
@ -4265,9 +4263,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(1);
|
CHECK_MEMORY_OVERFLOW(1);
|
||||||
|
@ -4283,9 +4278,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(1);
|
CHECK_MEMORY_OVERFLOW(1);
|
||||||
|
@ -4301,9 +4293,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(2);
|
CHECK_MEMORY_OVERFLOW(2);
|
||||||
|
@ -4319,9 +4308,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(2);
|
CHECK_MEMORY_OVERFLOW(2);
|
||||||
|
@ -4337,9 +4323,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(1);
|
CHECK_MEMORY_OVERFLOW(1);
|
||||||
|
@ -4355,9 +4338,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(1);
|
CHECK_MEMORY_OVERFLOW(1);
|
||||||
|
@ -4373,9 +4353,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(2);
|
CHECK_MEMORY_OVERFLOW(2);
|
||||||
|
@ -4391,9 +4368,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(2);
|
CHECK_MEMORY_OVERFLOW(2);
|
||||||
|
@ -4410,9 +4384,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
|
|
||||||
opcode = *(frame_ip - 1);
|
opcode = *(frame_ip - 1);
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(4);
|
CHECK_MEMORY_OVERFLOW(4);
|
||||||
|
@ -4428,9 +4399,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
CHECK_MEMORY_OVERFLOW(4);
|
CHECK_MEMORY_OVERFLOW(4);
|
||||||
|
@ -4448,9 +4416,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
frame_sp--;
|
frame_sp--;
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
|
@ -4476,9 +4441,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
mem_offset_t offset, addr;
|
mem_offset_t offset, addr;
|
||||||
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
frame_sp -= 2;
|
frame_sp -= 2;
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
|
@ -4509,9 +4471,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
|
|
||||||
opcode = *(frame_ip - 1);
|
opcode = *(frame_ip - 1);
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
sval = (uint32)POP_I32();
|
sval = (uint32)POP_I32();
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
|
@ -4539,9 +4498,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
|
|
||||||
opcode = *(frame_ip - 1);
|
opcode = *(frame_ip - 1);
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
read_leb_uint32(frame_ip, frame_ip_end, flags);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
sval = (uint64)POP_I64();
|
sval = (uint64)POP_I64();
|
||||||
addr = POP_MEM_OFFSET();
|
addr = POP_MEM_OFFSET();
|
||||||
|
@ -4568,9 +4524,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
{
|
{
|
||||||
uint32 reserved;
|
uint32 reserved;
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, reserved);
|
read_leb_uint32(frame_ip, frame_ip_end, reserved);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
PUSH_PAGE_COUNT(memory->cur_page_count);
|
PUSH_PAGE_COUNT(memory->cur_page_count);
|
||||||
(void)reserved;
|
(void)reserved;
|
||||||
HANDLE_OP_END();
|
HANDLE_OP_END();
|
||||||
|
@ -4581,9 +4534,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
uint32 reserved, delta,
|
uint32 reserved, delta,
|
||||||
prev_page_count = memory->cur_page_count;
|
prev_page_count = memory->cur_page_count;
|
||||||
|
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, reserved);
|
read_leb_uint32(frame_ip, frame_ip_end, reserved);
|
||||||
delta = (uint32)POP_PAGE_COUNT();
|
delta = (uint32)POP_PAGE_COUNT();
|
||||||
|
|
||||||
|
@ -5601,9 +5551,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, segment);
|
read_leb_uint32(frame_ip, frame_ip_end, segment);
|
||||||
/* skip memory index */
|
/* skip memory index */
|
||||||
frame_ip++;
|
frame_ip++;
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bytes = (uint64)(uint32)POP_I32();
|
bytes = (uint64)(uint32)POP_I32();
|
||||||
offset = (uint64)(uint32)POP_I32();
|
offset = (uint64)(uint32)POP_I32();
|
||||||
|
@ -5654,9 +5601,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
uint8 *mdst, *msrc;
|
uint8 *mdst, *msrc;
|
||||||
|
|
||||||
frame_ip += 2;
|
frame_ip += 2;
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
len = POP_MEM_OFFSET();
|
len = POP_MEM_OFFSET();
|
||||||
src = POP_MEM_OFFSET();
|
src = POP_MEM_OFFSET();
|
||||||
dst = POP_MEM_OFFSET();
|
dst = POP_MEM_OFFSET();
|
||||||
|
@ -5689,9 +5633,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
uint8 fill_val, *mdst;
|
uint8 fill_val, *mdst;
|
||||||
frame_ip++;
|
frame_ip++;
|
||||||
|
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
len = POP_MEM_OFFSET();
|
len = POP_MEM_OFFSET();
|
||||||
fill_val = POP_I32();
|
fill_val = POP_I32();
|
||||||
dst = POP_MEM_OFFSET();
|
dst = POP_MEM_OFFSET();
|
||||||
|
@ -5935,9 +5876,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
||||||
|
|
||||||
if (opcode != WASM_OP_ATOMIC_FENCE) {
|
if (opcode != WASM_OP_ATOMIC_FENCE) {
|
||||||
read_leb_uint32(frame_ip, frame_ip_end, align);
|
read_leb_uint32(frame_ip, frame_ip_end, align);
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0]->is_memory64;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
read_leb_mem_offset(frame_ip, frame_ip_end, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10838,6 +10838,19 @@ re_scan:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
|
/* TODO: multi-memories for now assuming the memory idx type is consistent
|
||||||
|
* across multi-memories */
|
||||||
|
if (module->import_memory_count > 0)
|
||||||
|
is_memory64 = module->import_memories[0].u.memory.flags & MEMORY64_FLAG;
|
||||||
|
else if (module->memory_count > 0)
|
||||||
|
is_memory64 = module->memories[0].flags & MEMORY64_FLAG;
|
||||||
|
|
||||||
|
mem_offset_type = is_memory64 ? VALUE_TYPE_I64 : VALUE_TYPE_I32;
|
||||||
|
#else
|
||||||
|
mem_offset_type = VALUE_TYPE_I32;
|
||||||
|
#endif
|
||||||
|
|
||||||
PUSH_CSP(LABEL_TYPE_FUNCTION, func_block_type, p);
|
PUSH_CSP(LABEL_TYPE_FUNCTION, func_block_type, p);
|
||||||
|
|
||||||
while (p < p_end) {
|
while (p < p_end) {
|
||||||
|
@ -12977,13 +12990,7 @@ re_scan:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
CHECK_MEMORY();
|
CHECK_MEMORY();
|
||||||
read_leb_uint32(p, p_end, align); /* align */
|
read_leb_uint32(p, p_end, align); /* align */
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0].flags & MEMORY64_FLAG;
|
|
||||||
mem_offset_type = is_memory64 ? VALUE_TYPE_I64 : VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
||||||
if (!check_memory_access_align(opcode, align, error_buf,
|
if (!check_memory_access_align(opcode, align, error_buf,
|
||||||
error_buf_size)) {
|
error_buf_size)) {
|
||||||
|
@ -13055,14 +13062,6 @@ re_scan:
|
||||||
"zero byte expected");
|
"zero byte expected");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type = module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
PUSH_PAGE_COUNT();
|
PUSH_PAGE_COUNT();
|
||||||
|
|
||||||
module->possible_memory_grow = true;
|
module->possible_memory_grow = true;
|
||||||
|
@ -13079,13 +13078,6 @@ re_scan:
|
||||||
"zero byte expected");
|
"zero byte expected");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type = module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_AND_PUSH(mem_offset_type, mem_offset_type);
|
POP_AND_PUSH(mem_offset_type, mem_offset_type);
|
||||||
|
|
||||||
module->possible_memory_grow = true;
|
module->possible_memory_grow = true;
|
||||||
|
@ -14447,14 +14439,6 @@ re_scan:
|
||||||
|
|
||||||
POP_I32();
|
POP_I32();
|
||||||
POP_I32();
|
POP_I32();
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type =
|
|
||||||
module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
#if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0
|
#if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0
|
||||||
func->has_memory_operations = true;
|
func->has_memory_operations = true;
|
||||||
|
@ -14498,14 +14482,6 @@ re_scan:
|
||||||
&& module->memory_count == 0)
|
&& module->memory_count == 0)
|
||||||
goto fail_unknown_memory;
|
goto fail_unknown_memory;
|
||||||
|
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type =
|
|
||||||
module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
|
@ -14526,14 +14502,6 @@ re_scan:
|
||||||
&& module->memory_count == 0) {
|
&& module->memory_count == 0) {
|
||||||
goto fail_unknown_memory;
|
goto fail_unknown_memory;
|
||||||
}
|
}
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type =
|
|
||||||
module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
POP_I32();
|
POP_I32();
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
|
@ -15450,7 +15418,6 @@ re_scan:
|
||||||
#if WASM_ENABLE_SHARED_MEMORY != 0
|
#if WASM_ENABLE_SHARED_MEMORY != 0
|
||||||
case WASM_OP_ATOMIC_PREFIX:
|
case WASM_OP_ATOMIC_PREFIX:
|
||||||
{
|
{
|
||||||
/* TODO: memory64 offset type changes */
|
|
||||||
uint32 opcode1;
|
uint32 opcode1;
|
||||||
|
|
||||||
read_leb_uint32(p, p_end, opcode1);
|
read_leb_uint32(p, p_end, opcode1);
|
||||||
|
@ -15460,14 +15427,7 @@ re_scan:
|
||||||
#endif
|
#endif
|
||||||
if (opcode1 != WASM_OP_ATOMIC_FENCE) {
|
if (opcode1 != WASM_OP_ATOMIC_FENCE) {
|
||||||
CHECK_MEMORY();
|
CHECK_MEMORY();
|
||||||
read_leb_uint32(p, p_end, align); /* align */
|
read_leb_uint32(p, p_end, align); /* align */
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0].flags & MEMORY64_FLAG;
|
|
||||||
mem_offset_type =
|
|
||||||
is_memory64 ? VALUE_TYPE_I64 : VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
||||||
if (!check_memory_align_equal(opcode1, align, error_buf,
|
if (!check_memory_align_equal(opcode1, align, error_buf,
|
||||||
error_buf_size)) {
|
error_buf_size)) {
|
||||||
|
|
|
@ -6001,6 +6001,19 @@ re_scan:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if WASM_ENABLE_MEMORY64 != 0
|
||||||
|
/* TODO: multi-memories for now assuming the memory idx type is consistent
|
||||||
|
* across multi-memories */
|
||||||
|
if (module->import_memory_count > 0)
|
||||||
|
is_memory64 = module->import_memories[0].u.memory.flags & MEMORY64_FLAG;
|
||||||
|
else if (module->memory_count > 0)
|
||||||
|
is_memory64 = module->memories[0].flags & MEMORY64_FLAG;
|
||||||
|
|
||||||
|
mem_offset_type = is_memory64 ? VALUE_TYPE_I64 : VALUE_TYPE_I32;
|
||||||
|
#else
|
||||||
|
mem_offset_type = VALUE_TYPE_I32;
|
||||||
|
#endif
|
||||||
|
|
||||||
PUSH_CSP(LABEL_TYPE_FUNCTION, func_block_type, p);
|
PUSH_CSP(LABEL_TYPE_FUNCTION, func_block_type, p);
|
||||||
|
|
||||||
while (p < p_end) {
|
while (p < p_end) {
|
||||||
|
@ -7269,13 +7282,7 @@ re_scan:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
CHECK_MEMORY();
|
CHECK_MEMORY();
|
||||||
read_leb_uint32(p, p_end, align); /* align */
|
read_leb_uint32(p, p_end, align); /* align */
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0].flags & MEMORY64_FLAG;
|
|
||||||
mem_offset_type = is_memory64 ? VALUE_TYPE_I64 : VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
||||||
#if WASM_ENABLE_FAST_INTERP != 0
|
#if WASM_ENABLE_FAST_INTERP != 0
|
||||||
emit_uint32(loader_ctx, mem_offset);
|
emit_uint32(loader_ctx, mem_offset);
|
||||||
|
@ -7340,13 +7347,6 @@ re_scan:
|
||||||
/* reserved byte 0x00 */
|
/* reserved byte 0x00 */
|
||||||
bh_assert(*p == 0x00);
|
bh_assert(*p == 0x00);
|
||||||
p++;
|
p++;
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type = module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
PUSH_PAGE_COUNT();
|
PUSH_PAGE_COUNT();
|
||||||
|
|
||||||
module->possible_memory_grow = true;
|
module->possible_memory_grow = true;
|
||||||
|
@ -7360,13 +7360,6 @@ re_scan:
|
||||||
/* reserved byte 0x00 */
|
/* reserved byte 0x00 */
|
||||||
bh_assert(*p == 0x00);
|
bh_assert(*p == 0x00);
|
||||||
p++;
|
p++;
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type = module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_AND_PUSH(mem_offset_type, mem_offset_type);
|
POP_AND_PUSH(mem_offset_type, mem_offset_type);
|
||||||
|
|
||||||
module->possible_memory_grow = true;
|
module->possible_memory_grow = true;
|
||||||
|
@ -7718,14 +7711,6 @@ re_scan:
|
||||||
|
|
||||||
POP_I32();
|
POP_I32();
|
||||||
POP_I32();
|
POP_I32();
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type =
|
|
||||||
module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
#if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0
|
#if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0
|
||||||
func->has_memory_operations = true;
|
func->has_memory_operations = true;
|
||||||
|
@ -7755,14 +7740,6 @@ re_scan:
|
||||||
+ module->memory_count
|
+ module->memory_count
|
||||||
> 0);
|
> 0);
|
||||||
|
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type =
|
|
||||||
module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
|
@ -7780,14 +7757,6 @@ re_scan:
|
||||||
+ module->memory_count
|
+ module->memory_count
|
||||||
> 0);
|
> 0);
|
||||||
|
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
mem_offset_type =
|
|
||||||
module->memories[0].flags & MEMORY64_FLAG
|
|
||||||
? VALUE_TYPE_I64
|
|
||||||
: VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
POP_I32();
|
POP_I32();
|
||||||
POP_MEM_OFFSET();
|
POP_MEM_OFFSET();
|
||||||
|
@ -7945,7 +7914,6 @@ re_scan:
|
||||||
#if WASM_ENABLE_SHARED_MEMORY != 0
|
#if WASM_ENABLE_SHARED_MEMORY != 0
|
||||||
case WASM_OP_ATOMIC_PREFIX:
|
case WASM_OP_ATOMIC_PREFIX:
|
||||||
{
|
{
|
||||||
/* TODO: memory64 offset type changes */
|
|
||||||
uint32 opcode1;
|
uint32 opcode1;
|
||||||
|
|
||||||
read_leb_uint32(p, p_end, opcode1);
|
read_leb_uint32(p, p_end, opcode1);
|
||||||
|
@ -7955,14 +7923,7 @@ re_scan:
|
||||||
#endif
|
#endif
|
||||||
if (opcode1 != WASM_OP_ATOMIC_FENCE) {
|
if (opcode1 != WASM_OP_ATOMIC_FENCE) {
|
||||||
CHECK_MEMORY();
|
CHECK_MEMORY();
|
||||||
read_leb_uint32(p, p_end, align); /* align */
|
read_leb_uint32(p, p_end, align); /* align */
|
||||||
#if WASM_ENABLE_MEMORY64 != 0
|
|
||||||
is_memory64 = module->memories[0].flags & MEMORY64_FLAG;
|
|
||||||
mem_offset_type =
|
|
||||||
is_memory64 ? VALUE_TYPE_I64 : VALUE_TYPE_I32;
|
|
||||||
#else
|
|
||||||
mem_offset_type = VALUE_TYPE_I32;
|
|
||||||
#endif
|
|
||||||
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
|
||||||
#if WASM_ENABLE_FAST_INTERP != 0
|
#if WASM_ENABLE_FAST_INTERP != 0
|
||||||
emit_uint32(loader_ctx, mem_offset);
|
emit_uint32(loader_ctx, mem_offset);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user