Fix table idx resolving in op call_indirect/return_call_indirect (#3726)

The table index in the call_indirect/return_call_indirect opcode should be
one byte 0x00 when ref-types/GC isn't enabled, and should be treated as
leb u32 when ref-types/GC is enabled.

And make aot compiler bail out if ref-types/GC is disabled by command line
argument while ref-types instructions are used.
This commit is contained in:
Wenyong Huang
2024-08-19 10:57:36 +08:00
committed by GitHub
parent 88caa0c53a
commit 97c95a2e2f
4 changed files with 30 additions and 8 deletions

View File

@ -3108,6 +3108,16 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
goto fail;
}
/* Return error if ref-types and GC are disabled by command line but
ref-types instructions are used */
if (!option->enable_ref_types && !option->enable_gc
&& wasm_module->is_ref_types_used) {
aot_set_last_error("ref-types instruction was found, "
"try removing --disable-ref-types option "
"or adding --enable-gc option.");
goto fail;
}
/* Disable features when they are not actually used */
if (!wasm_module->is_simd_used) {
option->enable_simd = comp_ctx->enable_simd = false;