Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions core/iwasm/compilation/aot_llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3204,6 +3204,21 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)

#if WASM_ENABLE_WAMR_COMPILER != 0
WASMModule *wasm_module = (WASMModule *)comp_data->wasm_module;
bool is_memory64 = false;

/* TODO: multi-memories for now assuming the memory64 flag of a memory is
* consistent across multi-memories */
if (wasm_module->import_memory_count > 0)
is_memory64 = !!(wasm_module->import_memories[0].u.memory.mem_type.flags
& MEMORY64_FLAG);
else if (wasm_module->memory_count > 0)
is_memory64 = !!(wasm_module->memories[0].flags & MEMORY64_FLAG);

if (!(option->bounds_checks == 1 || option->bounds_checks == 0)
&& is_memory64) {
/* For memory64, the boundary check default value is true */
comp_ctx->enable_bound_check = true;
}

/* Return error if SIMD is disabled by command line but SIMD instructions
* are used */
Expand Down
9 changes: 6 additions & 3 deletions wamr-compiler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ print_help()
printf(" 3 - Small code model\n");
printf(" -sgx Generate code for SGX platform (Intel Software Guard Extensions)\n");
printf(" --bounds-checks=1/0 Enable or disable the bounds checks for memory access:\n");
printf(" by default it is disabled in all 64-bit platforms except SGX and\n");
printf(" in these platforms runtime does bounds checks with hardware trap,\n");
printf(" and by default it is enabled in all 32-bit platforms\n");
printf(" This flag controls bounds checking with a software check. \n");
printf(" On 64-bit platforms, it is disabled by default, using a hardware \n");
printf(" trap if supported, except when SGX or memory64 is enabled,\n");
printf(" which defaults to a software check.\n");
printf(" On 32-bit platforms, the flag is enabled by default, using a software check\n");
printf(" due to the lack of hardware support.\n");
printf(" CAVEAT: --bounds-checks=0 enables some optimizations\n");
printf(" which make the compiled AOT module incompatible\n");
printf(" with a runtime without the hardware bounds checks.\n");
Expand Down
Loading