Repository navigation
[SpillPointers] Spill operand stack pointers across calls - #9432
akasakariko wants to merge 2 commits into
Conversation
| @@ -0,0 +1 @@ | |||
| spill-pointers_enable-tail-call | |||
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.
There was a problem hiding this comment.
Moved the new tests to test/lit/passes/spill-pointers-stack.wast and restored test/passes/spill-pointers.wast and test/passes/spill-pointers.txt
| (call $spill-args | ||
| (call $spill-call-call0 (i32.const 1)) | ||
| (call $spill-call-call0 (i32.const 2)) | ||
| ) |
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.
There was a problem hiding this comment.
Added brief comments to each test function in test/lit/passes/spill-pointers-stack.wast explaining why each operand needs or avoids spilling
| return; | ||
| } | ||
| needsLocals |= pointer && hasCalls.contains(child); | ||
| pointer |= child->type == pointerType && !child->is<Const>(); |
There was a problem hiding this comment.
Good catch, constants could still represent pointers (for example after wasm-ctor-eval or constant propagation) and the rest of SpillPointers spills them as well, so I removed the Const exclusion and added $spill-const-operand to test it
| } 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. |
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?
There was a problem hiding this comment.
Those changes were addressing a separate issue in getStackSpace around restoring the stack for tail calls and unreachable return values, which is independent of spilling operand stack pointers in SpillPointers, so I reverted src/abi/stack.h from this PR
--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 constants, indirect-call targets and non-call expressions
This is an original contribution
Fixes #9307