cr suggestions

This commit is contained in:
TL 2024-03-28 15:21:15 +08:00
parent ba9402753d
commit 0d2074d27a
4 changed files with 23 additions and 28 deletions

View File

@ -914,7 +914,7 @@ memory_instantiate(AOTModuleInstance *module_inst, AOTModuleInstance *parent,
bh_assert(max_memory_data_size <= MAX_LINEAR_MEMORY_SIZE); bh_assert(max_memory_data_size <= MAX_LINEAR_MEMORY_SIZE);
(void)max_memory_data_size; (void)max_memory_data_size;
/* TODO: memory64 use is_memory64 flag */ /* TODO: memory64 uses is_memory64 flag */
if (wasm_allocate_linear_memory(&p, is_shared_memory, false, if (wasm_allocate_linear_memory(&p, is_shared_memory, false,
num_bytes_per_page, init_page_count, num_bytes_per_page, init_page_count,
max_page_count, &memory_data_size) max_page_count, &memory_data_size)

View File

@ -3732,7 +3732,8 @@ wasm_runtime_invoke_native_raw(WASMExecEnv *exec_env, void *func_ptr,
case VALUE_TYPE_I64: case VALUE_TYPE_I64:
#if WASM_ENABLE_MEMORY64 != 0 #if WASM_ENABLE_MEMORY64 != 0
{ {
PUT_I64_TO_ADDR((uint32 *)argv, GET_I64_FROM_ADDR(argv_src)); PUT_I64_TO_ADDR((uint32 *)argv_dst,
GET_I64_FROM_ADDR(argv_src));
argv_src += 2; argv_src += 2;
arg_i64 = *argv_dst; arg_i64 = *argv_dst;
if (signature) { if (signature) {

View File

@ -10785,6 +10785,16 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
#endif #endif
#if WASM_ENABLE_MEMORY64 != 0 #if WASM_ENABLE_MEMORY64 != 0
bool is_memory64 = false; bool is_memory64 = false;
/* 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 #endif
global_count = module->import_global_count + module->global_count; global_count = module->import_global_count + module->global_count;
@ -10838,19 +10848,6 @@ 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) {

View File

@ -5960,6 +5960,16 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
#endif #endif
#if WASM_ENABLE_MEMORY64 != 0 #if WASM_ENABLE_MEMORY64 != 0
bool is_memory64 = false; bool is_memory64 = false;
/* 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 #endif
global_count = module->import_global_count + module->global_count; global_count = module->import_global_count + module->global_count;
@ -6001,19 +6011,6 @@ 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) {