提交 fa6e7ccd 编写于 作者: S Sergey Tihon 提交者: Kevin Ransom (msft)

Moved CodeGen/EmittedIL/TailCalls over to NUnit (#7386)

* TailCalls test migration

* fix the diff in IL

* fix for netcore
上级 d3a2f7b1
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
open FSharp.Compiler.UnitTests
open NUnit.Framework
[<TestFixture>]
module ``TailCalls`` =
// Regression test for DevDiv:72571
[<Test>]
let ``TailCall 01``() =
CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|]
"""
module TailCall01
let foo(x:int, y) = printfn "%d" x
let run() = let x = 0 in foo(x,5)
"""
(fun verifier -> verifier.VerifyIL [
"""
.method public static void foo<a>(int32 x,
!!a y) cil managed
{
.maxstack 4
.locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
int32 V_1)
IL_0000: ldstr "%d"
IL_0005: 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)
IL_000a: 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>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: stloc.1
IL_0012: ldloc.0
IL_0013: ldloc.1
IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_0019: pop
IL_001a: ret
}
"""
"""
.method public static void run() cil managed
{
.maxstack 4
.locals init (int32 V_0)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: ldloc.0
IL_0003: ldc.i4.5
IL_0004: tail.
IL_0006: call void TailCall01::foo<int32>(int32,
!!0)
IL_000b: ret
}
"""
])
[<Test>]
let ``TailCall 02``() =
CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|]
"""
module TailCall02
let foo(x:int byref) = x
let run() = let mutable x = 0 in foo(&x)
"""
(fun verifier -> verifier.VerifyIL [
"""
.method public static int32 foo(int32& x) cil managed
{
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldobj [runtime]System.Int32
IL_0006: ret
}
"""
"""
.method public static int32 run() cil managed
{
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call int32 TailCall02::foo(int32&)
IL_0009: ret
}
"""
])
[<Test>]
let ``TailCall 03``() =
CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|]
"""
module TailCall03
let foo (x:int byref) (y:int byref) z = printfn "%d" (x+y)
let run() = let mutable x = 0 in foo &x &x 5
"""
(fun verifier -> verifier.VerifyIL [
"""
.method public static void foo<a>(int32& x,
int32& y,
!!a z) cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00
00 00 00 00 )
.maxstack 4
.locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
int32 V_1)
IL_0000: ldstr "%d"
IL_0005: 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)
IL_000a: 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>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: ldobj [runtime]System.Int32
IL_0016: ldarg.1
IL_0017: ldobj [runtime]System.Int32
IL_001c: add
IL_001d: stloc.1
IL_001e: ldloc.0
IL_001f: ldloc.1
IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_0025: pop
IL_0026: ret
}
"""
"""
.method public static void run() cil managed
{
.maxstack 5
.locals init (int32 V_0)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: ldloca.s V_0
IL_0006: ldc.i4.5
IL_0007: call void TailCall03::foo<int32>(int32&,
int32&,
!!0)
IL_000c: nop
IL_000d: ret
}
"""
])
[<Test>]
let ``TailCall 04``() =
CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|]
"""
module TailCall04
let foo(x:int byref, y) = printfn "%d" x
let run() = let mutable x = 0 in foo(&x,5)
"""
(fun verifier -> verifier.VerifyIL [
"""
.method public static void foo<a>(int32& x,
!!a y) cil managed
{
.maxstack 4
.locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
int32 V_1)
IL_0000: ldstr "%d"
IL_0005: 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)
IL_000a: 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>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: ldobj [runtime]System.Int32
IL_0016: stloc.1
IL_0017: ldloc.0
IL_0018: ldloc.1
IL_0019: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_001e: pop
IL_001f: ret
}
"""
"""
.method public static void run() cil managed
{
.maxstack 4
.locals init (int32 V_0)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: ldc.i4.5
IL_0005: call void TailCall04::foo<int32>(int32&,
!!0)
IL_000a: nop
IL_000b: ret
"""
])
[<Test>]
let ``TailCall 05``() =
CompilerAssert.CompileLibraryAndVerifyILWithOptions [|"-g"; "--optimize-"; "--tailcalls+"|]
"""
module TailCall05
let foo(x:int byref, y:int byref, z) = printfn "%d" (x+y)
let run() = let mutable x = 0 in foo(&x,&x,5)
"""
(fun verifier -> verifier.VerifyIL [
"""
.method public static void foo<a>(int32& x,
int32& y,
!!a z) cil managed
{
.maxstack 4
.locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
int32 V_1)
IL_0000: ldstr "%d"
IL_0005: 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)
IL_000a: 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>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: ldobj [runtime]System.Int32
IL_0016: ldarg.1
IL_0017: ldobj [runtime]System.Int32
IL_001c: add
IL_001d: stloc.1
IL_001e: ldloc.0
IL_001f: ldloc.1
IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_0025: pop
IL_0026: ret
}
"""
"""
.method public static void run() cil managed
{
.maxstack 5
.locals init (int32 V_0)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: ldloca.s V_0
IL_0006: ldc.i4.5
IL_0007: call void TailCall05::foo<int32>(int32&,
int32&,
!!0)
IL_000c: nop
IL_000d: ret
}
"""
])
\ No newline at end of file
......@@ -40,7 +40,7 @@ module ILChecker =
let unifyRuntimeAssemblyName ilCode =
System.Text.RegularExpressions.Regex.Replace(ilCode,
"\[System.Runtime\]|\[mscorlib\]","[runtime]",
"\[System.Runtime\]|\[System.Runtime.Extensions\]|\[mscorlib\]","[runtime]",
System.Text.RegularExpressions.RegexOptions.Singleline)
let text =
......
......@@ -36,6 +36,7 @@
<Compile Include="Compiler\CompilerAssert.fs" />
<Compile Include="Compiler\CodeGen\EmittedIL\LiteralValue.fs" />
<Compile Include="Compiler\CodeGen\EmittedIL\Mutation.fs" />
<Compile Include="Compiler\CodeGen\EmittedIL\TailCalls.fs" />
<Compile Include="Compiler\Conformance\BasicGrammarElements\BasicConstants.fs" />
<Compile Include="Compiler\ErrorMessages\ConstructorTests.fs" />
<Compile Include="Compiler\ErrorMessages\ClassesTests.fs" />
......
// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall
// Regression test for DevDiv:72571
let foo(x:int, y) = printfn "%d" x
let run() = let x = 0 in foo(x,5)
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern FSharp.Core
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 4:4:1:0
}
.assembly TailCall01
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
int32,
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.mresource public FSharpSignatureData.TailCall01
{
// Offset: 0x00000000 Length: 0x0000021D
}
.mresource public FSharpOptimizationData.TailCall01
{
// Offset: 0x00000228 Length: 0x0000007C
}
.module TailCall01.exe
// MVID: {59B19213-7D8F-CF4A-A745-03831392B159}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x02E90000
// =============== CLASS MEMBERS DECLARATION ===================
.class public abstract auto ansi sealed TailCall01
extends [mscorlib]System.Object
{
.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 )
.method public static void foo<a>(int32 x,
!!a y) cil managed
{
// Code size 27 (0x1b)
.maxstack 4
.locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
[1] int32 V_1)
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
.line 3,3 : 21,33 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall01.fs'
IL_0000: ldstr "%d"
IL_0005: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string)
IL_000a: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: stloc.1
IL_0012: ldloc.0
IL_0013: ldloc.1
IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_0019: pop
IL_001a: ret
} // end of method TailCall01::foo
.method public static void run() cil managed
{
// Code size 12 (0xc)
.maxstack 4
.locals init ([0] int32 x)
.line 4,4 : 13,22 ''
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 4,4 : 26,34 ''
IL_0002: ldloc.0
IL_0003: ldc.i4.5
IL_0004: tail.
IL_0006: call void TailCall01::foo<int32>(int32,
!!0)
IL_000b: ret
} // end of method TailCall01::run
} // end of class TailCall01
.class private abstract auto ansi sealed '<StartupCode$TailCall01>'.$TailCall01
extends [mscorlib]System.Object
{
.method public static void main@() cil managed
{
.entrypoint
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method $TailCall01::main@
} // end of class '<StartupCode$TailCall01>'.$TailCall01
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall
// Regression test for DevDiv:72571
let foo(x:int byref) = x
let run() = let mutable x = 0 in foo(&x)
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern FSharp.Core
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 4:4:1:0
}
.assembly TailCall02
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
int32,
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.mresource public FSharpSignatureData.TailCall02
{
// Offset: 0x00000000 Length: 0x00000202
}
.mresource public FSharpOptimizationData.TailCall02
{
// Offset: 0x00000208 Length: 0x0000007C
}
.module TailCall02.exe
// MVID: {59B19213-7D8F-CE9D-A745-03831392B159}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x00E20000
// =============== CLASS MEMBERS DECLARATION ===================
.class public abstract auto ansi sealed TailCall02
extends [mscorlib]System.Object
{
.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 )
.method public static int32 foo(int32& x) cil managed
{
// Code size 7 (0x7)
.maxstack 8
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
.line 3,3 : 24,25 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall02.fs'
IL_0000: ldarg.0
IL_0001: ldobj [mscorlib]System.Int32
IL_0006: ret
} // end of method TailCall02::foo
.method public static int32 run() cil managed
{
// Code size 10 (0xa)
.maxstack 3
.locals init ([0] int32 x)
.line 4,4 : 13,30 ''
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 4,4 : 34,41 ''
IL_0002: ldloca.s x
IL_0004: call int32 TailCall02::foo(int32&)
IL_0009: ret
} // end of method TailCall02::run
} // end of class TailCall02
.class private abstract auto ansi sealed '<StartupCode$TailCall02>'.$TailCall02
extends [mscorlib]System.Object
{
.method public static void main@() cil managed
{
.entrypoint
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method $TailCall02::main@
} // end of class '<StartupCode$TailCall02>'.$TailCall02
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall
// Regression test for DevDiv:72571
let foo (x:int byref) (y:int byref) z = printfn "%d" (x+y)
let run() = let mutable x = 0 in foo &x &x 5
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern FSharp.Core
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 4:4:1:0
}
.assembly TailCall03
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
int32,
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.mresource public FSharpSignatureData.TailCall03
{
// Offset: 0x00000000 Length: 0x00000241
}
.mresource public FSharpOptimizationData.TailCall03
{
// Offset: 0x00000248 Length: 0x0000007C
}
.module TailCall03.exe
// MVID: {59B19213-7D8F-CE88-A745-03831392B159}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x00E50000
// =============== CLASS MEMBERS DECLARATION ===================
.class public abstract auto ansi sealed TailCall03
extends [mscorlib]System.Object
{
.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 )
.method public static void foo<a>(int32& x,
int32& y,
!!a z) cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00
00 00 00 00 )
// Code size 39 (0x27)
.maxstack 4
.locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
[1] int32 V_1)
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
.line 3,3 : 41,53 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall03.fs'
IL_0000: ldstr "%d"
IL_0005: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string)
IL_000a: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: ldobj [mscorlib]System.Int32
IL_0016: ldarg.1
IL_0017: ldobj [mscorlib]System.Int32
IL_001c: add
IL_001d: stloc.1
IL_001e: ldloc.0
IL_001f: ldloc.1
IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_0025: pop
IL_0026: ret
} // end of method TailCall03::foo
.method public static void run() cil managed
{
// Code size 14 (0xe)
.maxstack 5
.locals init ([0] int32 x)
.line 4,4 : 13,30 ''
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 4,4 : 34,45 ''
IL_0002: ldloca.s x
IL_0004: ldloca.s x
IL_0006: ldc.i4.5
IL_0007: call void TailCall03::foo<int32>(int32&,
int32&,
!!0)
IL_000c: nop
IL_000d: ret
} // end of method TailCall03::run
} // end of class TailCall03
.class private abstract auto ansi sealed '<StartupCode$TailCall03>'.$TailCall03
extends [mscorlib]System.Object
{
.method public static void main@() cil managed
{
.entrypoint
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method $TailCall03::main@
} // end of class '<StartupCode$TailCall03>'.$TailCall03
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall
// Regression test for DevDiv:72571
let foo(x:int byref, y) = printfn "%d" x
let run() = let mutable x = 0 in foo(&x,5)
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern FSharp.Core
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 4:4:1:0
}
.assembly TailCall04
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
int32,
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.mresource public FSharpSignatureData.TailCall04
{
// Offset: 0x00000000 Length: 0x0000022F
}
.mresource public FSharpOptimizationData.TailCall04
{
// Offset: 0x00000238 Length: 0x0000007C
}
.module TailCall04.exe
// MVID: {59B19213-7D8F-CFE3-A745-03831392B159}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x00B70000
// =============== CLASS MEMBERS DECLARATION ===================
.class public abstract auto ansi sealed TailCall04
extends [mscorlib]System.Object
{
.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 )
.method public static void foo<a>(int32& x,
!!a y) cil managed
{
// Code size 32 (0x20)
.maxstack 4
.locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
[1] int32 V_1)
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
.line 3,3 : 27,39 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall04.fs'
IL_0000: ldstr "%d"
IL_0005: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string)
IL_000a: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: ldobj [mscorlib]System.Int32
IL_0016: stloc.1
IL_0017: ldloc.0
IL_0018: ldloc.1
IL_0019: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_001e: pop
IL_001f: ret
} // end of method TailCall04::foo
.method public static void run() cil managed
{
// Code size 12 (0xc)
.maxstack 4
.locals init ([0] int32 x)
.line 4,4 : 13,30 ''
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 4,4 : 34,43 ''
IL_0002: ldloca.s x
IL_0004: ldc.i4.5
IL_0005: call void TailCall04::foo<int32>(int32&,
!!0)
IL_000a: nop
IL_000b: ret
} // end of method TailCall04::run
} // end of class TailCall04
.class private abstract auto ansi sealed '<StartupCode$TailCall04>'.$TailCall04
extends [mscorlib]System.Object
{
.method public static void main@() cil managed
{
.entrypoint
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method $TailCall04::main@
} // end of class '<StartupCode$TailCall04>'.$TailCall04
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// #NoMono #NoMT #CodeGen #EmittedIL #Tailcall
// Regression test for DevDiv:72571
let foo(x:int byref, y:int byref, z) = printfn "%d" (x+y)
let run() = let mutable x = 0 in foo(&x,&x,5)
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern FSharp.Core
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 4:4:1:0
}
.assembly TailCall05
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32,
int32,
int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 )
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.mresource public FSharpSignatureData.TailCall05
{
// Offset: 0x00000000 Length: 0x0000023F
}
.mresource public FSharpOptimizationData.TailCall05
{
// Offset: 0x00000248 Length: 0x0000007C
}
.module TailCall05.exe
// MVID: {59B19213-7D8F-CFC6-A745-03831392B159}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x03210000
// =============== CLASS MEMBERS DECLARATION ===================
.class public abstract auto ansi sealed TailCall05
extends [mscorlib]System.Object
{
.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 )
.method public static void foo<a>(int32& x,
int32& y,
!!a z) cil managed
{
// Code size 39 (0x27)
.maxstack 4
.locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit> V_0,
[1] int32 V_1)
.language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
.line 3,3 : 40,52 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\TailCalls\\TailCall05.fs'
IL_0000: ldstr "%d"
IL_0005: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string)
IL_000a: 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 [mscorlib]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit>)
IL_000f: stloc.0
IL_0010: ldarg.0
IL_0011: ldobj [mscorlib]System.Int32
IL_0016: ldarg.1
IL_0017: ldobj [mscorlib]System.Int32
IL_001c: add
IL_001d: stloc.1
IL_001e: ldloc.0
IL_001f: ldloc.1
IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<int32,class [FSharp.Core]Microsoft.FSharp.Core.Unit>::Invoke(!0)
IL_0025: pop
IL_0026: ret
} // end of method TailCall05::foo
.method public static void run() cil managed
{
// Code size 14 (0xe)
.maxstack 5
.locals init ([0] int32 x)
.line 4,4 : 13,30 ''
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 4,4 : 34,46 ''
IL_0002: ldloca.s x
IL_0004: ldloca.s x
IL_0006: ldc.i4.5
IL_0007: call void TailCall05::foo<int32>(int32&,
int32&,
!!0)
IL_000c: nop
IL_000d: ret
} // end of method TailCall05::run
} // end of class TailCall05
.class private abstract auto ansi sealed '<StartupCode$TailCall05>'.$TailCall05
extends [mscorlib]System.Object
{
.method public static void main@() cil managed
{
.entrypoint
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method $TailCall05::main@
} // end of class '<StartupCode$TailCall05>'.$TailCall05
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
SOURCE=TailCall01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall01.exe" # TailCall01.fs -
SOURCE=TailCall02.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall02.exe" # TailCall02.fs -
SOURCE=TailCall03.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall03.exe" # TailCall03.fs -
SOURCE=TailCall04.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall04.exe" # TailCall04.fs -
SOURCE=TailCall05.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize- --tailcalls+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TailCall05.exe" # TailCall05.fs -
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册