Stream: git-wasmtime

Topic: wasmtime / PR #13713 Make clearing and restoring the `may...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2026 at 23:29):

fitzgen opened PR #13713 from fitzgen:adapter-may-leave-reset-use-locals to bytecodealliance:main:

…imization

The clear-and-restore is now structured so that if translation doesn't actually call any functions (e.g. due to inlining) then a future dead-store elimination pass in Cranelift can remove all the flag juggling entirely (other than trapping when !may_leave):

may_leave = load vmctx+MAY_LEAVE_OFFSET      ;; (0)
trapz may_leave

...

zero = iconst 0
store zero, vmctx+MAY_LEAVE_OFFSET           ;; (1)

...

store may_leave, vmctx+MAY_LEAVE_OFFSET      ;; (2)

First, the dead-store elimination pass will see that the the store at (1): is dead and remove it. Then, the idempotent-store eliminator will recognize that the store at (2) is storing the same value that the memory location already contains and it will also be removed. The more we can reuse locals to make this idempotency obvious, rather than force Cranelift's optimizer to rediscover this information, the better.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2026 at 23:29):

fitzgen requested cfallin for a review on PR #13713.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2026 at 23:29):

fitzgen requested wasmtime-compiler-reviewers for a review on PR #13713.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2026 at 23:29):

fitzgen requested wasmtime-core-reviewers for a review on PR #13713.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2026 at 01:24):

github-actions[bot] added the label wasmtime:api on PR #13713.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2026 at 15:42):

:thumbs_up: cfallin submitted PR review:

Great idea -- the separate may-leave flag global is of course a cost but it seems like that should be tiny compared to the advantages we get being able to reason about it separately. LGTM!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2026 at 15:42):

cfallin added PR #13713 Make clearing and restoring the may_leave flag more amenable to opt… to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2026 at 16:08):

:check: cfallin merged PR #13713.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2026 at 16:08):

cfallin removed PR #13713 Make clearing and restoring the may_leave flag more amenable to opt… from the merge queue.


Last updated: Jul 29 2026 at 05:03 UTC