saulecabrera opened PR #10730 from saulecabrera:winch-br_table-stack-handling to bytecodealliance:main:
This commit fixes https://github.com/bytecodealliance/wasmtime/issues/10613
When emitting some WebAssembly instructions involving branches, like
br_ifstack pointer expectations must be met at jump sites, more importantly when these instructions deal with multiple branches or fall-through cases, the need to reclaim any extra stack space might arise, and when it does, special handling is needed to ensure that value location is respected. Prior to this change, the emission forbr_tablewas incorrectly handling multiple return values on the stack, causing the miscompilation reported in the issue above.This commit introduces a better mechanism to deal with branch emission, ensuring that all the invariants are applied to the main entry points for branches:
return,br,br_ifandbr_table.<!--
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
-->
saulecabrera requested wasmtime-compiler-reviewers for a review on PR #10730.
saulecabrera requested abrown for a review on PR #10730.
saulecabrera requested alexcrichton for a review on PR #10730.
saulecabrera requested wasmtime-core-reviewers for a review on PR #10730.
saulecabrera updated PR #10730.
saulecabrera updated PR #10730.
alexcrichton submitted PR review.
alexcrichton merged PR #10730.
Last updated: Dec 06 2025 at 06:05 UTC