alexcrichton opened PR #12427 from alexcrichton:fixup-and-check-may-leave to bytecodealliance:main:
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<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton commented on PR #12427:
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[bot] added the label wasmtime:api on PR #12427.
alexcrichton commented on PR #12427:
alexcrichton commented on PR #12427:
In discussion with @dicej on this we see 1 of two paths forward:
- Delete
Func::post_returnas 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.- Fix the internals, probably by making them a bit more complicated, and keep
Func::post_returnas-is.We're currently thinking of pursuing (1) here pending if anyonoe has use cases on Zulip.
alexcrichton updated PR #12427.
alexcrichton updated PR #12427.
alexcrichton updated PR #12427.
alexcrichton requested dicej for a review on PR #12427.
alexcrichton has marked PR #12427 as ready for review.
alexcrichton requested cfallin for a review on PR #12427.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #12427.
alexcrichton requested wasmtime-core-reviewers for a review on PR #12427.
fitzgen submitted PR review:
Nice!
alexcrichton added PR #12427 Check may-leave flags in trampolines, not Rust to the merge queue.
alexcrichton merged PR #12427.
alexcrichton removed PR #12427 Check may-leave flags in trampolines, not Rust from the merge queue.
Last updated: Feb 24 2026 at 07:22 UTC