alexcrichton opened PR #10069 from alexcrichton:fix-riscv64-sext
to bytecodealliance:main
:
This commit fixes a crash found in the CI of #10040. That PR itself isn't the fault per-se but rather uncovered a preexisting issue on riscv64. According to riscv64's ABI docs it looks like arguments are all expected to be sign-extended, whereas currently in Wasmtime all host signatures are zero-extended on all platforms. This commit applies two changes to fix this:
A new
TargetIsa::default_argument_extension
method was added which is now used instead of unconditionally usinguext
to apply to all arguments/results.While I was here I went ahead and split apart things where the wasm signature of a builtin doesn't use
uext
orsext
. The host signature still does, however, which means that any extension necessary happens in the trampoline we generate per-libcall as opposed to at all callsites.I'm not certain that all platforms require
uext
but I've left theTargetIsa
implementation asuext
for now with a comment explaining why. Currently the only non-uext
platforms are riscv64, which issext
to fix the issue from #10040, and Pulley which is "none" as things work differently there.<!--
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 abrown for a review on PR #10069.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #10069.
alexcrichton requested pchickey for a review on PR #10069.
alexcrichton requested wasmtime-core-reviewers for a review on PR #10069.
alexcrichton updated PR #10069.
abrown submitted PR review:
Thanks for the comments!
alexcrichton merged PR #10069.
Last updated: Jan 24 2025 at 00:11 UTC