V8, SpiderMonkey, and JavaScriptCore all say this invalid module is valid:
(module
(func $invalid
(local $i32 i32)
(unreachable)
(ref.as_non_null)
(local.set $i32)
)
)
I guess production engines never bothered to implement (ref ⊥), so they just have the ref.as_non_null push ⊥ in this situation. The reference interpreter and wasm-tools get this right. WABT gets this wrong. Binaryen doesn't even try to validate unreachable code correctly.
We should probably add a spec test for this, but OTOH that would be really annoying for the engines for no real benefit.
Maybe it's time to revisit the relaxed dead code validation proposal 🤔
cc @conrad-watt
V8, SpiderMonkey, and JavaScriptCore all say this invalid module is valid:
I guess production engines never bothered to implement
(ref ⊥), so they just have theref.as_non_nullpush⊥in this situation. The reference interpreter and wasm-tools get this right. WABT gets this wrong. Binaryen doesn't even try to validate unreachable code correctly.We should probably add a spec test for this, but OTOH that would be really annoying for the engines for no real benefit.
Maybe it's time to revisit the relaxed dead code validation proposal 🤔
cc @conrad-watt