File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -3204,6 +3204,21 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
32043204
32053205#if WASM_ENABLE_WAMR_COMPILER != 0
32063206 WASMModule * wasm_module = (WASMModule * )comp_data -> wasm_module ;
3207+ bool is_memory64 = false;
3208+
3209+ /* TODO: multi-memories for now assuming the memory64 flag of a memory is
3210+ * consistent across multi-memories */
3211+ if (wasm_module -> import_memory_count > 0 )
3212+ is_memory64 = !!(wasm_module -> import_memories [0 ].u .memory .mem_type .flags
3213+ & MEMORY64_FLAG );
3214+ else if (wasm_module -> memory_count > 0 )
3215+ is_memory64 = !!(wasm_module -> memories [0 ].flags & MEMORY64_FLAG );
3216+
3217+ if (!(option -> bounds_checks == 1 || option -> bounds_checks == 0 )
3218+ && is_memory64 ) {
3219+ /* For memory64, the boundary check default value is true */
3220+ comp_ctx -> enable_bound_check = true;
3221+ }
32073222
32083223 /* Return error if SIMD is disabled by command line but SIMD instructions
32093224 * are used */
Original file line number Diff line number Diff line change @@ -137,9 +137,12 @@ print_help()
137137 printf (" 3 - Small code model\n" );
138138 printf (" -sgx Generate code for SGX platform (Intel Software Guard Extensions)\n" );
139139 printf (" --bounds-checks=1/0 Enable or disable the bounds checks for memory access:\n" );
140- printf (" by default it is disabled in all 64-bit platforms except SGX and\n" );
141- printf (" in these platforms runtime does bounds checks with hardware trap,\n" );
142- printf (" and by default it is enabled in all 32-bit platforms\n" );
140+ printf (" This flag controls bounds checking with a software check. \n" );
141+ printf (" On 64-bit platforms, it is disabled by default, using a hardware \n" );
142+ printf (" trap if supported, except when SGX or memory64 is enabled,\n" );
143+ printf (" which defaults to a software check.\n" );
144+ printf (" On 32-bit platforms, the flag is enabled by default, using a software check\n" );
145+ printf (" due to the lack of hardware support.\n" );
143146 printf (" CAVEAT: --bounds-checks=0 enables some optimizations\n" );
144147 printf (" which make the compiled AOT module incompatible\n" );
145148 printf (" with a runtime without the hardware bounds checks.\n" );
You can’t perform that action at this time.
0 commit comments