V3 interpreter: ClassCastException (DF64 → DI64) after catch_all of an exception with a payload
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
The issue is in the V3 interpreter's exception handling. Look at the code for try_table and catch_all in the interpreter (likely in V3C_V3Interpreter.java). The problem is that after a catch_all, the operand stack may incorrectly contain the exception payload. Start by tracing the execution of the provided WASM module, focusing on how values are pushed/popped around the try_table block. Check the unbox_w method in V3K_Values.java for the casting error. Verify the fix by running the repro.wasm test and ensuring it returns 0.
索引モデルが issue の本文から書いたものです。
説明
The V3 interpreter throws a Java ClassCastException on a valid module that catches an exception with catch_all.
Reproduced on: 5e91335 (2026-09-21), JVM build (build.sh wizeng jvm); the only later commit, 10ca71f, is docs-only.
Module (reduced automatically from a generated program; validates with wasm-tools validate):
(module
(type (;0;) (func))
(type (;1;) (func (param i32)))
(type (;2;) (func (param i64)))
(type (;3;) (func (param f64)))
(type (;4;) (func (param v128)))
(type (;5;) (func (param i64 i32)))
(type (;6;) (func (param f32 v128 i64)))
(type (;7;) (func (param i32 i64 f32 f64 v128)))
(type (;8;) (func (result i64)))
(tag $tag0 (;0;) (type 0))
(tag $tag1 (;1;) (type 1) (param i32))
(tag $tag2 (;2;) (type 2) (param i64))
(tag $tag3 (;3;) (type 3) (param f64))
(tag $tag4 (;4;) (type 4) (param v128))
(tag $tag5 (;5;) (type 5) (param i64 i32))
(tag $tag6 (;6;) (type 6) (param f32 v128 i64))
(tag $tag7 (;7;) (type 7) (param i32 i64 f32 f64 v128))
(global $g (;0;) (mut i64) i64.const 4660)
(export "x" (func 1))
(func $e0 (;0;) (type 8) (result i64)
(local $h i64) (local $vi320 i32) (local $vi321 i32) (local $vi322 i32) (local $vi640 i64) (local $vi641 i64) (local $vi642 i64) (local $vf320 f32) (local $vf321 f32) (local $vf322 f32) (local $vf640 f64) (local $vf641 f64) (local $vf642 f64) (local $vv1280 v128) (local $vv1281 v128) (local $vv1282 v128) (local $x0 exnref) (local $x1 v128) (local $i1 i32) (local $x3 v128) (local $x4 f64)
local.get $h
i64x2.splat
i64x2.extract_lane 0
block $L13
try_table (catch_all $L13) ;; label = @2
local.get $vi640
i64.const 174
i64.lt_u
if (result f64) ;; label = @3
global.get $g
f64.reinterpret_i64
throw $tag3
else
local.get $h
f64.reinterpret_i64
end
i64.reinterpret_f64
local.set $h
end
end
local.get $h
i64x2.splat
i64x2.extract_lane 1
i64.xor
local.set $h
local.get $h
)
(func (;1;) (type 8) (result i64)
call $e0
)
)
$ wizeng --invoke=x --print-result repro.wasm
Exception in thread "main" java.lang.ClassCastException: class V3C_Value$DF64 cannot be cast to class V3C_Value$DI64
at V3K_Values.unbox_w(Unknown Source)
at V3C_V3Interpreter.do_ww_w(Unknown Source)
at V3C_V3Interpreter.execOp(Unknown Source)
Expected: 0. wasmtime and V8 (node 26) both return 0.
What the module does: an i64 is live on the operand stack below block $L13. Inside it, try_table (catch_all $L13) throws $tag3, whose payload is an f64. After the catch, the following i64.xor gets an f64 operand. It looks as if the tag's payload is left on the operand stack when catch_all branches to its label. That's only a guess from the symptom; I haven't looked at the interpreter code.
Related symptoms: across about 1000 generated exception-handling programs, 13 misbehave on Wizard main:
- 11 throw a
ClassCastExceptionbetween value kinds (DF64→DI64,DI32→DI64,DV128→DI64,DI64→DF32); - 2 return a wrong value (presumably when the kinds happen to match).
- 主要言語
- WebAssembly
- スター
- 514
- フォーク
- 52
- 平均マージ
- 2時間 58分
- マージ済み PR(30日)
- 16
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
titzer/wizard-engine のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
titzer/wizard-engine#649 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
titzer/wizard-engine#648 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
titzer/wizard-engine#655 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
titzer/wizard-engine#654 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
titzer/wizard-engine#638 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
titzer/wizard-engine の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
rescript-lang/rescript#9135 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CanadaHonk/porffor#426 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信