uweigand opened PR #2385 from endian-memory
to main
:
This patch fixes issue
https://github.com/bytecodealliance/wasmtime/issues/2124
by adding support in the Cranelift WebAssembly translator for
correctly handling memory instructions on big-endian platforms.Since memory instructions always access little-endian data per
the WebAssembly spec, we must byte-swap on big-endian platforms.This is done by creating two new instructions in the CraneliftIR
LoadRev and StoreRev
which operate just like Load and Store, except by also byte-swapping
the values read or written.The translator code is changed to use those instruction on big-
endian platforms instead of normal loads and stores.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
uweigand updated PR #2385 from endian-memory
to main
:
This patch fixes issue
https://github.com/bytecodealliance/wasmtime/issues/2124
by adding support in the Cranelift WebAssembly translator for
correctly handling memory instructions on big-endian platforms.Since memory instructions always access little-endian data per
the WebAssembly spec, we must byte-swap on big-endian platforms.This is done by creating two new instructions in the CraneliftIR
LoadRev and StoreRev
which operate just like Load and Store, except by also byte-swapping
the values read or written.The translator code is changed to use those instruction on big-
endian platforms instead of normal loads and stores.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
uweigand closed without merge PR #2385.
Last updated: Dec 23 2024 at 12:05 UTC