fitzgen opened PR #15217 from fitzgen:no-may-leave-flag-clear-and-restore to bytecodealliance:main:
When we don't call the CABI realloc function, we don't re-enter the component, so nothing will ever check the may-leave flag, and therefore we can avoid clearing and restoring it. This avoids two stores on the sync adapter hot path.
execution :: instructions-retired :: cm-online-stats no-may-leave is 1.08104x to 1.08105x faster than main! (confidence = 99%, p < 0.0001) ┌───────────┬───────────┬──────────────┬──────────────┬────────┬──────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼──────────────┤ │ 268911085 │ 269011566 │ 268915852.60 │ 268912332.00 │ 0.002% │ main │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼──────────────┤ │ 248751014 │ 248799066 │ 248755334.49 │ 248752858.00 │ 0.002% │ no-may-leave │ └───────────┴───────────┴──────────────┴──────────────┴────────┴──────────────┘ compilation :: instructions-retired :: cm-online-stats no-may-leave is 1.02x to 1.04x faster than main! (confidence = 99%, p < 0.0001) ┌──────────┬──────────┬─────────────┬─────────────┬────────┬──────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├──────────┼──────────┼─────────────┼─────────────┼────────┼──────────────┤ │ 78784658 │ 91356684 │ 85923816.05 │ 85989516.50 │ 4.052% │ main │ ├──────────┼──────────┼─────────────┼─────────────┼────────┼──────────────┤ │ 77217077 │ 88273017 │ 83327406.36 │ 83447416.50 │ 3.453% │ no-may-leave │ └──────────┴──────────┴─────────────┴─────────────┴────────┴──────────────┘ execution :: cycles :: cm-online-stats no-may-leave is 1.0208x to 1.0214x faster than main! (confidence = 99%, p < 0.0001) ┌──────────┬──────────┬─────────────┬─────────────┬────────┬──────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├──────────┼──────────┼─────────────┼─────────────┼────────┼──────────────┤ │ 58105236 │ 59082055 │ 58490214.06 │ 58495591.50 │ 0.069% │ main │ ├──────────┼──────────┼─────────────┼─────────────┼────────┼──────────────┤ │ 57111397 │ 57656304 │ 57288072.59 │ 57279622.00 │ 0.087% │ no-may-leave │ └──────────┴──────────┴─────────────┴─────────────┴────────┴──────────────┘ compilation :: cycles :: cm-online-stats No difference in performance. ┌──────────┬───────────┬─────────────┬─────────────┬─────────┬──────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├──────────┼───────────┼─────────────┼─────────────┼─────────┼──────────────┤ │ 36005967 │ 111132623 │ 76590245.92 │ 78995590.50 │ 22.783% │ main │ ├──────────┼───────────┼─────────────┼─────────────┼─────────┼──────────────┤ │ 47486874 │ 119571545 │ 80945587.13 │ 84024912.50 │ 32.787% │ no-may-leave │ └──────────┴───────────┴─────────────┴─────────────┴─────────┴──────────────┘<!--
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 review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen removed the review request for wasmtime-core-reviewers from PR #15217.
fitzgen requested alexcrichton for a review on PR #15217.
fitzgen requested wasmtime-core-reviewers for a review on PR #15217.
:thumbs_up: alexcrichton submitted PR review.
alexcrichton added PR #15217 Skip clearing and restoring the may-leave flag when we don't call realloc to the merge queue.
:check: alexcrichton merged PR #15217.
alexcrichton removed PR #15217 Skip clearing and restoring the may-leave flag when we don't call realloc from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC