Stream: git-wasmtime

Topic: wasmtime / PR #14140 [stack-switching] GC interaction


view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 15:39):

dhil opened PR #14140 from dhil:gc-stack-switching to bytecodealliance:main:

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.

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.

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.

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.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 15:39):

dhil requested fitzgen for a review on PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 15:39):

dhil requested wasmtime-compiler-reviewers for a review on PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 15:39):

dhil requested wasmtime-core-reviewers for a review on PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 15:41):

dhil updated PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 15:53):

dhil updated PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 17:01):

github-actions[bot] added the label cranelift on PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 17:01):

github-actions[bot] added the label cranelift:area:x64 on PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 17:01):

github-actions[bot] added the label wasmtime:ref-types on PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 17:01):

github-actions[bot] added the label wasmtime:api on PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 14 2026 at 17:02):

github-actions[bot] commented on PR #14140:

Subscribe to Label Action

cc @fitzgen

<details>
This 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 <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2026 at 15:52):

dhil updated PR #14140.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 27 2026 at 21:48):

:memo: fitzgen submitted PR review:

Sorry for the delay. A few thoughts below.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 27 2026 at 21:48):

:speech_balloon: fitzgen created PR review comment:

This will create a new stack slot each time we read a contref from a GC object, correct? But each stack slot is only live across one read? It seems like we should have a get_or_create_contref_stack_slot method in that case, or else repeatedly reading a contref could create a whole bunch of stack slots.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 27 2026 at 21:48):

:speech_balloon: fitzgen created PR review comment:

Can these offsets use constants defined in wasmtime-environ?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 27 2026 at 21:48):

:speech_balloon: fitzgen created PR review comment:

This is not the reason to use a side table, the real reason is to avoid trusting native addresses that come out of the GC heap.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 27 2026 at 21:48):

:speech_balloon: fitzgen created PR review comment:

Is the generic parameter pulling its weight here? I doubt that a couple tests are going to make much of a difference compared to allocating a whole new stack...

view this post on Zulip Wasmtime GitHub notifications bot (Aug 27 2026 at 21:48):

:speech_balloon: fitzgen created PR review comment:

This should probably be VmPtr<u8>, evem though existing stack-switching code doesn't use that yet (but it should, given the fullness of time).


Last updated: Aug 30 2026 at 09:07 UTC