Skip to content

Commit 6ce0691

Browse files
authored
Improve directory attribute refactor - Break up PR #18161 - Part 1 (#18195)
* refactor * tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop
1 parent ded0349 commit 6ce0691

File tree

83 files changed

+2890
-2082
lines changed

Some content is hidden

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

83 files changed

+2890
-2082
lines changed

tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop.fs

Lines changed: 92 additions & 324 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// #Regression #NoMono #NoMT #CodeGen #EmittedIL
2+
// Regression test for TFS#712639
3+
// Incorrect span or overlapping debugging spans
4+
// The test will start failing once the bug is actually fixed
5+
for wi in [ 1 .. 3 ] do
6+
printfn "%A" wi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
2+
3+
4+
5+
6+
.assembly extern runtime { }
7+
.assembly extern FSharp.Core { }
8+
.assembly assembly
9+
{
10+
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
11+
int32,
12+
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
13+
14+
15+
16+
17+
.hash algorithm 0x00008004
18+
.ver 0:0:0:0
19+
}
20+
.module assembly.exe
21+
22+
.imagebase {value}
23+
.file alignment 0x00000200
24+
.stackreserve 0x00100000
25+
.subsystem 0x0003
26+
.corflags 0x00000001
27+
28+
29+
30+
31+
32+
.class public abstract auto ansi sealed assembly
33+
extends [runtime]System.Object
34+
{
35+
.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 )
36+
}
37+
38+
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly
39+
extends [runtime]System.Object
40+
{
41+
.field static assembly int32 init@
42+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
43+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
44+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
45+
.method public static void main@() cil managed
46+
{
47+
.entrypoint
48+
49+
.maxstack 4
50+
.locals init (class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> V_0,
51+
valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1<int32> V_1,
52+
uint64 V_2,
53+
int32 V_3,
54+
class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> V_4,
55+
int32 V_5)
56+
IL_0000: ldc.i4.0
57+
IL_0001: conv.i8
58+
IL_0002: stloc.2
59+
IL_0003: ldc.i4.1
60+
IL_0004: stloc.3
61+
IL_0005: br.s IL_0019
62+
63+
IL_0007: ldloca.s V_1
64+
IL_0009: ldloc.3
65+
IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1<int32>::Add(!0)
66+
IL_000f: nop
67+
IL_0010: ldloc.3
68+
IL_0011: ldc.i4.1
69+
IL_0012: add
70+
IL_0013: stloc.3
71+
IL_0014: ldloc.2
72+
IL_0015: ldc.i4.1
73+
IL_0016: conv.i8
74+
IL_0017: add
75+
IL_0018: stloc.2
76+
IL_0019: ldloc.2
77+
IL_001a: ldc.i4.3
78+
IL_001b: conv.i8
79+
IL_001c: blt.un.s IL_0007
80+
81+
IL_001e: ldloca.s V_1
82+
IL_0020: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<!0> valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1<int32>::Close()
83+
IL_0025: stloc.0
84+
IL_0026: ldloc.0
85+
IL_0027: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<!0> class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32>::get_TailOrNull()
86+
IL_002c: stloc.s V_4
87+
IL_002e: br.s IL_005a
88+
89+
IL_0030: ldloc.0
90+
IL_0031: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32>::get_HeadOrDefault()
91+
IL_0036: stloc.s V_5
92+
IL_0038: ldstr "%A"
93+
IL_003d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string)
94+
IL_0042: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine<class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
95+
IL_0047: ldloc.s V_5
96+
IL_0049: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
97+
IL_004e: pop
98+
IL_004f: ldloc.s V_4
99+
IL_0051: stloc.0
100+
IL_0052: ldloc.0
101+
IL_0053: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<!0> class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32>::get_TailOrNull()
102+
IL_0058: stloc.s V_4
103+
IL_005a: ldloc.s V_4
104+
IL_005c: brtrue.s IL_0030
105+
106+
IL_005e: ret
107+
}
108+
109+
}
110+
111+
112+
113+
114+
115+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
2+
3+
4+
5+
6+
.assembly extern runtime { }
7+
.assembly extern FSharp.Core { }
8+
.assembly assembly
9+
{
10+
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
11+
int32,
12+
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
13+
14+
15+
16+
17+
.hash algorithm 0x00008004
18+
.ver 0:0:0:0
19+
}
20+
.mresource public FSharpSignatureCompressedData.assembly
21+
{
22+
23+
24+
}
25+
.mresource public FSharpOptimizationCompressedData.assembly
26+
{
27+
28+
29+
}
30+
.module assembly.exe
31+
32+
.imagebase {value}
33+
.file alignment 0x00000200
34+
.stackreserve 0x00100000
35+
.subsystem 0x0003
36+
.corflags 0x00000001
37+
38+
39+
40+
41+
42+
.class public abstract auto ansi sealed assembly
43+
extends [runtime]System.Object
44+
{
45+
.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 )
46+
.method private specialname rtspecialname static void .cctor() cil managed
47+
{
48+
49+
.maxstack 8
50+
IL_0000: ldc.i4.0
51+
IL_0001: stsfld int32 '<StartupCode$assembly>'.$assembly::init@
52+
IL_0006: ldsfld int32 '<StartupCode$assembly>'.$assembly::init@
53+
IL_000b: pop
54+
IL_000c: ret
55+
}
56+
57+
.method assembly specialname static void staticInitialization@() cil managed
58+
{
59+
60+
.maxstack 4
61+
.locals init (class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> V_0,
62+
valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1<int32> V_1,
63+
uint64 V_2,
64+
int32 V_3,
65+
class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> V_4,
66+
int32 V_5)
67+
IL_0000: ldc.i4.0
68+
IL_0001: conv.i8
69+
IL_0002: stloc.2
70+
IL_0003: ldc.i4.1
71+
IL_0004: stloc.3
72+
IL_0005: br.s IL_0019
73+
74+
IL_0007: ldloca.s V_1
75+
IL_0009: ldloc.3
76+
IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1<int32>::Add(!0)
77+
IL_000f: nop
78+
IL_0010: ldloc.3
79+
IL_0011: ldc.i4.1
80+
IL_0012: add
81+
IL_0013: stloc.3
82+
IL_0014: ldloc.2
83+
IL_0015: ldc.i4.1
84+
IL_0016: conv.i8
85+
IL_0017: add
86+
IL_0018: stloc.2
87+
IL_0019: ldloc.2
88+
IL_001a: ldc.i4.3
89+
IL_001b: conv.i8
90+
IL_001c: blt.un.s IL_0007
91+
92+
IL_001e: ldloca.s V_1
93+
IL_0020: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<!0> valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1<int32>::Close()
94+
IL_0025: stloc.0
95+
IL_0026: ldloc.0
96+
IL_0027: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<!0> class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32>::get_TailOrNull()
97+
IL_002c: stloc.s V_4
98+
IL_002e: br.s IL_005a
99+
100+
IL_0030: ldloc.0
101+
IL_0031: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32>::get_HeadOrDefault()
102+
IL_0036: stloc.s V_5
103+
IL_0038: ldstr "%A"
104+
IL_003d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string)
105+
IL_0042: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine<class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
106+
IL_0047: ldloc.s V_5
107+
IL_0049: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
108+
IL_004e: pop
109+
IL_004f: ldloc.s V_4
110+
IL_0051: stloc.0
111+
IL_0052: ldloc.0
112+
IL_0053: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<!0> class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32>::get_TailOrNull()
113+
IL_0058: stloc.s V_4
114+
IL_005a: ldloc.s V_4
115+
IL_005c: brtrue.s IL_0030
116+
117+
IL_005e: ret
118+
}
119+
120+
}
121+
122+
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly
123+
extends [runtime]System.Object
124+
{
125+
.field static assembly int32 init@
126+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
127+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
128+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
129+
.method public static void main@() cil managed
130+
{
131+
.entrypoint
132+
133+
.maxstack 8
134+
IL_0000: call void assembly::staticInitialization@()
135+
IL_0005: ret
136+
}
137+
138+
}
139+
140+
141+
142+
143+
144+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// #Regression #NoMono #NoMT #CodeGen #EmittedIL
2+
// Regression test for TFS#712639
3+
// Incorrect span or overlapping debugging spans
4+
// The test will start failing once the bug is actually fixed
5+
for wi = 1 to 3 do
6+
printfn "%A" wi
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
3+
4+
5+
6+
.assembly extern runtime { }
7+
.assembly extern FSharp.Core { }
8+
.assembly assembly
9+
{
10+
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
11+
int32,
12+
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
13+
14+
15+
16+
17+
.hash algorithm 0x00008004
18+
.ver 0:0:0:0
19+
}
20+
.mresource public FSharpSignatureCompressedData.assembly
21+
{
22+
23+
24+
}
25+
.mresource public FSharpOptimizationCompressedData.assembly
26+
{
27+
28+
29+
}
30+
.module assembly.exe
31+
32+
.imagebase {value}
33+
.file alignment 0x00000200
34+
.stackreserve 0x00100000
35+
.subsystem 0x0003
36+
.corflags 0x00000001
37+
38+
39+
40+
41+
42+
.class public abstract auto ansi sealed assembly
43+
extends [runtime]System.Object
44+
{
45+
.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 )
46+
}
47+
48+
.class private abstract auto ansi sealed '<StartupCode$assembly>'.$assembly
49+
extends [runtime]System.Object
50+
{
51+
.field static assembly int32 init@
52+
.custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
53+
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
54+
.custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
55+
.method public static void main@() cil managed
56+
{
57+
.entrypoint
58+
59+
.maxstack 5
60+
.locals init (int32 V_0)
61+
IL_0000: ldc.i4.1
62+
IL_0001: stloc.0
63+
IL_0002: br.s IL_001e
64+
65+
IL_0004: ldstr "%A"
66+
IL_0009: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string)
67+
IL_000e: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine<class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
68+
IL_0013: ldloc.0
69+
IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
70+
IL_0019: pop
71+
IL_001a: ldloc.0
72+
IL_001b: ldc.i4.1
73+
IL_001c: add
74+
IL_001d: stloc.0
75+
IL_001e: ldloc.0
76+
IL_001f: ldc.i4.1
77+
IL_0020: ldc.i4.3
78+
IL_0021: add
79+
IL_0022: blt.s IL_0004
80+
81+
IL_0024: ret
82+
}
83+
84+
}
85+
86+
87+
88+
89+
90+

0 commit comments

Comments
 (0)