fitzgen opened PR #15224 from fitzgen:no-try-call-for-host-intrinsics to bytecodealliance:main:
Rather than
try_calls, whose ABI requires spilling all registers.Doesn't really provide a difference on Sightglass when inlining is disabled, since we end up spilling for the various calls anyways in that case, but with inlining enabled it is a nice speed up:
execution :: instructions-retired :: cm-online-stats no-try-call (-Cinlining=y) is 1.14402x to 1.14403x faster than main (-Cinlining=y)! (confidence = 99%, p < 0.0001) ┌───────────┬───────────┬──────────────┬──────────────┬────────┬────────────────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼────────────────────────────┤ │ 142345361 │ 142472755 │ 142350944.05 │ 142346567.00 │ 0.003% │ main (-Cinlining=y) │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼────────────────────────────┤ │ 124425291 │ 124554128 │ 124428803.16 │ 124426146.50 │ 0.003% │ no-try-call (-Cinlining=y) │ └───────────┴───────────┴──────────────┴──────────────┴────────┴────────────────────────────┘ execution :: cycles :: cm-online-stats no-try-call (-Cinlining=y) is 1.0719x to 1.0725x faster than main (-Cinlining=y)! (confidence = 99%, p < 0.0001) ┌──────────┬──────────┬─────────────┬─────────────┬────────┬────────────────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├──────────┼──────────┼─────────────┼─────────────┼────────┼────────────────────────────┤ │ 31618444 │ 31981572 │ 31655380.83 │ 31642236.00 │ 0.050% │ main (-Cinlining=y) │ ├──────────┼──────────┼─────────────┼─────────────┼────────┼────────────────────────────┤ │ 29480679 │ 29633881 │ 29519890.07 │ 29519389.50 │ 0.106% │ no-try-call (-Cinlining=y) │ └──────────┴──────────┴─────────────┴─────────────┴────────┴────────────────────────────┘ compilation :: instructions-retired :: cm-online-stats no-try-call (-Cinlining=y) is 1.02x to 1.04x faster than main (-Cinlining=y)! (confidence = 99%, p < 0.0001) ┌───────────┬───────────┬──────────────┬──────────────┬────────┬────────────────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼────────────────────────────┤ │ 117342111 │ 174664744 │ 125618885.41 │ 124518169.50 │ 3.025% │ main (-Cinlining=y) │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼────────────────────────────┤ │ 113799946 │ 189075511 │ 122334071.84 │ 121347064.00 │ 4.081% │ no-try-call (-Cinlining=y) │ └───────────┴───────────┴──────────────┴──────────────┴────────┴────────────────────────────┘ compilation :: cycles :: cm-online-stats No difference in performance. ┌──────────┬───────────┬─────────────┬─────────────┬─────────┬────────────────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├──────────┼───────────┼─────────────┼─────────────┼─────────┼────────────────────────────┤ │ 48081718 │ 188748321 │ 82079892.83 │ 80306637.00 │ 21.279% │ main (-Cinlining=y) │ ├──────────┼───────────┼─────────────┼─────────────┼─────────┼────────────────────────────┤ │ 47625101 │ 221161234 │ 78693199.53 │ 77174044.00 │ 21.531% │ no-try-call (-Cinlining=y) │ └──────────┴───────────┴─────────────┴─────────────┴─────────┴────────────────────────────┘<!--
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-compiler-reviewers from PR #15224.
fitzgen requested alexcrichton for a review on PR #15224.
fitzgen requested wasmtime-core-reviewers for a review on PR #15224.
fitzgen requested wasmtime-compiler-reviewers for a review on PR #15224.
:thumbs_up: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Perhaps a builder-style setter for
may_throwrather than an alternative constructor?
:speech_balloon: alexcrichton created PR review comment:
FWIW I believe we could put quite a few functions into this set. For example all lowered component functions have this property because you can't ever throw an exception across component boundaries anyway. This could probably also be true for pretty much all our own libcalls, too. Perhaps a good follow-up issue?
:speech_balloon: alexcrichton created PR review comment:
This feels a bit confusing to me where whatever
self.may_throwwas prior it's unconditionally overwritten here. Could this perhaps be conditional, as well was be accompanied by a comment for why this is needed and what it's doing?
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Question on this: this looks like it's doing half of a
call $imported_functionmanually and then lettingCall.indirect_call_inst(..)do the rest - would it be possible to make this look like a full-on call since there's acallee_indexanyway?
fitzgen updated PR #15224.
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Factored out a shared helper and deduped the other places that were doing this too
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
done
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
done
:memo: fitzgen submitted PR review.
:speech_balloon: fitzgen created PR review comment:
Follow up here: https://github.com/bytecodealliance/wasmtime/issues/15234
fitzgen has enabled auto merge for PR #15224.
fitzgen added PR #15224 Emit plain calls for host intrinsics in FACT to the merge queue.
:check: fitzgen merged PR #15224.
fitzgen removed PR #15224 Emit plain calls for host intrinsics in FACT from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC