[stack-switching] GC interaction - #14140
Open
dhil wants to merge 1 commit into
Open
Conversation
dhil
force-pushed
the
gc-stack-switching
branch
from
August 14, 2026 15:41
b74e5c6 to
c32ebbc
Compare
This patch adds support for using Wasm GC when using the stack switching extension. The contents of this patch: * Trace GC roots across continuations Emit stack maps at stack-switch resume points and track GC-reference metadata for continuation payload buffers, allowing suspended stacks and bound arguments to be traced correctly. Allocate and update this metadata only for GC-capable payloads, leaving ordinary stack-switching paths largely unchanged. * Support `contref`s in GC types This patch enables storing `contref` values in GC structs and arrays. The core idea behind the implementation is the same as for `funcref`: a store-local interning table is used to map 16 bytes continuation identifiers to 4 bytes GC types. * Fixes issue 13750 Retain Wasm type information when loading continuation payloads and mark GC-reference results as requiring stack maps. This keeps references returned by `resume`, `suspend`, and `switch` alive across subsequent GC safepoints. Added the POC as a regression test. * Fixes issue 13021 Added the POC as a regression test. * Fixes issue 13022 Added the POC as a regression test.
dhil
force-pushed
the
gc-stack-switching
branch
from
August 14, 2026 15:53
c32ebbc to
40100cd
Compare
Subscribe to Label Actioncc @fitzgen DetailsThis issue or pull request has been labeled: "cranelift", "cranelift:area:x64", "wasmtime:api", "wasmtime:ref-types"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
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 patch adds support for using Wasm GC when using the stack switching extension. The noteworthy contents of this patch:
Emit stack maps at stack-switch resume points and track GC-reference metadata for continuation payload buffers, allowing suspended stacks and bound arguments to be traced correctly. Allocate and update this metadata only for GC-capable payloads, leaving ordinary stack-switching paths largely unchanged.
contrefs in GC typesThis patch enables storing
contrefvalues in GC structs and arrays. The core idea behind the implementation is the same as forfuncref: a store-local interning table is used to map 16 bytes continuation identifiers to 4 bytes GC types.Retain Wasm type information when loading continuation payloads and mark GC-reference results as requiring stack maps. This keeps references returned by
resume,suspend, andswitchalive across subsequent GC safepoints.Added the POC as a regression test.
Added the POC as a regression test.
Added the POC as a regression test.
The POC exits successfully with code 0 now. I've not added the POC as a regression test, because it is undistilled.
Resolves #12941. Resolves #13021. Resolves #13022. Resolves #13750.