Stream: git-wasmtime

Topic: wasmtime / PR #9999 pulley: Shrink frame save/restore ins...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 13 2025 at 20:16):

alexcrichton opened PR #9999 from alexcrichton:pulley-changing-stack to bytecodealliance:main:

This commit shrinks the size of the PushFrameSave and PopFrameRestore 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 the RegSet type was repurposed as an UpperRegSet 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:

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 (Jan 13 2025 at 20:16):

alexcrichton requested fitzgen for a review on PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 13 2025 at 20:16):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 13 2025 at 20:16):

alexcrichton requested wasmtime-default-reviewers for a review on PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 13 2025 at 20:17):

alexcrichton updated PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 13 2025 at 20:55):

alexcrichton updated PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 13 2025 at 22:44):

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:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Jan 14 2025 at 00:41):

fitzgen submitted PR review:

Nice!

view this post on Zulip Wasmtime GitHub notifications bot (Jan 14 2025 at 01:18):

alexcrichton requested wasmtime-core-reviewers for a review on PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 14 2025 at 01:18):

alexcrichton requested pchickey for a review on PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 14 2025 at 01:18):

alexcrichton updated PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 14 2025 at 01:18):

alexcrichton has enabled auto merge for PR #9999.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 14 2025 at 01:48):

alexcrichton merged PR #9999.


Last updated: Jan 24 2025 at 00:11 UTC