Skip to content

Inline {enter,exit}_sync_call trampolines into sync-to-sync fused adapters#13695

Open
fitzgen wants to merge 12 commits into
bytecodealliance:mainfrom
fitzgen:inline-enter-exit-sync-call-in-sync-to-sync-adapters
Open

Inline {enter,exit}_sync_call trampolines into sync-to-sync fused adapters#13695
fitzgen wants to merge 12 commits into
bytecodealliance:mainfrom
fitzgen:inline-enter-exit-sync-call-in-sync-to-sync-adapters

Conversation

@fitzgen

@fitzgen fitzgen commented Jun 19, 2026

Copy link
Copy Markdown
Member

See each commit for details.

@fitzgen fitzgen requested a review from alexcrichton June 19, 2026 00:08
@fitzgen fitzgen requested review from a team as code owners June 19, 2026 00:08
@github-actions github-actions Bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Jun 19, 2026
Comment thread crates/cranelift/src/alias_region.rs
Comment thread crates/cranelift/src/func_environ.rs
Comment thread crates/environ/src/fact/trampoline.rs
Comment thread crates/environ/src/key.rs
Comment thread crates/wasmtime/src/runtime/component/store.rs
Comment thread crates/wasmtime/src/runtime/component/store.rs
Comment thread crates/wasmtime/src/runtime/vm/vmcontext.rs Outdated
Comment thread crates/wasmtime/src/runtime/vm/vmcontext.rs
Comment thread crates/wasmtime/src/runtime/func.rs Outdated
Comment thread tests/all/component_model/sync_call_inline.rs Outdated

@alexcrichton alexcrichton 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.

Actually I'll go ahead and flag this for merge. One thing I'd recommend, if you can, is to get an LLM review locally as well to double-check this signs off with no known bugs. If nothing materially changes from my suggestions/comments though seems fine to land.

fitzgen added 10 commits June 22, 2026 11:19
This commit inlines fast paths for the `{enter,exit}_sync_call` component
trampolines in sync-to-sync fused adapters. For cross-component calls of trivial
functions, after inlining, we should avoid all calls in the fused adapter (other
than the `trap` libcall when `may_leave` is set).

The inlining happens during translation, rather than via the regular inliner,
since the lazy thread is stack-allocated within the fused adapter; there would
otherwise be no easy way to reference it.

Fixes bytecodealliance#12311
@fitzgen fitzgen force-pushed the inline-enter-exit-sync-call-in-sync-to-sync-adapters branch from 029c1e7 to 3b37e57 Compare June 22, 2026 18:29
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants