mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-30 21:02:27 +00:00 
			
		
		
		
	Enable aot memory64 sw bounds checks by default (#4350)
- enable aot memory64 sw bounds checks by default
This commit is contained in:
		
							parent
							
								
									7f968f5926
								
							
						
					
					
						commit
						c4623e2cb5
					
				|  | @ -3204,6 +3204,21 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option) | ||||||
| 
 | 
 | ||||||
| #if WASM_ENABLE_WAMR_COMPILER != 0 | #if WASM_ENABLE_WAMR_COMPILER != 0 | ||||||
|     WASMModule *wasm_module = (WASMModule *)comp_data->wasm_module; |     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
 |     /* Return error if SIMD is disabled by command line but SIMD instructions
 | ||||||
|      * are used */ |      * are used */ | ||||||
|  |  | ||||||
|  | @ -137,9 +137,12 @@ print_help() | ||||||
|     printf("                              3 - Small code model\n"); |     printf("                              3 - Small code model\n"); | ||||||
|     printf("  -sgx                      Generate code for SGX platform (Intel Software Guard Extensions)\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("  --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("                              This flag controls bounds checking with a software check. \n");  | ||||||
|     printf("                              in these platforms runtime does bounds checks with hardware trap,\n"); |     printf("                              On 64-bit platforms, it is disabled by default, using a hardware \n");  | ||||||
|     printf("                              and by default it is enabled in all 32-bit platforms\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("                            CAVEAT: --bounds-checks=0 enables some optimizations\n"); | ||||||
|     printf("                              which make the compiled AOT module incompatible\n"); |     printf("                              which make the compiled AOT module incompatible\n"); | ||||||
|     printf("                              with a runtime without the hardware bounds checks.\n"); |     printf("                              with a runtime without the hardware bounds checks.\n"); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 TianlongLiang
						TianlongLiang