Skip to content

Replace almost every manually-written AliasRegions helper method with macro-generated versions - #14267

Merged
cfallin merged 4 commits into
bytecodealliance:mainfrom
fitzgen:move-almost-everything-into-vm-macros
Sep 3, 2026
Merged

Replace almost every manually-written AliasRegions helper method with macro-generated versions#14267
cfallin merged 4 commits into
bytecodealliance:mainfrom
fitzgen:move-almost-everything-into-vm-macros

Conversation

@fitzgen

@fitzgen fitzgen commented Sep 2, 2026

Copy link
Copy Markdown
Member

See each commit for details.

All that is remaining after this is stack-switching related stuff.

`VMStoreContext::component_context` and `VMDeferredThread::saved_context` are
both `[u32; NUM_COMPONENT_CONTEXT_SLOTS]`, accessed one element at a time by a
compile-time constant index.

This allows us to remove a bunch of hand-written helpers for these types.
This commit adds support for generating accessors of data that we have a pointer
to in the vmctx, rather than storing inline in the vmctx, by describing the
pointed-at data in a `#[pointee(..)]` attribute.

This allows us to remove a number of hand-written helpers for things like the
type ids array and builtin functions array which are pointed at from the `vmctx`
rather than inline in it.
This moves `VMDrcHeapData`, `VMCopyingHeapData`, and the null collector's bump
pointer into the `for_each_vm_type!` macro so that we get macro-generated
offsets, alias region helpers, and struct definitions for them.

This removes a bunch of manually-written offsets and alias region helpers.
@fitzgen
fitzgen requested review from a team as code owners September 2, 2026 17:36
@fitzgen
fitzgen requested review from cfallin and removed request for a team September 2, 2026 17:36
@github-actions github-actions Bot added wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:ref-types Issues related to reference types and GC in Wasmtime winch Winch issues or pull requests labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Subscribe to Label Action

cc @fitzgen, @saulecabrera

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

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

  • fitzgen: wasmtime:ref-types
  • saulecabrera: winch

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

Learn more.

@cfallin cfallin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good cleanup, thanks!

@cfallin
cfallin added this pull request to the merge queue Sep 3, 2026
Merged via the queue into bytecodealliance:main with commit 7a882e9 Sep 3, 2026
54 checks passed
@fitzgen
fitzgen deleted the move-almost-everything-into-vm-macros branch September 3, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:ref-types Issues related to reference types and GC in Wasmtime winch Winch issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants