Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9535c7a

Browse files
manofstickKevinRansom
authored andcommitted
[CompilerPerf] Remove unbox.any when coercing to subsumed interfaces (#2972)
* Remove unbox.any when coercing to subsumed interfaces* Updated bsl files due to unbox.any change* Remove my statement based on faith* Manually modifed Seq_for_all01.il.bsl as no il file?
1 parent0d33aeb commit9535c7a

16 files changed

+4993
-5085
lines changed

‎src/fsharp/IlxGen.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,12 +2198,12 @@ and GenCoerce cenv cgbuf eenv (e,tgty,m,srcty) sequel =
21982198
// Do an extra check - should not be needed
21992199
TypeRelations.TypeFeasiblySubsumesType0 cenv.g cenv.amap m tgty TypeRelations.NoCoerce srctythen
22002200
begin
2201-
// The .NET IL doesn't always support implict subsumption for interface types, e.g. at stack merge points
2202-
// Hence be conservative here and always cast explicitly.
22032201
if(isInterfaceTy cenv.g tgty)then(
22042202
GenExpr cenv cgbuf eenv SPSuppress e Continue
22052203
letilToTy= GenType cenv.amap m eenv.tyenv tgty
2206-
CG.EmitInstrs cgbuf(pop1)(Push[ilToTy])[ I_unbox_any ilToTy]
2204+
// Section "III.1.8.1.3 Merging stack states" of ECMA-335 implies that no unboxing
2205+
// is required, but we still push the coerce'd type on to the code gen buffer.
2206+
CG.EmitInstrs cgbuf(pop1)(Push[ilToTy])[]
22072207
GenSequel cenv eenv.cloc cgbuf sequel
22082208
)else(
22092209
GenExpr cenv cgbuf eenv SPSuppress e sequel

‎tests/fsharpqa/Source/CodeGen/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.il.netfx4.bsl‎

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.81.0
2+
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
33
// Copyright (c) Microsoft Corporation. All rights reserved.
44

55

@@ -22,27 +22,27 @@
2222
int32)= (01000200000000000000000000000000 )
2323

2424
// --- The following custom attribute is added automatically, do not uncomment -------
25-
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 0000 01 00 00 00 00 )
25+
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 0001 01 00 00 00 00 )
2626

2727
.hash algorithm 0x00008004
2828
.ver0:0:0:0
2929
}
3030
.mresource public FSharpSignatureData.AsyncExpressionSteppingTest5
3131
{
32-
// Offset: 0x00000000 Length:0x000002B0
32+
// Offset: 0x00000000 Length:0x000002B4
3333
}
3434
.mresource public FSharpOptimizationData.AsyncExpressionSteppingTest5
3535
{
3636
// Offset: 0x000002B8 Length: 0x000000BE
3737
}
3838
.module AsyncExpressionSteppingTest5.dll
39-
// MVID: {5775B149-6394-30E8-A745-038349B17557}
39+
// MVID: {590846DB-6394-30E8-A745-0383DB460859}
4040
.imagebase 0x00400000
4141
.file alignment 0x00000200
4242
.stackreserve 0x00100000
4343
.subsystem 0x0003// WINDOWS_CUI
4444
.corflags 0x00000001// ILONLY
45-
// Image base:0x00D30000
45+
// Image base:0x012D0000
4646

4747

