alexcrichton opened PR #9994 from alexcrichton:pulley-wasm-addressing-modes
to bytecodealliance:main
:
This commit adds a new "g32" addressing mode to Pulley that matches the pattern emitted by Cranelift for 32-bit wasm guests running on hosts. The general idea here is that this addressing mode encompasses an addition of a host-width value to a zero-extended (optionally) 32-bit value. On 32-bit hosts there's no zero-extension but on 64-bit hosts there's a zero-extension. The wasm address is always 32-bits though which enables using a single instruction for both 32 and 64-bit hosts.
New "g32" loads and stores are added to Pulley with varying sizes and options according to what seems to be common in wasm. The
disas
test suite was updated to showcase using these instructions for wasm loads/stores on 32 and 64-bit hosts.An additional change in this commit is to deduplicate the 32/64-bit bounds-check macro-ops. The trick in this commit works for those as well meaning that only a single instruction is needed instead of one-per-host-pointer-width. Additionally the load of the bound from the
VMContext
is folded into the bounds check itself as it was found that this was always present anyway before the bounds check.Overall this shrinks the size of
spidermonkey.cwasm
from 21M to 20M and the runtime ofpulldown-cmark
,bz2
, andspidermonkey
on Sightglass have all been reduced by 10%. Not as big wins as I was hoping for but alas.<!--
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 cfallin for a review on PR #9994.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9994.
alexcrichton requested fitzgen for a review on PR #9994.
alexcrichton requested wasmtime-core-reviewers for a review on PR #9994.
alexcrichton requested wasmtime-default-reviewers for a review on PR #9994.
alexcrichton updated PR #9994.
github-actions[bot] commented on PR #9994:
Subscribe to Label Action
cc @cfallin, @fitzgen
<details>
This issue or pull request has been labeled: "cranelift", "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 updated PR #9994.
alexcrichton has enabled auto merge for PR #9994.
alexcrichton merged PR #9994.
Last updated: Jan 24 2025 at 00:11 UTC