Skip to content

GC: hold MaybeRooted<T> GC references in Val and Ref. - #15228

Open
cfallin wants to merge 1 commit into
bytecodealliance:mainfrom
cfallin:gc-maybe-rooted
Open

cfallin wants to merge 1 commit into
bytecodealliance:mainfrom
cfallin:gc-maybe-rooted

Conversation

@cfallin

@cfallin cfallin commented Nov 11, 2026

Copy link
Copy Markdown
Member

This introduces MaybeRooted<T>, an enum of the ways that a Val or Ref may hold a reference to a GC object, and makes the GC-reference variants of Val (ExternRef, AnyRef, ExnRef) and of Ref (Extern, Any, Exn) hold Option<MaybeRooted<T>> instead of Option<Rooted<T>>.

For now MaybeRooted<T> has only one variant, MaybeRooted::Rooted, which wraps a Rooted<T> as before, so this is a pure refactor with no change in behavior. The point is to give Val room for other kinds of GC references, as we will soon do with a followup that adds unrooted references.

@cfallin
cfallin requested a review from fitzgen November 11, 2026 06:56
@cfallin
cfallin requested review from a team as code owners November 11, 2026 06:56
This introduces `MaybeRooted<T>`, an enum of the ways that a `Val` or
`Ref` may hold a reference to a GC object, and makes the GC-reference
variants of `Val` (`ExternRef`, `AnyRef`, `ExnRef`) and of `Ref`
(`Extern`, `Any`, `Exn`) hold `Option<MaybeRooted<T>>` instead of
`Option<Rooted<T>>`.

For now `MaybeRooted<T>` has only one variant, `MaybeRooted::Rooted`,
which wraps a `Rooted<T>` as before, so this is a pure refactor with
no change in behavior. The point is to give `Val` room for other kinds
of GC references, as we will soon do with a followup that adds
unrooted references.
@github-actions github-actions Bot added fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:c-api Issues pertaining to the C API. wasmtime:ref-types Issues related to reference types and GC in Wasmtime labels Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Subscribe to Label Action

cc @fitzgen

Details This issue or pull request has been labeled: "fuzzing", "wasmtime:api", "wasmtime:c-api", "wasmtime:ref-types"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: fuzzing, wasmtime:ref-types

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:c-api Issues pertaining to the C API. wasmtime:ref-types Issues related to reference types and GC in Wasmtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant