aot compiler: Propagate const-ness by ourselves (#3567)

aot_load_const_from_table() hides the const-ness of the
value and prevents optimizations like
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3552.

This commit makes the aot compiler tracks the const-ness
of the value directly in the AOTValue and enables the above
mentioned optimization for XIP.
This commit is contained in:
YAMAMOTO Takashi
2024-06-25 11:57:49 +09:00
committed by GitHub
parent e66b41427f
commit 867dbd8912
4 changed files with 26 additions and 4 deletions

View File

@ -605,6 +605,14 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
#define PUSH_PAGE_COUNT(v) \
PUSH(v, MEMORY64_COND_VALUE(VALUE_TYPE_I64, VALUE_TYPE_I32))
#define SET_CONST(v) \
do { \
AOTValue *aot_value = \
func_ctx->block_stack.block_list_end->value_stack.value_list_end; \
aot_value->is_const = true; \
aot_value->const_value = (v); \
} while (0)
#define TO_LLVM_TYPE(wasm_type) \
wasm_type_to_llvm_type(comp_ctx, &comp_ctx->basic_types, wasm_type)