Skip to content

Debug: rework for expressions stepping#19894

Merged
T-Gro merged 3 commits into
dotnet:mainfrom
auduchinok:debug-sequencePoint-for
Jun 8, 2026
Merged

Debug: rework for expressions stepping#19894
T-Gro merged 3 commits into
dotnet:mainfrom
auduchinok:debug-sequencePoint-for

Conversation

@auduchinok

Copy link
Copy Markdown
Member

Fixes various stepping issues in for expressions:

for x in l do
    expr
for ActivePattern x in l do
    expr
[| for x in l do yield e |]
[| for x in l -> e |]
[ for x in l do yield e ]
[ for x in l -> e ]

Covers list, array, seq cases and fixes:

  • wrong debugger steps order, the sequence points now mimic C# stepping
  • for sequence point now covers the pattern, so it's possible to step into the active pattern in the range
  • simple bodies without effects could be erased and proper stepping wasn't possible
  • array/list comprehensions had wrong range for for sequence point covering the whole comprehension

To make the changes observable this PR also introduces a new test helper dumping sequence points along with their range and instructions.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

@auduchinok auduchinok changed the title Debug sequence point for Sequence points: rework for expressions stepping Jun 4, 2026
@auduchinok auduchinok changed the title Sequence points: rework for expressions stepping Debug: rework for expressions stepping Jun 4, 2026
@auduchinok

Copy link
Copy Markdown
Member Author

@majocha May I ask you to check if there're any regressions in stepping in this PR, please? You've caught a very good one in the inlining PR. I expect many cases to be improved, but I could've missed something.

@github-actions github-actions Bot added the ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen label Jun 4, 2026
@github-actions

This comment has been minimized.

@majocha

majocha commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@majocha May I ask you to check if there're any regressions in stepping in this PR, please? You've caught a very good one in the inlining PR. I expect many cases to be improved, but I could've missed something.

Sure! It would also be great to put some new samples in TheBigFileOfDebugStepping.fsx

to do some before / after, especially the "for with active pattern" case.

@auduchinok

auduchinok commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

It would also be great to put some new samples in TheBigFileOfDebugStepping.fsx to do some before / after, especially the "for with active pattern" case.

I'm currently adding these cases as sequence point dumps, like this one.

@github-actions github-actions Bot added the ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure label Jun 4, 2026
@github-actions

This comment has been minimized.

auduchinok and others added 3 commits June 5, 2026 11:36
Step a for-each loop in source order: stop on the enumerable, then the element
binding (covering `for <pattern>`), then the body; "getting the next element"
is hidden.

Add a sequence-point baseline test helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Bootstrap, Affects-Compiler-Output
Affects-Bootstrap: modifies pars.fsy (parser generator input)
Affects-Compiler-Output: modifies IlxGen.fs (IL emission)

Generated by PR Tooling Safety Check · opus46 4.3M ·

@github-actions github-actions Bot added the ⚠️ Affects-Bootstrap Tooling check: PR touches compiler bootstrap chain label Jun 5, 2026
@auduchinok

Copy link
Copy Markdown
Member Author

@T-Gro Could the bot comments update the first comment, like it's done for the release notes, instead of posting more replies, please?

@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Jun 8, 2026
@T-Gro T-Gro merged commit d0e593f into dotnet:main Jun 8, 2026
50 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in F# Compiler and Tooling Jun 8, 2026
@auduchinok auduchinok deleted the debug-sequencePoint-for branch June 8, 2026 11:14
T-Gro added a commit that referenced this pull request Jun 8, 2026
Refute and dismiss B1 ("debug-stepping clobber"): PR #19894 (d0e593f)
landed on origin/main on 2026-06-08 13:11, three days AFTER my last merge
on 2026-06-05 11:35. None of my commits (7757717, e2ed10f, f933f83)
touch the relevant IlxGen.fs lines. Merged origin/main now brings the
fix in — verified `if equals m range0` is present at IlxGen.fs:3178 and
:3743 in the working tree.

Apply M3: Release notes now cite #19075 in the constraint-stripping entry
(test `SRTP member constraint with IDisposable` explicitly targets that
issue's CLR segfault).

Soften M2: Drop the unverified "≈23x" specific number from release notes;
the perf magnitude is documented in #17607 itself with the original repro.

Apply L2: `unmanaged + equality` test now asserts no
`Specialize<valuetype (...modreq...)` or `T<valuetype (...modreq...)`
leakage — exercises the IsUnmanagedAttribute / modreq stripping path that
motivated the CustomAttrsStored clear in stripILGenericParamConstraints.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
T-Gro added a commit that referenced this pull request Jun 9, 2026
ILVerify on this PR (build 1454404) hit the 60-min default timeout and was
cancelled mid-Release-build. Investigation against recent main builds:

  Build 1449768 (pre-#19894)  : ILVerify 21.1 min, succeeded
  Build 1451079 (pre-#19894)  : ILVerify 21.2 min, succeeded
  Build 1453983 (#19894 `d0e593f67`) : ILVerify 36.5 min, succeeded
  Build 1454404 (this PR HEAD): ILVerify 60.4 min, CANCELLED

Two compounding causes:

1. Upstream PR #19894 ("Debug: rework or expressions stepping") added
   ~14 min to ILVerify on main alone — verified across multiple post-#19894
   main builds. ILVerify is the only leg using -bootstrap, so it pays the
   compiler-build cost x3 (bootstrap, proto, final).

2. This PR makes TLR actually fire under --realsig+ for the first time
   (the whole point of #17607's fix). The compiler self-build now lifts
   thousands of inner-rec functions across FCS itself that were previously
   left as closures. That extra TLR work, multiplied by the x3 bootstrap
   cycle, pushes ILVerify past 60 min.

Neither is "flaky". The work is real and load-bearing. Bumping the per-job
timeout to 120 min restores headroom for the bootstrap+proto+final cycle
across both Debug and Release configurations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Bootstrap Tooling check: PR touches compiler bootstrap chain ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants