saulecabrera opened PR #7499 from saulecabrera:winch-semantically-respect-stack-excess
to bytecodealliance:main
:
This commit improves unconditional jumps by balancing the stack pointer as well as the value stack when the current stack pointer and value stack are greater than the target stack pointer and value stack. The invariant that this changes maintains is that the the value stack should always reflect the the state of the machine stack. The value stack might have excess stack values in a presence of a fallthrough (
br_if
orbr_table
) in which the target branch is not known at compile time; in this situation instructions likereturn
orbr
discard any excess values.The fuzzer discovered the following test case, which triggered several assertions related to unconditional jump handling:
(module (func (;0;) (result i32) (local i32) local.get 0 loop ;; label = @1 local.get 0 block ;; label = @2 end br 0 (;@1;) end ) (export "" (func 0)) )
<!--
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 elliottt for a review on PR #7499.
saulecabrera requested wasmtime-compiler-reviewers for a review on PR #7499.
elliottt submitted PR review:
Looks good to me!
saulecabrera merged PR #7499.
Last updated: Nov 22 2024 at 16:03 UTC