mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-11-27 18:11:21 +00:00
add a toggle to enable extended const on wamrc (#4412)
This commit is contained in:
parent
a5170aadc7
commit
ff132c3c5d
|
|
@ -1960,13 +1960,15 @@ aot_emit_init_expr(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
|
|||
case INIT_EXPR_TYPE_I64_ADD:
|
||||
case INIT_EXPR_TYPE_I64_SUB:
|
||||
case INIT_EXPR_TYPE_I64_MUL:
|
||||
if (!aot_emit_init_expr(buf, buf_end, &offset, comp_ctx,
|
||||
expr->u.binary.l_expr)) {
|
||||
return false;
|
||||
}
|
||||
if (!aot_emit_init_expr(buf, buf_end, &offset, comp_ctx,
|
||||
expr->u.binary.r_expr)) {
|
||||
return false;
|
||||
if (comp_ctx->enable_extended_const) {
|
||||
if (!aot_emit_init_expr(buf, buf_end, &offset, comp_ctx,
|
||||
expr->u.binary.l_expr)) {
|
||||
return false;
|
||||
}
|
||||
if (!aot_emit_init_expr(buf, buf_end, &offset, comp_ctx,
|
||||
expr->u.binary.r_expr)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2703,6 +2703,9 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
|
|||
if (option->enable_shared_heap)
|
||||
comp_ctx->enable_shared_heap = true;
|
||||
|
||||
if (option->enable_extended_const)
|
||||
comp_ctx->enable_extended_const = true;
|
||||
|
||||
comp_ctx->opt_level = option->opt_level;
|
||||
comp_ctx->size_level = option->size_level;
|
||||
|
||||
|
|
|
|||
|
|
@ -457,6 +457,9 @@ typedef struct AOTCompContext {
|
|||
/* Enable LLVM PGO (Profile-Guided Optimization) */
|
||||
bool enable_llvm_pgo;
|
||||
|
||||
/* Enable extended constant expression */
|
||||
bool enable_extended_const;
|
||||
|
||||
/* Treat unknown import function as wasm-c-api import function
|
||||
and allow to directly invoke it from AOT/JIT code */
|
||||
bool quick_invoke_c_api_import;
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ typedef struct AOTCompOption {
|
|||
bool enable_ref_types;
|
||||
bool enable_gc;
|
||||
bool enable_aux_stack_check;
|
||||
bool enable_extended_const;
|
||||
AOTStackFrameType aux_stack_frame_type;
|
||||
AOTCallStackFeatures call_stack_features;
|
||||
bool enable_perf_profiling;
|
||||
|
|
|
|||
|
|
@ -292,6 +292,10 @@ Currently we only profile the memory consumption of module, module_instance and
|
|||
- **WAMR_BUILD_AOT_INTRINSICS**=1/0, enable the AOT intrinsic functions, default to enable if not set. These functions can be called from the AOT code when `--disable-llvm-intrinsics` flag or `--enable-builtin-intrinsics=<intr1,intr2,...>` flag is used by wamrc to generate the AOT file.
|
||||
> Note: See [Tuning the XIP intrinsic functions](./xip.md#tuning-the-xip-intrinsic-functions) for more details.
|
||||
|
||||
### **Enable extended constant expression**
|
||||
- **WAMR_BUILD_EXTENDED_CONST_EXPR**=1/0, default to disable if not set.
|
||||
> Note: See [Extended Constant Expressions](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md) for more details.
|
||||
|
||||
### **Configurable memory access boundary check**
|
||||
- **WAMR_CONFIGURABLE_BOUNDS_CHECKS**=1/0, default to disable if not set
|
||||
> Note: If it is enabled, allow to run `iwasm --disable-bounds-checks` to disable the memory access boundary checks for interpreter mode.
|
||||
|
|
|
|||
|
|
@ -1160,6 +1160,9 @@ def compile_wasm_to_aot(wasm_tempfile, aot_tempfile, runner, opts, r, output = '
|
|||
cmd.append("--enable-gc")
|
||||
cmd.append("--enable-tail-call")
|
||||
|
||||
if opts.extended_const:
|
||||
cmd.append("--enable-extended-const")
|
||||
|
||||
if output == 'object':
|
||||
cmd.append("--format=object")
|
||||
elif output == 'ir':
|
||||
|
|
|
|||
|
|
@ -38,12 +38,6 @@ else()
|
|||
add_definitions(-DWASM_ENABLE_SIMD=1)
|
||||
endif()
|
||||
|
||||
if (WAMR_BUILD_EXTENDED_CONST_EXPR EQUAL 0)
|
||||
add_definitions(-DWASM_ENABLE_EXTENDED_CONST_EXPR=0)
|
||||
else()
|
||||
add_definitions(-DWASM_ENABLE_EXTENDED_CONST_EXPR=1)
|
||||
endif()
|
||||
|
||||
add_definitions(-DWASM_ENABLE_INTERP=1)
|
||||
add_definitions(-DWASM_ENABLE_WAMR_COMPILER=1)
|
||||
add_definitions(-DWASM_ENABLE_BULK_MEMORY=1)
|
||||
|
|
@ -59,6 +53,7 @@ add_definitions(-DWASM_ENABLE_PERF_PROFILING=1)
|
|||
add_definitions(-DWASM_ENABLE_LOAD_CUSTOM_SECTION=1)
|
||||
add_definitions(-DWASM_ENABLE_MODULE_INST_CONTEXT=1)
|
||||
add_definitions(-DWASM_ENABLE_MEMORY64=1)
|
||||
add_definitions(-DWASM_ENABLE_EXTENDED_CONST_EXPR=1)
|
||||
|
||||
add_definitions(-DWASM_ENABLE_GC=1)
|
||||
|
||||
|
|
|
|||
|
|
@ -418,6 +418,7 @@ main(int argc, char *argv[])
|
|||
option.enable_bulk_memory = true;
|
||||
option.enable_ref_types = true;
|
||||
option.enable_gc = false;
|
||||
option.enable_extended_const = false;
|
||||
aot_call_stack_features_init_default(&option.call_stack_features);
|
||||
|
||||
/* Process options */
|
||||
|
|
@ -531,6 +532,9 @@ main(int argc, char *argv[])
|
|||
else if (!strcmp(argv[0], "--disable-aux-stack-check")) {
|
||||
option.enable_aux_stack_check = false;
|
||||
}
|
||||
else if (!strcmp(argv[0], "--enable-extended-const")) {
|
||||
option.enable_extended_const = true;
|
||||
}
|
||||
else if (!strcmp(argv[0], "--enable-dump-call-stack")) {
|
||||
option.aux_stack_frame_type = AOT_STACK_FRAME_TYPE_STANDARD;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user