Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de9701d

Browse files
author
Copilot
committed
Revert "Revert cctor-force removal on 19810: keep unconditional for same-flags stability"
This reverts commit 84aab84.
1 parent 6b233d1 commit de9701d

142 files changed

Lines changed: 1785 additions & 3444 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.

src/Compiler/CodeGen/IlxGen.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10991,7 +10991,8 @@ and GenModuleBinding cenv (cgbuf: CodeGenBuffer) (qname: QualifiedNameOfFile) la
1099110991
GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenvinner mdef
1099210992
|> ignore
1099310993

10994-
GenForceWholeFileInitializationAsPartOfCCtor cenv cgbuf.mgbuf lazyInitInfo tref eenv.imports mspec.Range
10994+
if not (cgbuf.mgbuf.GetCurrentFields(tref) |> Seq.isEmpty) then
10995+
GenForceWholeFileInitializationAsPartOfCCtor cenv cgbuf.mgbuf lazyInitInfo tref eenv.imports mspec.Range
1099510996

1099610997
/// Generate the namespace fragments in a single file
1099710998
and GenImplFile cenv (mgbuf: AssemblyBuilder) mainInfoOpt eenv (implFile: CheckedImplFileAfterOptimization) =

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/StaticLet/StaticLetInUnionsAndRecords.fs

