Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes
exnrefa real Object subject to the host GC lifecycle etc.More spec tests and real world examples shows that this is the correct way forward.
This is rolled out as breaking change for people using
ExnRefexplicitly at the boundaries, but I'd expect those use cases to be very limited(non at best of my understanding).Exception references had no identity.
Instance.registerExceptionkeyed exceptions by tag index, so two live exceptions sharing a tag collapsed onto one another — capture A (payload 1), capture B (payload 2), thenthrow_refA, and you got B. The spec requires a fresh exception instance perthrow.exnrefis now theWasmExceptionobject itself, carried on the object-ref machinery theGcRefStoreelimination already built. Verified against wasmtime 50.0.0-dev: the reproducer goes from22/22/22, select→2to the correct12/12/12, select→1,2, on both the interpreter and the AOT compiler.Breaking changes
apply()now throws for exnref signatures — useapplyWithRefs()/CallResult, exactly as for WasmGC types andexternrefsince 1.0.Instance.exn(int)andregisterException(...)are removed. Modules compiled ahead of time by an earlier version must be regenerated. AOT output carries no version stamp, so a stale artifact fails withNoSuchMethodErrorat the first exception thrown — not at build or class-load time.InterpreterMachine.THROW_REFchanged from(Instance, int, …)to(Instance, Object, …). It isprotected staticon a public class, so external subclasses break at compile time. It is not referenced from generated bytecode.A GitHub-wide search found no application code exposing
exnrefat a host boundary —export exnrefreturns zero hits, and every(result exnref)/(param exnref)hit is a spec suite, a toolchain internal (Binaryen, wasm-bindgen, Kotlin, Scala.js), a browser-engine test, or documentation.Also fixed
ref.test/ref.castagainstexnreturnedfalsefor valid exception references.throw_refon a non-exception reference now traps instead of escaping asClassCastException.Coverage
New corpus tests, all over both the interpreter and the AOT compiler, with every expected value cross-checked against wasmtime:
select (result exnref)— the un-normalisedVEC_VALUE_TYPEoperand pathref.testagainstexnandnoexnbr_tablecarrying an exnref through two label depthsapplyWithRefsapply()rejection on an exnref signaturePlus
ApprovalTest.verifyExceptionRefs, pinning the AOT exception-ref bytecode, which had no coverage at all before:exceptions.watcontains nothrow_ref,catch_reforcatch_all_ref.Spec suites are unchanged at 62240 (runtime-tests) and 34110 (compiler-tests), 0 failures.