Repository navigation
[SpillPointers] Spill operand stack pointers across calls - #9432
Open
akasakariko wants to merge 1 commit into
Open
akasakariko wants to merge 1 commit into
akasakariko wants to merge 1 commit into
Conversation
kripken
reviewed
Nov 25, 2026
| @@ -0,0 +1 @@ | |||
| spill-pointers_enable-tail-call | |||
Member
There was a problem hiding this comment.
Please add new tests as lit tests, maybe test/lit/passes/spill-pointers-stack.wast. We are moving tests to lit over time.
kripken
reviewed
Nov 25, 2026
| (call $spill-args | ||
| (call $spill-call-call0 (i32.const 1)) | ||
| (call $spill-call-call0 (i32.const 2)) | ||
| ) |
Member
There was a problem hiding this comment.
It will be easier to read this once it is a lit test, but please also add brief comments in each test, like here, maybe
;; The i32 constants might be pointers, so we must spill them.
kripken
reviewed
Nov 25, 2026
| return; | ||
| } | ||
| needsLocals |= pointer && hasCalls.contains(child); | ||
| pointer |= child->type == pointerType && !child->is<Const>(); |
kripken
reviewed
Nov 25, 2026
| } else if (func->body->type == Type::unreachable) { | ||
| block->list.push_back(func->body); | ||
| // no need to restore the old stack value, we're gone anyhow | ||
| // There is no fallthrough. Returns and tail calls restore the stack above. |
Member
There was a problem hiding this comment.
Are the changes to this file related to the main change to SpillPointers? They look like they could be separated out, or maybe I don't quite understand them?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--spill-pointerscan miss a pointer held as an earlier operand while a later operand calls, allowing conservative GC to reclaim a live objectCapture these values in fresh locals before liveness analysis, preserving evaluation order and values from locals that later operands overwrite, including indirect-call targets and non-call expressions
Restore the shadow stack after tail-call operands finish so the spill frame remains visible during nested calls and is released before transferring control
The original WAT reproducer now spills all three functions without
--flatten, and the focused regression, full wasm-opt suite, lit suite, GTest, clang-format 21, clang-tidy 21 and Ruff pass locallyThis is an original contribution
Fixes #9307