Skip to content

Conversation

@alexcrichton
Copy link
Member

This commit moves all may-leave flag handling into compiled trampolines rather than doing this in Rust. This means it can't be forgotten on the Rust side of things and will be slightly more efficient to boot. This then additionally exempts some intrinsics from checking may-leave since Wasmtime erroneously checked when it shouldn't have.

Closes #12397
Closes #12403

@alexcrichton
Copy link
Member Author

This is a draft for now because the new tests I added are failing (some intrinsics aren't supporting being called in post-return for example) and I need to bottom that out.

@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Jan 25, 2026
@alexcrichton
Copy link
Member Author

In discussion with @dicej on this we see 1 of two paths forward:

  1. Delete Func::post_return as a Wasmtime API. This would mean that post-return is always called automatically, and that'll untangle some internals to avoid the panics happening here.
  2. Fix the internals, probably by making them a bit more complicated, and keep Func::post_return as-is.

We're currently thinking of pursuing (1) here pending if anyonoe has use cases on Zulip.

@alexcrichton alexcrichton force-pushed the fixup-and-check-may-leave branch 2 times, most recently from c02f116 to 4611675 Compare February 3, 2026 19:30
This commit moves all may-leave flag handling into compiled trampolines
rather than doing this in Rust. This means it can't be forgotten on the
Rust side of things and will be slightly more efficient to boot. This
then additionally exempts some intrinsics from checking may-leave since
Wasmtime erroneously checked when it shouldn't have.

Closes bytecodealliance#12397
Closes bytecodealliance#12403
@alexcrichton alexcrichton force-pushed the fixup-and-check-may-leave branch from 4611675 to 6e06517 Compare February 3, 2026 19:40
@alexcrichton alexcrichton requested a review from dicej February 3, 2026 19:40
@alexcrichton alexcrichton marked this pull request as ready for review February 3, 2026 19:40
@alexcrichton alexcrichton requested review from a team as code owners February 3, 2026 19:40
@alexcrichton alexcrichton requested review from cfallin and removed request for a team February 3, 2026 19:40
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Nice!

@alexcrichton alexcrichton added this pull request to the merge queue Feb 3, 2026
Merged via the queue into bytecodealliance:main with commit 4d12990 Feb 3, 2026
45 checks passed
@alexcrichton alexcrichton deleted the fixup-and-check-may-leave branch February 3, 2026 20:26
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.

Tighten/correct/sync may_leave checks for component model intrinsics check may-leave flag automatically for CM intrinsic trampolines

2 participants