Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 memory idx type 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
7 changes: 4 additions & 3 deletions wamr-compiler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ 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(" By default, it is disabled on all 64-bit platforms except SGX or when\n");
printf(" memory64 is enabled. In these platform and feature combinations,\n");
printf(" the runtime performs bounds checks with a hardware trap;\n");
printf(" By default, it is enabled on all 32-bit platforms or when using memory64.\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