Lines changed: 33 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ let ``Static let record - generics - IL test`` compilation =
272272
compilation
273273
|> withLangVersion80
274274
|> compile
275-
|> verifyIL [""" .method private specialname rtspecialname static void .cctor() cil managed
275+
|> verifyIL [""" .method private specialname rtspecialname static
276+
void .cctor() cil managed
276277
{
277278
278279
.maxstack 8
@@ -290,21 +291,6 @@ let ``Static let record - generics - IL test`` compilation =
290291
IL_0030: ret
291292
}
292293
293-
.method public specialname rtspecialname instance void .ctor(!T x) cil managed
294-
{
295-
.custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes,
296-
class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 54 65 73 74 2B 4D 79 52 65
297-
63 6F 72 64 60 31 00 00 )
298-
299-
.maxstack 8
300-
IL_0000: ldarg.0
301-
IL_0001: call instance void [runtime]System.Object::.ctor()
302-
IL_0006: ldarg.0
303-
IL_0007: ldarg.1
304-
IL_0008: stfld !0 class Test/MyRecord`1<!T>::X@
305-
IL_000d: ret
306-
}
307-
308294
.method public static string GetMyName() cil managed
309295
{
310296
@@ -414,7 +400,8 @@ do Console.WriteLine("module after type")
414400
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoEqualityAttribute::.ctor() = ( 01 00 00 00 )
415401
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.NoComparisonAttribute::.ctor() = ( 01 00 00 00 )
416402
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 )
417-
.method private specialname rtspecialname static void .cctor() cil managed
403+
.method private specialname rtspecialname static
404+
void .cctor() cil managed
418405
{
419406
420407
.maxstack 8
@@ -427,17 +414,6 @@ do Console.WriteLine("module after type")
427414
428415
}
429416
430-
.method private specialname rtspecialname static void .cctor() cil managed
431-
{
432-
433-
.maxstack 8
434-
IL_0000: ldc.i4.0
435-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$Test::init@
436-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$Test::init@
437-
IL_000b: pop
438-
IL_000c: ret
439-
}
440-
441417
}
442418
443419
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$Test
@@ -447,7 +423,8 @@ do Console.WriteLine("module after type")
447423
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
448424
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
449425
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
450-
.method private specialname rtspecialname static void .cctor() cil managed
426+
.method private specialname rtspecialname static
427+
void .cctor() cil managed
451428
{
452429
453430
.maxstack 8
@@ -589,18 +566,8 @@ Console.Write(MyTypes.X.GetX)
589566
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 )
590567
.field static assembly int32 x_value
591568
.field static assembly int32 init@6
592-
.method private specialname rtspecialname static void .cctor() cil managed
593-
{
594-
595-
.maxstack 8
596-
IL_0000: ldc.i4.0
597-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$Test::init@
598-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$Test::init@
599-
IL_000b: pop
600-
IL_000c: ret
601-
}
602-
603-
.method public specialname static int32 get_GetX() cil managed
569+
.method public specialname static int32
570+
get_GetX() cil managed
604571
{
605572
606573
.maxstack 8
@@ -616,6 +583,18 @@ Console.Write(MyTypes.X.GetX)
616583
IL_0016: ret
617584
}
618585
586+
.method private specialname rtspecialname static
587+
void .cctor() cil managed
588+
{
589+
590+
.maxstack 8
591+
IL_0000: ldc.i4.0
592+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$Test::init@
593+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$Test::init@
594+
IL_000b: pop
595+
IL_000c: ret
596+
}
597+
619598
.property int32 GetX()
620599
{
621600
.get int32 MyTypes.X::get_GetX()
@@ -626,17 +605,6 @@ Console.Write(MyTypes.X.GetX)
626605
extends [runtime]System.Object
627606
{
628607
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 )
629-
.method private specialname rtspecialname static void .cctor() cil managed
630-
{
631-
632-
.maxstack 8
633-
IL_0000: ldc.i4.0
634-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$ProgramMain::init@
635-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$ProgramMain::init@
636-
IL_000b: pop
637-
IL_000c: ret
638-
}
639-
640608
}
641609
642610
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$ProgramMain
@@ -646,7 +614,8 @@ Console.Write(MyTypes.X.GetX)
646614
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
647615
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
648616
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
649-
.method private specialname rtspecialname static void .cctor() cil managed
617+
.method private specialname rtspecialname static
618+
void .cctor() cil managed
650619
{
651620
652621
.maxstack 8
@@ -716,17 +685,6 @@ Console.Write(MyTypes.X.GetX)
716685
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 )
717686
.field static assembly int32 x_value
718687
.field static assembly int32 init@6
719-
.method private specialname rtspecialname static void .cctor() cil managed
720-
{
721-
722-
.maxstack 8
723-
IL_0000: ldc.i4.0
724-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$Test::init@
725-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$Test::init@
726-
IL_000b: pop
727-
IL_000c: ret
728-
}
729-
730688
.method public specialname static int32 get_GetX() cil managed
731689
{
732690
@@ -743,6 +701,17 @@ Console.Write(MyTypes.X.GetX)
743701
IL_0016: ret
744702
}
745703
704+
.method private specialname rtspecialname static void .cctor() cil managed
705+
{
706+
707+
.maxstack 8
708+
IL_0000: ldc.i4.0
709+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$Test::init@
710+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$Test::init@
711+
IL_000b: pop
712+
IL_000c: ret
713+
}
714+
746715
.method assembly static void staticInitialization@() cil managed
747716
{
748717

tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.OptimizeOff.il.bsl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,6 @@
8383

8484
}
8585

86-
.method private specialname rtspecialname static void .cctor() cil managed
87-
{
88-
89-
.maxstack 8
90-
IL_0000: ldc.i4.0
91-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
92-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
93-
IL_000b: pop
94-
IL_000c: ret
95-
}
96-
9786
.method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> f1() cil managed
9887
{
9988

@@ -111,17 +100,6 @@
111100

112101
}
113102

114-
.method private specialname rtspecialname static void .cctor() cil managed
115-
{
116-
117-
.maxstack 8
118-
IL_0000: ldc.i4.0
119-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
120-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
121-
IL_000b: pop
122-
IL_000c: ret
123-
}
124-
125103
}
126104

127105
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly

tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOff.OptimizeOn.il.bsl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,6 @@
103103

104104
}
105105

106-
.method private specialname rtspecialname static void .cctor() cil managed
107-
{
108-
109-
.maxstack 8
110-
IL_0000: ldc.i4.0
111-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
112-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
113-
IL_000b: pop
114-
IL_000c: ret
115-
}
116-
117106
.method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> f1() cil managed
118107
{
119108

@@ -155,17 +144,6 @@
155144
}
156145
}
157146

158-
.method private specialname rtspecialname static void .cctor() cil managed
159-
{
160-
161-
.maxstack 8
162-
IL_0000: ldc.i4.0
163-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
164-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
165-
IL_000b: pop
166-
IL_000c: ret
167-
}
168-
169147
}
170148

171149
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly

tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.OptimizeOff.il.bsl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,6 @@
171171

172172
}
173173

174-
.method private specialname rtspecialname static void .cctor() cil managed
175-
{
176-
177-
.maxstack 8
178-
IL_0000: ldc.i4.0
179-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
180-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
181-
IL_000b: pop
182-
IL_000c: ret
183-
}
184-
185174
.method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> f2() cil managed
186175
{
187176

@@ -205,17 +194,6 @@
205194

206195
}
207196

208-
.method private specialname rtspecialname static void .cctor() cil managed
209-
{
210-
211-
.maxstack 8
212-
IL_0000: ldc.i4.0
213-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
214-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
215-
IL_000b: pop
216-
IL_000c: ret
217-
}
218-
219197
}
220198

221199
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly

tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOff.OptimizeOn.il.bsl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,6 @@
160160

161161
}
162162

163-
.method private specialname rtspecialname static void .cctor() cil managed
164-
{
165-
166-
.maxstack 8
167-
IL_0000: ldc.i4.0
168-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
169-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
170-
IL_000b: pop
171-
IL_000c: ret
172-
}
173-
174163
.method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> f2() cil managed
175164
{
176165

@@ -217,17 +206,6 @@
217206
}
218207
}
219208

220-
.method private specialname rtspecialname static void .cctor() cil managed
221-
{
222-
223-
.maxstack 8
224-
IL_0000: ldc.i4.0
225-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
226-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
227-
IL_000b: pop
228-
IL_000c: ret
229-
}
230-
231209
}
232210

233211
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly

tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,6 @@
143143

144144
}
145145

146-
.method private specialname rtspecialname static void .cctor() cil managed
147-
{
148-
149-
.maxstack 8
150-
IL_0000: ldc.i4.0
151-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
152-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
153-
IL_000b: pop
154-
IL_000c: ret
155-
}
156-
157146
.method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<int32> f3() cil managed
158147
{
159148

@@ -171,17 +160,6 @@
171160

172161
}
173162

174-
.method private specialname rtspecialname static void .cctor() cil managed
175-
{
176-
177-
.maxstack 8
178-
IL_0000: ldc.i4.0
179-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
180-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
181-
IL_000b: pop
182-
IL_000c: ret
183-
}
184-
185163
}
186164

187165
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly

tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOn.il.bsl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,6 @@
134134

135135
}
136136

137-
.method private specialname rtspecialname static void .cctor() cil managed
138-
{
139-
140-
.maxstack 8
141-
IL_0000: ldc.i4.0
142-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
143-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
144-
IL_000b: pop
145-
IL_000c: ret
146-
}
147-
148137
.method public static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<int32> f3() cil managed
149138
{
150139

@@ -186,17 +175,6 @@
186175
}
187176
}
188177

189-
.method private specialname rtspecialname static void .cctor() cil managed
190-
{
191-
192-
.maxstack 8
193-
IL_0000: ldc.i4.0
194-
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
195-
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
196-
IL_000b: pop
197-
IL_000c: ret
198-
}
199-
200178
}
201179

202180
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly

0 commit comments

Comments
 (0)