Skip to content

Define VMContext and VMComponentContext in a macro - #14083

Open
fitzgen wants to merge 1 commit into
bytecodealliance:mainfrom
fitzgen:vmctx-types-into-macro
Open

Define VMContext and VMComponentContext in a macro#14083
fitzgen wants to merge 1 commit into
bytecodealliance:mainfrom
fitzgen:vmctx-types-into-macro

Conversation

@fitzgen

@fitzgen fitzgen commented Aug 5, 2026

Copy link
Copy Markdown
Member

And automatically generate their offsets, alias region load/store helpers, etc... from the single macro definition. Similar to the existing macro for other VM* types, but these definitions are parameterized over a specific Wasm module or component and the entities defined therein.

And automatically generate their offsets, alias region load/store helpers,
etc... from the single macro definition. Similar to the existing macro for other
`VM*` types, but these definitions are parameterized over a specific Wasm module
or component and the entities defined therein.
@fitzgen
fitzgen requested review from a team as code owners August 5, 2026 20:28
@fitzgen
fitzgen requested review from alexcrichton and removed request for a team August 5, 2026 20:28
@github-actions github-actions Bot added wasmtime:api Related to the API of the `wasmtime` crate itself winch Winch issues or pull requests labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Subscribe to Label Action

cc @saulecabrera

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

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

  • saulecabrera: winch

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

Learn more.

/// Return a pointer to the collector-specific heap data.
pub fn gc_heap_data(self: Pin<&mut Self>) -> &mut Option<VmPtr<u8>> {
let offset = self.offsets().ptr.vmctx_gc_heap_data();
let offset = self.offsets().ptr.vmctx().gc_heap_data();

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.

Since accesses like this (throughout the runtime) can be perf-sensitive, have you double-checked that methods are inlined and/or #[inline]'d as needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I marked everything #[inline] but I haven't actually dug through disassemblies -- do you think that is necessary?

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.

No mostly just want to double-check you were considering this in the implementation. We can always slap #[inline] on things retroactively and we don't have the infrastructure right now to say we should proactively be using #[inline], so "mostly considered during writing" I think is about the best we can do

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

FWIW, I'd expect everything here to be just as, if not more, amenable to to LLVM's optimizer.

@fitzgen
fitzgen added this pull request to the merge queue Aug 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 13, 2026
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 winch Winch issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants