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
16 changes: 9 additions & 7 deletions core/iwasm/compilation/aot_emit_aot_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions core/iwasm/compilation/aot_llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions core/iwasm/compilation/aot_llvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions core/iwasm/include/aot_comp_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions doc/build_wamr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions tests/wamr-test-suites/spec-test-script/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
7 changes: 1 addition & 6 deletions wamr-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions wamr-compiler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}
Expand Down
Loading