Repository navigation
Conversation
cpunion
force-pushed
the
codex/fix-loop-local-stack-20260908
branch
from
September 8, 2026 00:57
eb23b4d to
98ffad5
Compare
Owner
Author
|
Moved to xgo-dev#2530 as requested. Remaining fork workflow runs are being cancelled; validation continues upstream. The branch includes the debug-location prerequisite tracked in xgo-dev#2529. Keeping the source branch for the upstream contribution. |
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.
Summary
Reserve a non-escaping Go local's stack slot in the LLVM entry block, while leaving zero-initialization at its declaration. The SSA local-allocation contract requires one slot per function call, including declarations inside a loop. Previously, an LLVM
allocainside the loop reserved more stack on every iteration.This is independent of WebAssembly and is reproducible from the current main implementation. It was isolated while running the WASI poll acceptance tests in #235: every retry consumed another 96 bytes. At roughly 1,300 retries a 128 KiB Fiber stack crossed its lower boundary and corrupted adjacent state, before any GC had run. After this change about 7,000 observed suspend/resume operations used a constant stack pointer; no stack-size increase is included.
Coverage
CI is pending. This PR contains only the compiler fix and its regression test; WASI poll support remains in #235.