File tree Expand file tree Collapse file tree
tests/FSharp.Compiler.ComponentTests/EmittedIL Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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()
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
Original file line number Diff line number Diff line change 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()
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
Original file line number Diff line number Diff line change 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()
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
Original file line number Diff line number Diff line change 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()
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()
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}
Original file line number Diff line number Diff line change 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()
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()
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}
You can’t perform that action at this time.
0 commit comments