Fix ppc64le stack overflow from deep Sequential chains in graph checking#20028
Open
T-Gro wants to merge 4 commits into
Open
Fix ppc64le stack overflow from deep Sequential chains in graph checking#20028T-Gro wants to merge 4 commits into
T-Gro wants to merge 4 commits into
Conversation
Long statement sequences parse into deeply right-nested SynExpr.Sequential chains. FileContentMapping.visitSynExpr walks them in CPS, and under BUILD_USING_MONO each visit runs inside a StackGuard that only checks room for one more frame. On ppc64le the larger stack frames deplete the stack between guard checks, causing the compiler to crash while building fsharp. Flatten the Sequential chain into a flat list and hand the per-element continuations to Continuation.concatenate, matching the existing handling for IfThenElse, Tuple and ArrayOrList. This halves the number of guarded frames for a chain and preserves the emitted entry order. Fixes dotnet#19988 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
auduchinok
reviewed
Jul 3, 2026
Move the sequential-flattening logic into SyntaxTreeOps as flattenSequentials (with (|Sequentials|_|) as sugar over it), so FileContentMapping reuses it instead of a local copy and ParsedInput's duplicate is removed. The exhaustive match in visitSynExpr keeps the concrete SynExpr.Sequential case. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Fixes #19988
Long statement sequences parse into deeply right-nested
SynExpr.Sequentialchains that
FileContentMapping.visitSynExprwalked with one nestedvisitper element. Under
BUILD_USING_MONOeachvisitruns inside aStackGuard,and ppc64le's large stack frames deplete the stack between guard checks.
Flattening the chain first — as already done for
IfThenElse— halves theguarded frames per chain and preserves the emitted entry order.