You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the scalar-only Wasm value assumption with a typed reference-slot substrate that remains precise under ordinary, mid-script, and no-GIL collection.
Acceptance:
Represent null funcref, function references, and arbitrary externref values without pointer/tag ambiguity.
Publish live operand-stack, local, global, argument, and result reference edges to the existing precise collector.
Make slot copy/drop/frame unwind/trap paths update liveness failure-atomically.
Preserve reference identity across Wasm-to-Wasm and Wasm-to-JavaScript calls without permanently rooting dead values.
Add forced-GC and no-GIL stress tests proving live retention and exact reclamation after overwrite/drop/unwind.
Initial audit: exec.State.stack, locals, and GlobalInst.value are scalar u64; TableOwner.refs is already an atomic GC-visible mirror traced through the wrapper, and active Interpreters are already explicit realm roots. The implementation should extend the active-execution publication model for typed Wasm reference slots, rather than permanently appending externrefs to InstanceDescriptor.roots. That preserves exact reclamation and remains compatible with parallel root handshakes.
Add a typed Wasm slot (numeric, funcref, externref) so Value.bits, native function pointers, numeric bits, and null are never inferred from payload patterns.
Register each live Wasm execution root set on the active Interpreter, under its existing gc_root_lock; extend gc.traceInterpreterRoots so ordinary/quiescent and parked-peer traces see externref slots exactly like VM stacks/frames.
Extend the parallel self-publication path to snapshot Wasm slots, and add bounded checkpoints at backward branches/calls so long Wasm loops cannot starve/conceal roots from a peer collector. A running peer is never read concurrently.
Keep persistent table/global roots in atomic GC-visible mirrors owned by their wrappers/instance, while execution stack/local/argument/result roots exist only for the invocation and are cleared on pop, overwrite, return, trap, and host-exception unwind.
During Wasm-to-JS callbacks the Wasm state is frozen but remains registered, so the callback may allocate/collect without losing references held only by Wasm.
This can use the current zig-gc binding/visitor contract; no dependency API change is warranted unless implementation proves the existing root-publication hook insufficient.
Completed and pushed to main in six focused commits:
506963ef registers invocation-scoped Wasm execution roots and bounded safepoints.
9923f636 replaces scalar transient storage with explicit numeric / funcref / externref slots; numeric and pointer-identical funcref payloads are not traced.
52bdc566 adds typed import/invocation argument and result slots, preserves externref/funcref identity, and rejects numeric aliases for reference signatures.
9e651a54 adds tagged persistent globals, exact overwrite clearing, and the insertion barrier.
639582f5 proves stack/local liveness transitions and forced-GC retention followed by WeakRef reclamation.
e2f01223 proves a real finished no-GIL parallel mid-script collection retains an externref held only by a frozen Wasm frame, then reclaims it exactly after unregistration.
Activity
chrisbbreuer commentedon Jul 18, 2026
Initial audit:
exec.State.stack, locals, andGlobalInst.valueare scalaru64;TableOwner.refsis already an atomic GC-visible mirror traced through the wrapper, and active Interpreters are already explicit realm roots. The implementation should extend the active-execution publication model for typed Wasm reference slots, rather than permanently appending externrefs toInstanceDescriptor.roots. That preserves exact reclamation and remains compatible with parallel root handshakes.chrisbbreuer commentedon Jul 18, 2026
Implementation design after collector audit:
numeric,funcref,externref) soValue.bits, native function pointers, numeric bits, and null are never inferred from payload patterns.Interpreter, under its existinggc_root_lock; extendgc.traceInterpreterRootsso ordinary/quiescent and parked-peer traces see externref slots exactly like VM stacks/frames.This can use the current zig-gc binding/visitor contract; no dependency API change is warranted unless implementation proves the existing root-publication hook insufficient.
feat(wasm): register precise execution roots (#274)
refactor(wasm): tag transient value slots (#274)
feat(wasm): add typed reference invocation slots (#274)
feat(wasm): root tagged global references (#274)
test(wasm): prove exact externref root liveness (#274)
test(wasm): prove no-GIL externref root liveness (#274)
chrisbbreuer commentedon Jul 18, 2026
Completed and pushed to
mainin six focused commits:506963efregisters invocation-scoped Wasm execution roots and bounded safepoints.9923f636replaces scalar transient storage with explicitnumeric/funcref/externrefslots; numeric and pointer-identical funcref payloads are not traced.52bdc566adds typed import/invocation argument and result slots, preserves externref/funcref identity, and rejects numeric aliases for reference signatures.9e651a54adds tagged persistent globals, exact overwrite clearing, and the insertion barrier.639582f5proves stack/local liveness transitions and forced-GC retention followed by WeakRef reclamation.e2f01223proves a real finished no-GIL parallel mid-script collection retains an externref held only by a frozen Wasm frame, then reclaims it exactly after unregistration.Verification:
The existing zig-gc visitor/barrier contract was sufficient; no dependency API change was needed.
docs(wasm): publish precise-reference evidence (#274)