From ba9402753de223d1e2b69db2580b0c2e2b98b207 Mon Sep 17 00:00:00 2001 From: TL Date: Thu, 28 Mar 2024 13:12:45 +0800 Subject: [PATCH] cr suggestions and remove repeated memory64 flag checking in classic-interp --- core/iwasm/common/wasm_application.c | 5 +- core/iwasm/common/wasm_runtime_common.c | 15 +++- core/iwasm/interpreter/wasm_interp_classic.c | 74 ++------------------ core/iwasm/interpreter/wasm_loader.c | 70 ++++-------------- core/iwasm/interpreter/wasm_mini_loader.c | 69 ++++-------------- 5 files changed, 50 insertions(+), 183 deletions(-) diff --git a/core/iwasm/common/wasm_application.c b/core/iwasm/common/wasm_application.c index 47d956e1c..13ad2b1a6 100644 --- a/core/iwasm/common/wasm_application.c +++ b/core/iwasm/common/wasm_application.c @@ -227,10 +227,9 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[]) #if WASM_ENABLE_MEMORY64 != 0 if (is_memory64) { argc1 = 3; - uint64_t app_addr = + uint64 app_addr = wasm_runtime_addr_native_to_app(module_inst, argv_offsets); - bh_memcpy_s(&(argv1[1]), sizeof(uint32) * 2, &app_addr, - sizeof(uint64)); + PUT_I64_TO_ADDR(&argv[1], app_addr); } else #endif diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index d523f7f1a..9f1aa94c2 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -3693,6 +3693,10 @@ wasm_runtime_invoke_native_raw(WASMExecEnv *exec_env, void *func_ptr, #endif { *(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[i + 1] == '*') { /* param is a pointer */ @@ -3722,13 +3726,13 @@ wasm_runtime_invoke_native_raw(WASMExecEnv *exec_env, void *func_ptr, module, (uint64)arg_i32); } } +#endif break; } case VALUE_TYPE_I64: #if WASM_ENABLE_MEMORY64 != 0 { - bh_memcpy_s(argv_dst, sizeof(uint64), argv_src, - sizeof(uint32) * 2); + PUT_I64_TO_ADDR((uint32 *)argv, GET_I64_FROM_ADDR(argv_src)); argv_src += 2; arg_i64 = *argv_dst; if (signature) { @@ -4847,6 +4851,10 @@ wasm_runtime_invoke_native(WASMExecEnv *exec_env, void *func_ptr, { arg_i32 = *argv_src++; 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[i + 1] == '*') { /* param is a pointer */ @@ -4874,6 +4882,7 @@ wasm_runtime_invoke_native(WASMExecEnv *exec_env, void *func_ptr, module, (uint64)arg_i32); } } +#endif if (n_ints < MAX_REG_INTS) ints[n_ints++] = arg_i64; else @@ -4883,7 +4892,7 @@ wasm_runtime_invoke_native(WASMExecEnv *exec_env, void *func_ptr, case VALUE_TYPE_I64: #if WASM_ENABLE_MEMORY64 != 0 { - arg_i64 = *(uint64 *)argv_src; + arg_i64 = GET_I64_FROM_ADDR(argv_src); argv_src += 2; if (signature) { /* TODO: memory64 pointer with length need a new symbol diff --git a/core/iwasm/interpreter/wasm_interp_classic.c b/core/iwasm/interpreter/wasm_interp_classic.c index aa28f5a97..ca972fd4b 100644 --- a/core/iwasm/interpreter/wasm_interp_classic.c +++ b/core/iwasm/interpreter/wasm_interp_classic.c @@ -1510,7 +1510,11 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, #endif #endif #if WASM_ENABLE_MEMORY64 != 0 + /* TODO: multi-memories for now assuming the memory idx type is consistent + * across multi-memories */ bool is_memory64 = false; + if (memory) + is_memory64 = memory->is_memory64; #endif #if WASM_ENABLE_DEBUG_INTERP != 0 @@ -4170,7 +4174,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, global = globals + global_idx; global_addr = get_global_addr(global_data, global); #if WASM_ENABLE_MEMORY64 != 0 - if (module->memories[0]->is_memory64) { + if (is_memory64) { aux_stack_top = *(uint64 *)(frame_sp - 2); } else @@ -4188,7 +4192,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, goto got_exception; } #if WASM_ENABLE_MEMORY64 != 0 - if (module->memories[0]->is_memory64) { + if (is_memory64) { *(uint64 *)global_addr = aux_stack_top; frame_sp -= 2; } @@ -4228,9 +4232,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(4); @@ -4247,9 +4248,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(8); @@ -4265,9 +4263,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(1); @@ -4283,9 +4278,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(1); @@ -4301,9 +4293,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(2); @@ -4319,9 +4308,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(2); @@ -4337,9 +4323,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(1); @@ -4355,9 +4338,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(1); @@ -4373,9 +4353,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(2); @@ -4391,9 +4368,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(2); @@ -4410,9 +4384,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, opcode = *(frame_ip - 1); 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(4); @@ -4428,9 +4399,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); addr = POP_MEM_OFFSET(); CHECK_MEMORY_OVERFLOW(4); @@ -4448,9 +4416,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); frame_sp--; addr = POP_MEM_OFFSET(); @@ -4476,9 +4441,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, mem_offset_t offset, addr; 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); frame_sp -= 2; addr = POP_MEM_OFFSET(); @@ -4509,9 +4471,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, opcode = *(frame_ip - 1); 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); sval = (uint32)POP_I32(); addr = POP_MEM_OFFSET(); @@ -4539,9 +4498,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, opcode = *(frame_ip - 1); 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); sval = (uint64)POP_I64(); addr = POP_MEM_OFFSET(); @@ -4568,9 +4524,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, { uint32 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); (void)reserved; HANDLE_OP_END(); @@ -4581,9 +4534,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint32 reserved, delta, 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); 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); /* skip memory index */ frame_ip++; -#if WASM_ENABLE_MEMORY64 != 0 - is_memory64 = module->memories[0]->is_memory64; -#endif bytes = (uint64)(uint32)POP_I32(); offset = (uint64)(uint32)POP_I32(); @@ -5654,9 +5601,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint8 *mdst, *msrc; frame_ip += 2; -#if WASM_ENABLE_MEMORY64 != 0 - is_memory64 = module->memories[0]->is_memory64; -#endif len = POP_MEM_OFFSET(); src = POP_MEM_OFFSET(); dst = POP_MEM_OFFSET(); @@ -5689,9 +5633,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint8 fill_val, *mdst; frame_ip++; -#if WASM_ENABLE_MEMORY64 != 0 - is_memory64 = module->memories[0]->is_memory64; -#endif len = POP_MEM_OFFSET(); fill_val = POP_I32(); dst = POP_MEM_OFFSET(); @@ -5935,9 +5876,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, if (opcode != WASM_OP_ATOMIC_FENCE) { 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); } diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index f984eecf3..44ce4b3d8 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -10838,6 +10838,19 @@ re_scan: } #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); while (p < p_end) { @@ -12977,13 +12990,7 @@ re_scan: } #endif CHECK_MEMORY(); - 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_uint32(p, p_end, align); /* align */ read_leb_mem_offset(p, p_end, mem_offset); /* offset */ if (!check_memory_access_align(opcode, align, error_buf, error_buf_size)) { @@ -13055,14 +13062,6 @@ re_scan: "zero byte expected"); 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(); module->possible_memory_grow = true; @@ -13079,13 +13078,6 @@ re_scan: "zero byte expected"); 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); module->possible_memory_grow = true; @@ -14447,14 +14439,6 @@ re_scan: 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(); #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 func->has_memory_operations = true; @@ -14498,14 +14482,6 @@ re_scan: && module->memory_count == 0) 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(); @@ -14526,14 +14502,6 @@ re_scan: && module->memory_count == 0) { 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_I32(); POP_MEM_OFFSET(); @@ -15450,7 +15418,6 @@ re_scan: #if WASM_ENABLE_SHARED_MEMORY != 0 case WASM_OP_ATOMIC_PREFIX: { - /* TODO: memory64 offset type changes */ uint32 opcode1; read_leb_uint32(p, p_end, opcode1); @@ -15460,14 +15427,7 @@ re_scan: #endif if (opcode1 != WASM_OP_ATOMIC_FENCE) { CHECK_MEMORY(); - 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_uint32(p, p_end, align); /* align */ read_leb_mem_offset(p, p_end, mem_offset); /* offset */ if (!check_memory_align_equal(opcode1, align, error_buf, error_buf_size)) { diff --git a/core/iwasm/interpreter/wasm_mini_loader.c b/core/iwasm/interpreter/wasm_mini_loader.c index 95d164d6f..a734595ab 100644 --- a/core/iwasm/interpreter/wasm_mini_loader.c +++ b/core/iwasm/interpreter/wasm_mini_loader.c @@ -6001,6 +6001,19 @@ re_scan: } #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); while (p < p_end) { @@ -7269,13 +7282,7 @@ re_scan: } #endif CHECK_MEMORY(); - 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_uint32(p, p_end, align); /* align */ read_leb_mem_offset(p, p_end, mem_offset); /* offset */ #if WASM_ENABLE_FAST_INTERP != 0 emit_uint32(loader_ctx, mem_offset); @@ -7340,13 +7347,6 @@ re_scan: /* reserved byte 0x00 */ bh_assert(*p == 0x00); 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(); module->possible_memory_grow = true; @@ -7360,13 +7360,6 @@ re_scan: /* reserved byte 0x00 */ bh_assert(*p == 0x00); 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); module->possible_memory_grow = true; @@ -7718,14 +7711,6 @@ re_scan: 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(); #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 func->has_memory_operations = true; @@ -7755,14 +7740,6 @@ re_scan: + module->memory_count > 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(); @@ -7780,14 +7757,6 @@ re_scan: + module->memory_count > 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_I32(); POP_MEM_OFFSET(); @@ -7945,7 +7914,6 @@ re_scan: #if WASM_ENABLE_SHARED_MEMORY != 0 case WASM_OP_ATOMIC_PREFIX: { - /* TODO: memory64 offset type changes */ uint32 opcode1; read_leb_uint32(p, p_end, opcode1); @@ -7955,14 +7923,7 @@ re_scan: #endif if (opcode1 != WASM_OP_ATOMIC_FENCE) { CHECK_MEMORY(); - 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_uint32(p, p_end, align); /* align */ read_leb_mem_offset(p, p_end, mem_offset); /* offset */ #if WASM_ENABLE_FAST_INTERP != 0 emit_uint32(loader_ctx, mem_offset);