Skip to content

Commit 82f2523

Browse files
auduchinokclaude
andcommitted
Fix hasVisibleDebugPoint, update baselines
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c52d97b commit 82f2523

8 files changed

Lines changed: 275 additions & 22 deletions

src/Compiler/CodeGen/IlxGen.fs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10645,10 +10645,11 @@ and CodeGenInitMethod cenv (cgbuf: CodeGenBuffer) eenv tref (codeGenInitFunc: Co
1064510645

1064610646
// Keep the init method if it carries a visible debug point, so steppable bindings like 'let i = ()' survive.
1064710647
let hasVisibleDebugPoint =
10648-
body.Code.Instrs
10649-
|> Array.exists (function
10650-
| I_seqpoint sp -> sp.Line <> FeeFee cenv
10651-
| _ -> false)
10648+
not cenv.options.localOptimizationsEnabled
10649+
&& body.Code.Instrs
10650+
|> Array.exists (function
10651+
| I_seqpoint sp -> sp.Line <> FeeFee cenv
10652+
| _ -> false)
1065210653

1065310654
if codeDoesSomething || hasVisibleDebugPoint then
1065410655
// We are here because the module we just grabbed has an interesting static initializer

tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,24 @@
517517
IL_0005: ret
518518
}
519519

520+
.method private specialname rtspecialname static void .cctor() cil managed
521+
{
522+
523+
.maxstack 8
524+
IL_0000: ldc.i4.0
525+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
526+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
527+
IL_000b: pop
528+
IL_000c: ret
529+
}
530+
531+
.method assembly static void staticInitialization@() cil managed
532+
{
533+
534+
.maxstack 8
535+
IL_0000: ret
536+
}
537+
520538
.property class assembly/C e2()
521539
{
522540
.get class assembly/C assembly::get_e2()
@@ -526,8 +544,19 @@
526544
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly
527545
extends [runtime]System.Object
528546
{
529-
}
547+
.field static assembly int32 init@
548+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
549+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
550+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
551+
.method private specialname rtspecialname static void .cctor() cil managed
552+
{
553+
554+
.maxstack 8
555+
IL_0000: call void assembly::staticInitialization@()
556+
IL_0005: ret
557+
}
530558

559+
}
531560

532561

533562

tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,24 @@
9191
IL_0001: ret
9292
}
9393

94+
.method private specialname rtspecialname static void .cctor() cil managed
95+
{
96+
97+
.maxstack 8
98+
IL_0000: ldc.i4.0
99+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
100+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
101+
IL_000b: pop
102+
IL_000c: ret
103+
}
104+
105+
.method assembly static void staticInitialization@() cil managed
106+
{
107+
108+
.maxstack 8
109+
IL_0000: ret
110+
}
111+
94112
.property int32 x()
95113
{
96114
.get int32 assembly::get_x()
@@ -100,8 +118,19 @@
100118
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly
101119
extends [runtime]System.Object
102120
{
103-
}
121+
.field static assembly int32 init@
122+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
123+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
124+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
125+
.method private specialname rtspecialname static void .cctor() cil managed
126+
{
127+
128+
.maxstack 8
129+
IL_0000: call void assembly::staticInitialization@()
130+
IL_0005: ret
131+
}
104132

133+
}
105134

106135

107136

tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,43 @@
4949
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.EntryPointAttribute::.ctor() = ( 01 00 00 00 )
5050

5151
.maxstack 8
52-
IL_0000: nop
53-
IL_0001: nop
54-
IL_0002: call int32 assembly::get_static_initializer()
55-
IL_0007: ldc.i4.s 10
56-
IL_0009: bne.un.s IL_000f
57-
58-
IL_000b: ldc.i4.0
52+
IL_0000: ldc.i4.0
53+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
54+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
55+
IL_000b: pop
5956
IL_000c: nop
60-
IL_000d: br.s IL_0011
57+
IL_000d: nop
58+
IL_000e: call int32 assembly::get_static_initializer()
59+
IL_0013: ldc.i4.s 10
60+
IL_0015: bne.un.s IL_001b
61+
62+
IL_0017: ldc.i4.0
63+
IL_0018: nop
64+
IL_0019: br.s IL_001d
65+
66+
IL_001b: ldc.i4.1
67+
IL_001c: nop
68+
IL_001d: tail.
69+
IL_001f: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit<int32>(int32)
70+
IL_0024: ret
71+
}
6172

