Skip to content

Commit d31c517

Browse files
authored
Debug: fix if and match condition sequence points (#19932)
1 parent eb5f50d commit d31c517

193 files changed

Lines changed: 15614 additions & 15947 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
* Add `#version;;` directive to F# Interactive to display version and environment information. ([Issue #13307](https://github.com/dotnet/fsharp/issues/13307), [PR #19332](https://github.com/dotnet/fsharp/pull/19332))
9595
* Debug: rework for expressions stepping ([PR #19894](https://github.com/dotnet/fsharp/pull/19894))
9696
* Debug: rework conditional erasure, fix stepping over literals ([PR #19897](https://github.com/dotnet/fsharp/pull/19897))
97+
* Debug: fix if and match condition sequence points ([PR #19932](https://github.com/dotnet/fsharp/pull/19932))
9798

9899
### Changed
99100

src/Compiler/CodeGen/IlxGen.fs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3723,19 +3723,6 @@ and GenLinearExpr cenv cgbuf eenv expr sequel preSteps (contf: FakeUnit -> FakeU
37233723

37243724
//assert(cgbuf.GetCurrentStack() = stackAfterJoin) // REVIEW: Since gen_dtree* now sets stack, stack should be stackAfterJoin at this point...
37253725
CG.SetStack cgbuf stackAfterJoin
3726-
// If any values are left on the stack after the join then we're certainly going to do something with them
3727-
// For example, we may be about to execute a 'stloc' for
3728-
//
3729-
// let y2 = if System.DateTime.Now.Year < 2000 then 1 else 2
3730-
//
3731-
// or a 'stelem' for
3732-
//
3733-
// arr.[0] <- if System.DateTime.Now.Year > 2000 then 1 else 2
3734-
//
3735-
// In both cases, any instructions that come after this point will be falsely associated with the last branch of the control
3736-
// prior to the join point. This is base, e.g. see FSharp 1.0 bug 5155
3737-
cgbuf.EmitStartOfHiddenCode()
3738-
37393726
GenSequel cenv eenv.cloc cgbuf sequelAfterJoin
37403727
Fake))
37413728

@@ -7952,8 +7939,6 @@ and GenDecisionTreeSwitch
79527939
let m = e.Range
79537940
cgbuf.SetMarkToHereIfNecessary inplabOpt
79547941

7955-
cgbuf.EmitStartOfHiddenCode()
7956-
79577942
match cases with
79587943
// optimize a test against a boolean value, i.e. the all-important if-then-else
79597944
| TCase(DecisionTreeTest.Const(Const.Bool b), successTree) :: _ ->

tests/AheadOfTime/Trimming/check.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len, $callerLineNumber) {
6363
$allErrors = @()
6464

6565
# Check net9.0 trimmed assemblies
66-
$allErrors += CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 311808 -callerLineNumber 66
66+
$allErrors += CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 310272 -callerLineNumber 66
6767

6868
# Check net9.0 trimmed assemblies with static linked FSharpCore
69-
$allErrors += CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 9169408 -callerLineNumber 69
69+
$allErrors += CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 9168896 -callerLineNumber 69
7070

7171
# Check net9.0 trimmed assemblies with F# metadata resources removed
7272
$allErrors += CheckTrim -root "FSharpMetadataResource_Trimming_Test" -tfm "net9.0" -outputfile "FSharpMetadataResource_Trimming_Test.dll" -expected_len 7609344 -callerLineNumber 72

tests/FSharp.Compiler.ComponentTests/Debugger/MatchEndSequencePoint.fs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -181,26 +181,3 @@ let dispatch (cmd: Cmd) (active: bool) (count: int) =
181181
(Line 29)
182182

183183
// ---- Instrumentation: verify FeeFee IS emitted at match join points ----
184-
185-
[<Fact>]
186-
let ``Match in statement position emits hidden point at join`` () =
187-
// #12052: The fix emits EmitStartOfHiddenCode unconditionally.
188-
// Verify hidden (FeeFee) points are present — proving the fix emits them.
189-
verifyAllSequencePoints
190-
"
191-
module TestModuleHidden
192-
193-
let funcE (x: int) =
194-
match x with
195-
| 1 -> System.Console.WriteLine(\"one\")
196-
| _ -> System.Console.WriteLine(\"other\")
197-
System.Console.WriteLine(\"done\")
198-
" [
199-
(Line 5, Col 5, Line 5, Col 17)
200-
(Line 6, Col 12, Line 6, Col 43)
201-
(Line 7, Col 12, Line 7, Col 45)
202-
(Line 8, Col 5, Line 8, Col 37)
203-
(Line 16707566, Col 0, Line 16707566, Col 0)
204-
(Line 16707566, Col 0, Line 16707566, Col 0)
205-
(Line 16707566, Col 0, Line 16707566, Col 0)
206-
]

0 commit comments

Comments
 (0)