alexcrichton opened PR #9999 from alexcrichton:pulley-changing-stack
to bytecodealliance:main
:
This commit shrinks the size of the
PushFrameSave
andPopFrameRestore
functions which are used in almost all wasm functions. Previously these instructions allowed for 32-bits of stack space in addition to saving/restoring all 32 X-registers. In reality though it's quite uncommon to need more than 16-bits of stack space and ABI-wise the most commonly saved registers are the upper 16 registers of the X register set.This commit therefore shrinks the frame size to 16 bits and only has the ability to save/restore the upper 16 X-registers. Note that any clobbered registers and frame sizes are still supported, they'll just use more pessimal encodings which aren't a single opcode. If a function uses >64KiB of stack space though it's probably not too important what the dispatch cost is at the beginning.
The overall result of this change is that each instruction shaves of 4 bytes (2 from the frame size and 2 from the registers being saved/restored). This results in a 4% faster execution time on the bz2 Sightglass benchmark, ~1% on pulldown-cmark, and while it shrinks
spidermonkey.cwasm
slightly it's not significant.While here this commit also removes the Cranelift-unused instructions of
x{push,pop}{,_many}
since theRegSet
type was repurposed as anUpperRegSet
instead. It's possible to bring back these instructions but they're otherwise not used right now.<!--
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 requested fitzgen for a review on PR #9999.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9999.
alexcrichton requested wasmtime-default-reviewers for a review on PR #9999.
alexcrichton updated PR #9999.
alexcrichton updated PR #9999.
github-actions[bot] commented on PR #9999:
Subscribe to Label Action
cc @cfallin, @fitzgen
<details>
This issue or pull request has been labeled: "cranelift", "cranelift:meta", "isle", "pulley"Thus the following users have been cc'd because of the following labels:
- cfallin: isle
- fitzgen: isle, pulley
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
fitzgen submitted PR review:
Nice!
alexcrichton requested wasmtime-core-reviewers for a review on PR #9999.
alexcrichton requested pchickey for a review on PR #9999.
alexcrichton updated PR #9999.
alexcrichton has enabled auto merge for PR #9999.
alexcrichton merged PR #9999.
Last updated: Jan 24 2025 at 00:11 UTC