From 071e2aaed5455055fae67b79a453c250a6082c8e Mon Sep 17 00:00:00 2001 From: "liang.he" Date: Mon, 24 Nov 2025 14:37:46 +0800 Subject: [PATCH] Merge commit from fork * fix: remove SIMD prefix handling from interpreter and update opcode definitions * test: add case for classic interpreter handling of unsupported SIMD opcodes --- core/iwasm/interpreter/wasm_interp_classic.c | 2 -- core/iwasm/interpreter/wasm_opcode.h | 9 +-------- .../ba-issues/issues/issue-980001/v128.wasm | Bin 0 -> 91 bytes .../ba-issues/issues/issue-980001/v128.wat | 13 +++++++++++++ tests/regression/ba-issues/running_config.json | 16 ++++++++++++++++ 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 tests/regression/ba-issues/issues/issue-980001/v128.wasm create mode 100644 tests/regression/ba-issues/issues/issue-980001/v128.wat diff --git a/core/iwasm/interpreter/wasm_interp_classic.c b/core/iwasm/interpreter/wasm_interp_classic.c index 0603a00b4..f2a33437a 100644 --- a/core/iwasm/interpreter/wasm_interp_classic.c +++ b/core/iwasm/interpreter/wasm_interp_classic.c @@ -6580,12 +6580,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, HANDLE_OP(WASM_OP_CATCH_ALL) HANDLE_OP(EXT_OP_TRY) #endif -#if WASM_ENABLE_JIT != 0 && WASM_ENABLE_SIMD != 0 /* SIMD isn't supported by interpreter, but when JIT is enabled, `iwasm --interp ` may be run to trigger the SIMD opcode in interpreter */ HANDLE_OP(WASM_OP_SIMD_PREFIX) -#endif HANDLE_OP(WASM_OP_UNUSED_0x16) HANDLE_OP(WASM_OP_UNUSED_0x17) HANDLE_OP(WASM_OP_UNUSED_0x27) diff --git a/core/iwasm/interpreter/wasm_opcode.h b/core/iwasm/interpreter/wasm_opcode.h index b049e0a3a..114738413 100644 --- a/core/iwasm/interpreter/wasm_opcode.h +++ b/core/iwasm/interpreter/wasm_opcode.h @@ -790,13 +790,6 @@ typedef enum WASMAtomicEXTOpcode { #endif #define SET_GOTO_TABLE_ELEM(opcode) [opcode] = HANDLE_OPCODE(opcode) -#if WASM_ENABLE_SIMDE != 0 -#define SET_GOTO_TABLE_SIMD_PREFIX_ELEM() \ - SET_GOTO_TABLE_ELEM(WASM_OP_SIMD_PREFIX), -#else -#define SET_GOTO_TABLE_SIMD_PREFIX_ELEM() -#endif - #if WASM_ENABLE_SIMDE != 0 #define DEF_EXT_V128_HANDLE() \ SET_GOTO_TABLE_ELEM(EXT_OP_SET_LOCAL_FAST_V128), /* 0xdd */ \ @@ -1038,7 +1031,7 @@ typedef enum WASMAtomicEXTOpcode { HANDLE_OPCODE(EXT_OP_TRY), /* 0xdb */ \ SET_GOTO_TABLE_ELEM(WASM_OP_GC_PREFIX), /* 0xfb */ \ SET_GOTO_TABLE_ELEM(WASM_OP_MISC_PREFIX), /* 0xfc */ \ - SET_GOTO_TABLE_SIMD_PREFIX_ELEM() /* 0xfd */ \ + SET_GOTO_TABLE_ELEM(WASM_OP_SIMD_PREFIX), /* 0xfd */ \ SET_GOTO_TABLE_ELEM(WASM_OP_ATOMIC_PREFIX), /* 0xfe */ \ DEF_DEBUG_BREAK_HANDLE() DEF_EXT_V128_HANDLE() \ }; diff --git a/tests/regression/ba-issues/issues/issue-980001/v128.wasm b/tests/regression/ba-issues/issues/issue-980001/v128.wasm new file mode 100644 index 0000000000000000000000000000000000000000..b27c5b742808a222388dd2d8e4ff25e1f5524ff8 GIT binary patch literal 91 zcmZQbEY4+QU|?WuX=rF*U`$|OU~U4l7+4`9jEs!zeIOAg=G@d=CI*(=#LPSf2Clha dRntKvgCm2Zz+VOy21f-D`S%**Uv3r#ZUE>(7T*8> literal 0 HcmV?d00001 diff --git a/tests/regression/ba-issues/issues/issue-980001/v128.wat b/tests/regression/ba-issues/issues/issue-980001/v128.wat new file mode 100644 index 000000000..51e254de1 --- /dev/null +++ b/tests/regression/ba-issues/issues/issue-980001/v128.wat @@ -0,0 +1,13 @@ +(module + (type (;0;) (func)) + (func (;0;) (type 0) + i32.const 0 + i32.const 16 + v128.load + i32.const 32 + v128.load + i64x2.eq + v128.store) + (memory (;0;) 1 1) + (export "mem" (memory 0)) + (export "main" (func 0))) diff --git a/tests/regression/ba-issues/running_config.json b/tests/regression/ba-issues/running_config.json index 61665f2fc..e7a4a3117 100644 --- a/tests/regression/ba-issues/running_config.json +++ b/tests/regression/ba-issues/running_config.json @@ -1802,6 +1802,22 @@ "stdout content": "Exception: unreachable", "description": "no 'frame offset overflow'" } + }, + { + "deprecated": false, + "ids": [ + 980001 + ], + "runtime": "iwasm-llvm-jit", + "file": "v128.wasm", + "mode": "classic-interp", + "options": "-f main", + "argument": "", + "expected return": { + "ret code": 1, + "stdout content": "Exception: unsupported opcode", + "description": "classic-interp will exit gracefully when meeting simd opcodes" + } } ] }