62-
IL_000f: ldc.i4.1
63-
IL_0010: nop
64-
IL_0011: tail.
65-
IL_0013: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit<int32>(int32)
66-
IL_0018: ret
73+
.method private specialname rtspecialname static void .cctor() cil managed
74+
{
75+
76+
.maxstack 8
77+
IL_0000: ldc.i4.0
78+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
79+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
80+
IL_000b: pop
81+
IL_000c: ret
82+
}
83+
84+
.method assembly static void staticInitialization@() cil managed
85+
{
86+
87+
.maxstack 8
88+
IL_0000: ret
6789
}
6890

6991
.property int32 static_initializer()
@@ -75,6 +97,18 @@
7597
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly
7698
extends [runtime]System.Object
7799
{
100+
.field static assembly int32 init@
101+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
102+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
103+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
104+
.method private specialname rtspecialname static void .cctor() cil managed
105+
{
106+
107+
.maxstack 8
108+
IL_0000: call void assembly::staticInitialization@()
109+
IL_0005: ret
110+
}
111+
78112
}
79113

80114

tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,24 @@
14551455
IL_0005: ret
14561456
}
14571457

1458+
.method private specialname rtspecialname static void .cctor() cil managed
1459+
{
1460+
1461+
.maxstack 8
1462+
IL_0000: ldc.i4.0
1463+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$ABC::init@
1464+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$ABC::init@
1465+
IL_000b: pop
1466+
IL_000c: ret
1467+
}
1468+
1469+
.method assembly static void staticInitialization@() cil managed
1470+
{
1471+
1472+
.maxstack 8
1473+
IL_0000: ret
1474+
}
1475+
14581476
.property string greeting()
14591477
{
14601478
.get string ABC/ABC::get_greeting()
@@ -1483,6 +1501,25 @@
14831501
IL_0005: ret
14841502
}
14851503

1504+
.method private specialname rtspecialname static void .cctor() cil managed
1505+
{
1506+
1507+
.maxstack 8
1508+
IL_0000: ldc.i4.0
1509+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$ABC::init@
1510+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$ABC::init@
1511+
IL_000b: pop
1512+
IL_000c: ret
1513+
}
1514+
1515+
.method assembly static void staticInitialization@() cil managed
1516+
{
1517+
1518+
.maxstack 8
1519+
IL_0000: call void ABC/ABC::staticInitialization@()
1520+
IL_0005: ret
1521+
}
1522+
14861523
.property string greeting()
14871524
{
14881525
.get string ABC::get_greeting()
@@ -1492,12 +1529,17 @@
14921529
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$ABC
14931530
extends [runtime]System.Object
14941531
{
1532+
.field static assembly int32 init@
1533+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
1534+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
1535+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
14951536
.method public static void main@() cil managed
14961537
{
14971538
.entrypoint
14981539

14991540
.maxstack 8
1500-
IL_0000: ret
1541+
IL_0000: call void ABC::staticInitialization@()
1542+
IL_0005: ret
15011543
}
15021544

15031545
}

tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,24 @@
21532153
IL_0005: ret
21542154
}
21552155

2156+
.method private specialname rtspecialname static void .cctor() cil managed
2157+
{
2158+
2159+
.maxstack 8
2160+
IL_0000: ldc.i4.0
2161+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
2162+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
2163+
IL_000b: pop
2164+
IL_000c: ret
2165+
}
2166+
2167+
.method assembly static void staticInitialization@() cil managed
2168+
{
2169+
2170+
.maxstack 8
2171+
IL_0000: ret
2172+
}
2173+
21562174
.property string greeting()
21572175
{
21582176
.get string XYZ.ABC/ABC::get_greeting()
@@ -2181,6 +2199,25 @@
21812199
IL_0005: ret
21822200
}
21832201

2202+
.method private specialname rtspecialname static void .cctor() cil managed
2203+
{
2204+
2205+
.maxstack 8
2206+
IL_0000: ldc.i4.0
2207+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
2208+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
2209+
IL_000b: pop
2210+
IL_000c: ret
2211+
}
2212+
2213+
.method assembly static void staticInitialization@() cil managed
2214+
{
2215+
2216+
.maxstack 8
2217+
IL_0000: call void XYZ.ABC/ABC::staticInitialization@()
2218+
IL_0005: ret
2219+
}
2220+
21842221
.property string greeting()
21852222
{
21862223
.get string XYZ.ABC::get_greeting()
@@ -2190,12 +2227,17 @@
21902227
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly
21912228
extends [runtime]System.Object
21922229
{
2230+
.field static assembly int32 init@
2231+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
2232+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
2233+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
21932234
.method public static void main@() cil managed
21942235
{
21952236
.entrypoint
21962237

21972238
.maxstack 8
2198-
IL_0000: ret
2239+
IL_0000: call void XYZ.ABC::staticInitialization@()
2240+
IL_0005: ret
21992241
}
22002242

22012243
}

0 commit comments

Comments
 (0)