cfallin opened PR #14650 from cfallin:fix-stackslot-align to bytecodealliance:main:
We previously accepted arbitrarily large requested alignments for explicit stackslot entities in CLIF. We even tried to give the user this alignment relative to the start of the frame. But in a given ABI, if the stack is only N-aligned on function entry, unless we pad it out to get greater alignment depending on the low bits of SP, an M-aligned (M > N) offset from that initial SP is still only N-aligned.
We could do the complicated thing and try to pad to a greater alignment, but it turns out that we don't need to, at least in Wasmtime. Most things (including ValRaw!) only need 8-alignment. x64, aarch64 and riscv64 can support 16-alignment because their native-ABI stacks are 16-aligned. s390x's stack is only 8-aligned, however, but per above, that's fine for core Wasmtime uses. Stack-switching still requests 16-alignment for a u128, so we'll either need to not do that, or do something fancier, on s390x if/when we support stack switching there. For now, this aligns the Cranelift checks with what we can support in reality, and cleanly rejects invalid requests.
<!--
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 review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
cfallin requested alexcrichton for a review on PR #14650.
cfallin requested wasmtime-compiler-reviewers for a review on PR #14650.
cfallin requested wasmtime-core-reviewers for a review on PR #14650.
:thumbs_up: alexcrichton submitted PR review.
alexcrichton has enabled auto merge for PR #14650.
alexcrichton added PR #14650 Cranelift: reject too-large stackslot alignment. to the merge queue
github-actions[bot] added the label cranelift:area:machinst on PR #14650.
github-actions[bot] added the label cranelift on PR #14650.
:check: alexcrichton merged PR #14650.
alexcrichton removed PR #14650 Cranelift: reject too-large stackslot alignment. from the merge queue
Last updated: Oct 11 2026 at 04:10 UTC