4848
// =============== CLASS MEMBERS DECLARATION ===================
@@ -81,16 +81,16 @@
8181
.maxstack5
8282
.locals init ([0] int32 x)
8383
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
84-
.line6,6 :17,31 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\AsyncExpressionStepping\\AsyncExpressionSteppingTest5.fs'
84+
.line6,6 :17,31 'C:\\src\\manofstick\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\AsyncExpressionStepping\\AsyncExpressionSteppingTest5.fs'
8585
IL_0000: nop
8686
IL_0001: ldarg.1
8787
IL_0002: stloc.0
88-
.line7,7 :20,35
88+
.line7,7 :20,35 ''
8989
IL_0003: ldstr"hello"
9090
IL_0008: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::.ctor(string)
9191
IL_000d: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
9292
IL_0012: pop
93-
.line8,8 :20,37
93+
.line8,8 :20,37 ''
9494
IL_0013: ldstr"hello 2"
9595
IL_0018: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::.ctor(string)
9696
IL_001d: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
@@ -129,16 +129,16 @@
129129
// Code size 49 (0x31)
130130
.maxstack5
131131
.locals init ([0] int32 x)
132-
.line9,9 :17,31
132+
.line9,9 :17,31 ''
133133
IL_0000: nop
134134
IL_0001: ldarg.1
135135
IL_0002: stloc.0
136-
.line10,10 :20,37
136+
.line10,10 :20,37 ''
137137
IL_0003: ldstr"goodbye"
138138
IL_0008: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::.ctor(string)
139139
IL_000d: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
140140
IL_0012: pop
141-
.line11,11 :20,39
141+
.line11,11 :20,39 ''
142142
IL_0013: ldstr"goodbye 2"
143143
IL_0018: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::.ctor(string)
144144
IL_001d: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4<!!0,class [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
@@ -174,21 +174,20 @@
174174
.method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit>
175175
Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
176176
{
177-
// Code size36 (0x24)
177+
// Code size31 (0x1f)
178178
.maxstack8
179-
.line9,9 :17,31
179+
.line9,9 :17,31 ''
180180
IL_0000: nop
181181
IL_0001: ldarg.0
182182
IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@9-2'::builder@
183183
IL_0007: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5::get_es()
184-
IL_000c: unbox.any class [mscorlib]System.Collections.Generic.IEnumerable`1<int32>
185-
IL_0011: ldarg.0
186-
IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@9-2'::builder@
187-
IL_0017: newobj instance void AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@9-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
188-
IL_001c: tail.
189-
IL_001e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For<int32>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
184+
IL_000c: ldarg.0
185+
IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@9-2'::builder@
186+
IL_0012: newobj instance void AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@9-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
187+
IL_0017: tail.
188+
IL_0019: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For<int32>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
190189
class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<!!0,class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit>>)
191-
IL_0023: ret
190+
IL_001e: ret
192191
}// end of method 'f7@9-2'::Invoke
193192

194193
}// end of class 'f7@9-2'
@@ -215,31 +214,30 @@
215214
.method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit>
216215
Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed
217216
{
218-
// Code size69 (0x45)
217+
// Code size64 (0x40)
219218
.maxstack8
220-
.line6,6 :17,31
219+
.line6,6 :17,31 ''
221220
IL_0000: nop
222221
IL_0001: ldarg.0
223222
IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
224223
IL_0007: ldarg.0
225224
IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
226225
IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5::get_es()
227-
IL_0012: unbox.any class [mscorlib]System.Collections.Generic.IEnumerable`1<int32>
228-
IL_0017: ldarg.0
229-
IL_0018: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
230-
IL_001d: newobj instance void AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
231-
IL_0022: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For<int32>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
226+
IL_0012: ldarg.0
227+
IL_0013: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
228+
IL_0018: newobj instance void AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
229+
IL_001d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For<int32>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
232230
class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<!!0,class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit>>)
233-
IL_0027: ldarg.0
234-
IL_0028: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
235-
IL_002d: ldarg.0
236-
IL_002e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
237-
IL_0033: newobj instance void AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
238-
IL_0038: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0>>)
239-
IL_003d: tail.
240-
IL_003f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit>,
231+
IL_0022: ldarg.0
232+
IL_0023: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
233+
IL_0028: ldarg.0
234+
IL_0029: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/f7@6::builder@
235+
IL_002e: newobj instance void AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder)
236+
IL_0033: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0>>)
237+
IL_0038: tail.
238+
IL_003a: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0> [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine<class [FSharp.Core]Microsoft.FSharp.Core.Unit>(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit>,
241239
class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<!!0>)
242-
IL_0044: ret
240+
IL_003f: ret
243241
}// end of method f7@6::Invoke
244242

245243
}// end of class f7@6
@@ -259,7 +257,7 @@
259257
// Code size 22 (0x16)
260258
.maxstack4
261259
.locals init ([0] class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder builder@)
262-
.line6,6 :9,14
260+
.line6,6 :9,14 ''
263261
IL_0000: nop
264262
IL_0001: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::get_DefaultAsyncBuilder()
265263
IL_0006: stloc.0
@@ -298,7 +296,7 @@
298296
.locals init ([0] class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> es,
299297
[1] class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_1,
300298
[2] class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_2)
301-
.line4,4 :5,21
299+
.line4,4 :5,21 ''
302300
IL_0000: nop
303301
IL_0001: ldc.i4.3
304302
IL_0002: ldc.i4.4
@@ -313,7 +311,7 @@
313311
IL_0018: dup
314312
IL_0019: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<int32> '<StartupCode$AsyncExpressionSteppingTest5>'.$AsyncExpressionSteppingTest5::es@4
315313
IL_001e: stloc.0
316-
.line13,13 :13,43
314+
.line13,13 :13,43 ''
317315
IL_001f: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1<class [FSharp.Core]Microsoft.FSharp.Core.Unit> AsyncExpressionSteppingTest5/AsyncExpressionSteppingTest5::f7()
318316
IL_0024: stloc.1
319317
IL_0025: ldloc.1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp