From b92de21015356d59822d7a489661930e70ecc93c Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Wed, 22 Nov 2023 12:09:00 +0100 Subject: [PATCH 01/13] putting a bunch of opened issues about IL optimisation under IL baseline tests --- .../Optimization/OptimizationTests.fs | 31 + .../samples/array_of_function_no_alloc.fsx | 20 + .../array_of_function_no_alloc.fsx.err.bsl | 0 .../array_of_function_no_alloc.fsx.il.bsl | 194 ++++ .../samples/du_for_same_expression.fsx | 16 + .../du_for_same_expression.fsx.err.bsl | 0 .../samples/du_for_same_expression.fsx.il.bsl | 176 ++++ .../samples/for_loop_custom_step.fsx | 10 + .../samples/for_loop_custom_step.fsx.err.bsl | 0 .../samples/for_loop_custom_step.fsx.il.bsl | 113 +++ .../Optimization/samples/for_loop_non_int.fsx | 4 + .../samples/for_loop_non_int.fsx.err.bsl | 0 .../samples/for_loop_non_int.fsx.il.bsl | 144 +++ .../samples/if_then_else_bool_expression.fsx | 13 + .../if_then_else_bool_expression.fsx.err.bsl | 0 .../if_then_else_bool_expression.fsx.il.bsl | 115 +++ .../samples/inplace_array_update.fsx | 32 + .../samples/inplace_array_update.fsx.err.bsl | 0 .../samples/inplace_array_update.fsx.il.bsl | 296 ++++++ .../Optimization/samples/lambda_inlining.fsx | 37 + .../samples/lambda_inlining.fsx.err.bsl | 0 .../samples/lambda_inlining.fsx.il.bsl | 884 ++++++++++++++++++ .../option_elision_non_constant_result.fsx | 24 + ...on_elision_non_constant_result.fsx.err.bsl | 0 ...ion_elision_non_constant_result.fsx.il.bsl | 133 +++ .../Optimization/samples/spurious_tail.fsx | 30 + .../samples/spurious_tail.fsx.err.bsl | 0 .../samples/spurious_tail.fsx.il.bsl | 203 ++++ .../samples/static_init_field.fsx | 14 + .../samples/static_init_field.fsx.err.bsl | 0 .../samples/static_init_field.fsx.il.bsl | 357 +++++++ .../tailcall_last_expression_parens.fsx | 36 + ...ailcall_last_expression_parens.fsx.err.bsl | 0 ...tailcall_last_expression_parens.fsx.il.bsl | 300 ++++++ .../Optimization/samples/typedefof.fsx | 11 + .../samples/typedefof.fsx.err.bsl | 0 .../Optimization/samples/typedefof.fsx.il.bsl | 117 +++ .../use_binding_on_struct_enumerator.fsx | 35 + ...e_binding_on_struct_enumerator.fsx.err.bsl | 0 ...se_binding_on_struct_enumerator.fsx.il.bsl | 347 +++++++ .../FSharp.Compiler.ComponentTests.fsproj | 4 +- tests/FSharp.Test.Utilities/CompilerAssert.fs | 7 +- 42 files changed, 3700 insertions(+), 3 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.err.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs new file mode 100644 index 00000000000..f5dda0db06a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs @@ -0,0 +1,31 @@ +module FSharp.Compiler.ComponentTests.EmittedIL.Optimization.OptimizationTests +open Xunit +open FSharp.Test +open FSharp.Test.Compiler +let [] folder = __SOURCE_DIRECTORY__ + "/samples" + +[] +let ``baselines`` compilation = + compilation + |> asFsx + |> verifyBaselines + |> compileAndRun + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx new file mode 100644 index 00000000000..dedf5181b18 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx @@ -0,0 +1,20 @@ +// +// { "optimization": { "reported_in": "#3660", "reported_by": "@varon", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +let exampleFunc v = v + 2 + +let runAll(fArr:(int -> int) array) x = + let mutable n = 0 + for i = 0 to fArr.Length - 1 do + n <- n + fArr.[i] x + n + + +let runAllNoAlloc(fArr:(int -> int) array) x = + let mutable n = 0 + for i = 0 to fArr.Length - 1 do + let z = fArr.[i] + n <- n + z x + n + +System.Console.WriteLine() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl new file mode 100644 index 00000000000..ad36e15d2d8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl @@ -0,0 +1,194 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Array_of_function_no_alloc + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit runAll@9 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field static assembly initonly class Array_of_function_no_alloc/runAll@9 @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] source, + int32 index) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Array_of_function_no_alloc/runAll@9::.ctor() + IL_0005: stsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance + IL_000a: ret + } + + } + + .method public static int32 exampleFunc(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.2 + IL_0002: add + IL_0003: ret + } + + .method public static int32 runAll(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, + int32 x) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_001a + + IL_0006: ldloc.0 + IL_0007: ldsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance + IL_000c: ldarg.0 + IL_000d: ldloc.1 + IL_000e: ldarg.1 + IL_000f: call !!1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[],int32>::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>, + !0, + !1, + !!0) + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.1 + IL_001a: ldloc.1 + IL_001b: ldarg.0 + IL_001c: ldlen + IL_001d: conv.i4 + IL_001e: blt.s IL_0006 + + IL_0020: ldloc.0 + IL_0021: ret + } + + .method public static int32 runAllNoAlloc(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, + int32 x) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_001c + + IL_0006: ldarg.0 + IL_0007: ldloc.1 + IL_0008: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + IL_000d: stloc.2 + IL_000e: ldloc.0 + IL_000f: ldloc.2 + IL_0010: ldarg.1 + IL_0011: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.1 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: stloc.1 + IL_001c: ldloc.1 + IL_001d: ldarg.0 + IL_001e: ldlen + IL_001f: conv.i4 + IL_0020: blt.s IL_0006 + + IL_0022: ldloc.0 + IL_0023: ret + } + +} + +.class private abstract auto ansi sealed ''.$Array_of_function_no_alloc$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx new file mode 100644 index 00000000000..7b9b14f8cba --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx @@ -0,0 +1,16 @@ +// +// { "optimization": { "reported_in": "#15872", "reported_by": "@kerams", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +let inline map mapping result = + match result with + | Error e -> Error e + | Ok x -> Ok (mapping x) + +let ff x = map (fun y -> y.ToString ()) x + +let ffs x = map id x + +System.Console.WriteLine(ff (Ok "")) +System.Console.WriteLine(ffs (Ok "")) +System.Console.WriteLine(ff (Error "")) +System.Console.WriteLine(ffs (Error "")) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl new file mode 100644 index 00000000000..b5f17e0c867 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl @@ -0,0 +1,176 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Du_for_same_expression + extends [runtime]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 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + map(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapping, + valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 result) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (!!c V_0, + !!a V_1) + IL_0000: ldarga.s result + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_001b + + IL_000c: ldarga.s result + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_001a: ret + + IL_001b: ldarga.s result + IL_001d: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0022: stloc.1 + IL_0023: ldarg.0 + IL_0024: ldloc.1 + IL_0025: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_002a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_002f: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1) + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: constrained. !!a + IL_002b: callvirt instance string [runtime]System.Object::ToString() + IL_0030: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0035: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 3 + .locals init (!!a V_0) + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Identity(!!0) + IL_0027: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_002c: ret + } + +} + +.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 3 + IL_0000: ldstr "" + IL_0005: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_000a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_000f: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0014: call void [runtime]System.Console::WriteLine(object) + IL_0019: ldstr "" + IL_001e: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0023: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0028: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_002d: call void [runtime]System.Console::WriteLine(object) + IL_0032: ldstr "" + IL_0037: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_003c: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0041: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0046: call void [runtime]System.Console::WriteLine(object) + IL_004b: ldstr "" + IL_0050: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0055: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_005a: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_005f: call void [runtime]System.Console::WriteLine(object) + IL_0064: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx new file mode 100644 index 00000000000..781664041bf --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx @@ -0,0 +1,10 @@ +// +// { "optimization": { "reported_in": "#9548", "reported_by": "@teo-tsirpanis", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// + +open System + +let g() = + for x in 0 .. 2 .. 15 do + Console.WriteLine x +g() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl new file mode 100644 index 00000000000..841f1df59c1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl @@ -0,0 +1,113 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed For_loop_custom_step + extends [runtime]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 g() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.2 + IL_0002: ldc.i4.s 15 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0009: stloc.0 + IL_000a: ldloc.0 + IL_000b: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0010: stloc.1 + .try + { + IL_0011: br.s IL_001e + + IL_0013: ldloc.1 + IL_0014: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0019: call void [runtime]System.Console::WriteLine(int32) + IL_001e: ldloc.1 + IL_001f: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0024: brtrue.s IL_0013 + + IL_0026: leave.s IL_003a + + } + finally + { + IL_0028: ldloc.1 + IL_0029: isinst [runtime]System.IDisposable + IL_002e: stloc.2 + IL_002f: ldloc.2 + IL_0030: brfalse.s IL_0039 + + IL_0032: ldloc.2 + IL_0033: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0038: endfinally + IL_0039: endfinally + } + IL_003a: ret + } + +} + +.class private abstract auto ansi sealed ''.$For_loop_custom_step$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_custom_step::g() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx new file mode 100644 index 00000000000..a97f88ce83e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx @@ -0,0 +1,4 @@ +// +// { "optimization": { "reported_in": "#9548", "reported_by": "@cartermp", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +for x in 0L..100L do printfn "hello" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.bsl new file mode 100644 index 00000000000..df0ca617f03 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.bsl @@ -0,0 +1,144 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed For_loop_non_int + extends [runtime]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 assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 + get_inputSequence@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0005: ret + } + + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 + get_enumerator@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_0005: ret + } + + .property class [runtime]System.Collections.Generic.IEnumerable`1 + inputSequence@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + } + .property class [runtime]System.Collections.Generic.IEnumerator`1 + enumerator@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + } +} + +.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx + extends [runtime]System.Object +{ + .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 5 + .locals init (int64 V_0, + class [runtime]System.IDisposable V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 100 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + IL_0016: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + .try + { + IL_0020: br.s IL_003d + + IL_0022: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0027: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_002c: stloc.0 + IL_002d: ldstr "hello" + IL_0032: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_0037: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_003c: pop + IL_003d: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0042: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0047: brtrue.s IL_0022 + + IL_0049: leave.s IL_0061 + + } + finally + { + IL_004b: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0050: isinst [runtime]System.IDisposable + IL_0055: stloc.1 + IL_0056: ldloc.1 + IL_0057: brfalse.s IL_0060 + + IL_0059: ldloc.1 + IL_005a: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_005f: endfinally + IL_0060: endfinally + } + IL_0061: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx new file mode 100644 index 00000000000..14ef1aed364 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx @@ -0,0 +1,13 @@ +// +// { "optimization": { "reported_in": "#16302", "reported_by": "@thorium", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +let foo a b = + if a then false + elif b then false + else true + +let bar a b = + not(a || b) + +System.Console.WriteLine(foo true false) +System.Console.WriteLine(bar true false) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl new file mode 100644 index 00000000000..754fdd99e8c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl @@ -0,0 +1,115 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed If_then_else_bool_expression + extends [runtime]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 bool foo(bool a, + bool b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0005 + + IL_0003: ldc.i4.0 + IL_0004: ret + + IL_0005: ldarg.1 + IL_0006: brfalse.s IL_000a + + IL_0008: ldc.i4.0 + IL_0009: ret + + IL_000a: ldc.i4.1 + IL_000b: ret + } + + .method public static bool bar(bool a, + bool b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0008 + + IL_0003: ldarg.1 + IL_0004: ldc.i4.0 + IL_0005: ceq + IL_0007: ret + + IL_0008: ldc.i4.0 + IL_0009: ret + } + +} + +.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: call bool If_then_else_bool_expression::foo(bool, + bool) + IL_0007: call void [runtime]System.Console::WriteLine(bool) + IL_000c: ldc.i4.1 + IL_000d: ldc.i4.0 + IL_000e: call bool If_then_else_bool_expression::bar(bool, + bool) + IL_0013: call void [runtime]System.Console::WriteLine(bool) + IL_0018: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx new file mode 100644 index 00000000000..0d510934254 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx @@ -0,0 +1,32 @@ +// +// { "optimization": { "reported_in": "#6499", "reported_by": "@atlemann,@cartermp", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +module Foo = + + let bar (f : 'a -> 'a -> 'a) (a:'a array) (b:'a array) = + Array.map2 f a b + + let barInPlace (f : 'a -> 'a -> 'a) (a:'a array) (b:'a array) = + for i in 0..b.Length - 1 do + b.[i] <- f a.[i] b.[i] + + let inline barInPlaceInline (f : 'a -> 'a -> 'a) (a:'a array) (b:'a array) = + for i in 0..b.Length - 1 do + b.[i] <- f a.[i] b.[i] + + let barInPlaceOptClosure (f : 'a -> 'a -> 'a) (a:'a array) (b:'a array) = + let func = OptimizedClosures.FSharpFunc<'a, 'a, 'a>.Adapt(f) + for i in 0..b.Length - 1 do + b.[i] <- func.Invoke(a.[i], b.[i]) + + let inline barInPlaceOptClosureInline (f : 'a -> 'a -> 'a) (a:'a array) (b:'a array) = + let func = OptimizedClosures.FSharpFunc<'a, 'a, 'a>.Adapt(f) + for i in 0..b.Length - 1 do + b.[i] <- func.Invoke(a.[i], b.[i]) + + let barFunInside (a:single array) (b:single array) = + let f = (fun a b -> a * 0.7f + b * 0.3f) + for i in 0..b.Length - 1 do + b.[i] <- f a.[i] b.[i] + +System.Console.WriteLine() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl new file mode 100644 index 00000000000..01bd5b94704 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl @@ -0,0 +1,296 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Inplace_array_update + extends [runtime]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 ) + .class abstract auto ansi sealed nested public Foo + extends [runtime]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 !!a[] bar(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: tail. + IL_0005: call !!2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Map2(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0[], + !!1[]) + IL_000a: ret + } + + .method public static void barInPlace(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0023 + + IL_0004: ldarg.2 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: ldloc.0 + IL_0009: ldelem !!a + IL_000e: ldarg.2 + IL_000f: ldloc.0 + IL_0010: ldelem !!a + IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001a: stelem !!a + IL_001f: ldloc.0 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.0 + IL_0023: ldloc.0 + IL_0024: ldarg.2 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_0004 + + IL_0029: ret + } + + .method public static void barInPlaceInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0023 + + IL_0004: ldarg.2 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: ldloc.0 + IL_0009: ldelem !!a + IL_000e: ldarg.2 + IL_000f: ldloc.0 + IL_0010: ldelem !!a + IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001a: stelem !!a + IL_001f: ldloc.0 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.0 + IL_0023: ldloc.0 + IL_0024: ldarg.2 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_0004 + + IL_0029: ret + } + + .method public static void barInPlaceOptClosure(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldc.i4.0 + IL_0008: stloc.1 + IL_0009: br.s IL_002a + + IL_000b: ldarg.2 + IL_000c: ldloc.1 + IL_000d: ldloc.0 + IL_000e: ldarg.1 + IL_000f: ldloc.1 + IL_0010: ldelem !!a + IL_0015: ldarg.2 + IL_0016: ldloc.1 + IL_0017: ldelem !!a + IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0021: stelem !!a + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldarg.2 + IL_002c: ldlen + IL_002d: conv.i4 + IL_002e: blt.s IL_000b + + IL_0030: ret + } + + .method public static void barInPlaceOptClosureInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldc.i4.0 + IL_0008: stloc.1 + IL_0009: br.s IL_002a + + IL_000b: ldarg.2 + IL_000c: ldloc.1 + IL_000d: ldloc.0 + IL_000e: ldarg.1 + IL_000f: ldloc.1 + IL_0010: ldelem !!a + IL_0015: ldarg.2 + IL_0016: ldloc.1 + IL_0017: ldelem !!a + IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0021: stelem !!a + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldarg.2 + IL_002c: ldlen + IL_002d: conv.i4 + IL_002e: blt.s IL_000b + + IL_0030: ret + } + + .method public static void barFunInside(float32[] a, + float32[] b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + float32 V_1, + float32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_002e + + IL_0004: ldarg.1 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldloc.0 + IL_0008: ldelem [runtime]System.Single + IL_000d: stloc.1 + IL_000e: ldarg.1 + IL_000f: ldloc.0 + IL_0010: ldelem [runtime]System.Single + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.r4 0.69999999 + IL_001c: mul + IL_001d: ldloc.2 + IL_001e: ldc.r4 0.30000001 + IL_0023: mul + IL_0024: add + IL_0025: stelem [runtime]System.Single + IL_002a: ldloc.0 + IL_002b: ldc.i4.1 + IL_002c: add + IL_002d: stloc.0 + IL_002e: ldloc.0 + IL_002f: ldarg.1 + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: blt.s IL_0004 + + IL_0034: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Inplace_array_update$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx new file mode 100644 index 00000000000..9889aefa075 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx @@ -0,0 +1,37 @@ +// +// { "optimization": { "reported_in": "#12416", "reported_by": "@mrange", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +type 'T PushStream = ('T -> bool) -> bool + +let inline ofArray (vs : _ array) : _ PushStream = fun ([] r) -> + let mutable i = 0 + while i < vs.Length && r vs.[i] do + i <- i + 1 + i = vs.Length + +let inline fold ([] f) z ([] ps : _ PushStream) = + let mutable s = z + let _ = ps (fun v -> s <- f s v; true) + s + +let values = [|0..10000|] + +let thisIsInlined1 () = fold (+) 0 (ofArray values) +let thisIsInlined2 () = + let vs = [|0..10000|] + fold (+) 0 (ofArray vs) + +let thisIsNotInlined1 () = fold (+) 0 (ofArray [|0..10000|]) + +type Test() = + let _values = [|0..10000|] + static let _svalues = [|0..10000|] + + let array vs = fold (+) 0 (ofArray vs) + + member x.thisIsInlined2 () = fold (+) 0 (ofArray values) + member x.thisIsInlined3 () = array _values + + member x.thisIsNotInlined2 () = fold (+) 0 (ofArray _values) + member x.thisIsNotInlined3 () = fold (+) 0 (ofArray _svalues) + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl new file mode 100644 index 00000000000..a005329849e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl @@ -0,0 +1,884 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Lambda_inlining + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit fold@14 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> class Lambda_inlining/fold@14::f + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s + IL_0014: ret + } + + .method public strict virtual instance bool + Invoke(!b v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> class Lambda_inlining/fold@14::f + IL_000c: ldarg.0 + IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s + IL_0012: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0017: ldarg.1 + IL_0018: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001d: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0022: ldc.i4.1 + IL_0023: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined1@24 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined1@24-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + + .class auto ansi serializable nested public Test + extends [runtime]System.Object + { + .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 ) + .field assembly int32[] _values + .field static assembly int32[] _svalues + .field static assembly int32 init@26 + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4.0 + IL_000a: ldc.i4.1 + IL_000b: ldc.i4 0x2710 + IL_0010: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0015: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_001a: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_001f: stfld int32[] Lambda_inlining/Test::_values + IL_0024: ret + } + + .method public hidebysig instance int32 + thisIsInlined2() cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_000a + + IL_0006: ldloc.1 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: stloc.1 + IL_000a: ldloc.1 + IL_000b: call int32[] Lambda_inlining::get_values() + IL_0010: ldlen + IL_0011: conv.i4 + IL_0012: bge.s IL_0027 + + IL_0014: call int32[] Lambda_inlining::get_values() + IL_0019: ldloc.1 + IL_001a: ldelem [runtime]System.Int32 + IL_001f: stloc.2 + IL_0020: ldloc.0 + IL_0021: ldloc.2 + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldc.i4.1 + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0006 + + IL_002a: ldloc.1 + IL_002b: call int32[] Lambda_inlining::get_values() + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: ceq + IL_0034: pop + IL_0035: ldloc.0 + IL_0036: ret + } + + .method public hidebysig instance int32 + thisIsInlined3() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: ldfld int32[] Lambda_inlining/Test::_values + IL_0007: callvirt instance int32 Lambda_inlining/Test::'array'(int32[]) + IL_000c: ret + } + + .method public hidebysig instance int32 + thisIsNotInlined2() cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, + int32[] V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) + IL_0000: ldarg.0 + IL_0001: ldfld int32[] Lambda_inlining/Test::_values + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: newobj instance void Lambda_inlining/thisIsNotInlined2@35::.ctor(int32[]) + IL_000d: stloc.0 + IL_000e: ldc.i4.0 + IL_000f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0014: stloc.2 + IL_0015: ldloc.0 + IL_0016: ldloc.2 + IL_0017: newobj instance void Lambda_inlining/'thisIsNotInlined2@35-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0021: pop + IL_0022: ldloc.2 + IL_0023: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0028: ret + } + + .method public hidebysig instance int32 + thisIsNotInlined3() cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, + int32[] V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) + IL_0000: volatile. + IL_0002: ldsfld int32 Lambda_inlining/Test::init@26 + IL_0007: ldc.i4.2 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld int32[] Lambda_inlining/Test::_svalues + IL_0016: stloc.1 + IL_0017: ldloc.1 + IL_0018: newobj instance void Lambda_inlining/thisIsNotInlined3@36::.ctor(int32[]) + IL_001d: stloc.0 + IL_001e: ldc.i4.0 + IL_001f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0024: stloc.2 + IL_0025: ldloc.0 + IL_0026: ldloc.2 + IL_0027: newobj instance void Lambda_inlining/'thisIsNotInlined3@36-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0031: pop + IL_0032: ldloc.2 + IL_0033: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0038: ret + } + + .method assembly hidebysig instance int32 + 'array'(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_000a + + IL_0006: ldloc.1 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: stloc.1 + IL_000a: ldloc.1 + IL_000b: ldarg.1 + IL_000c: ldlen + IL_000d: conv.i4 + IL_000e: bge.s IL_001f + + IL_0010: ldarg.1 + IL_0011: ldloc.1 + IL_0012: ldelem [runtime]System.Int32 + IL_0017: stloc.2 + IL_0018: ldloc.0 + IL_0019: ldloc.2 + IL_001a: add + IL_001b: stloc.0 + IL_001c: ldc.i4.1 + IL_001d: br.s IL_0020 + + IL_001f: ldc.i4.0 + IL_0020: brtrue.s IL_0006 + + IL_0022: ldloc.1 + IL_0023: ldarg.1 + IL_0024: ldlen + IL_0025: conv.i4 + IL_0026: ceq + IL_0028: pop + IL_0029: ldloc.0 + IL_002a: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Lambda_inlining$fsx::init@ + IL_0006: ldsfld int32 ''.$Lambda_inlining$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined2@35 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined2@35-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined3@36 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined3@36-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + + .method public static bool ofArray(!!a[] vs, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param [2] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldlen + IL_000b: conv.i4 + IL_000c: bge.s IL_001d + + IL_000e: ldarg.1 + IL_000f: ldarg.0 + IL_0010: ldloc.0 + IL_0011: ldelem !!a + IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001b: br.s IL_001e + + IL_001d: ldc.i4.0 + IL_001e: brtrue.s IL_0004 + + IL_0020: ldloc.0 + IL_0021: ldarg.0 + IL_0022: ldlen + IL_0023: conv.i4 + IL_0024: ceq + IL_0026: ret + } + + .method public static !!a fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a z, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> ps) 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 ) + .param [1] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) + .param [3] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) + IL_0000: ldarg.1 + IL_0001: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: ldarg.0 + IL_0009: ldloc.0 + IL_000a: newobj instance void class Lambda_inlining/fold@14::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_000f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0014: pop + IL_0015: ldloc.0 + IL_0016: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_001b: ret + } + + .method public specialname static int32[] + get_values() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32[] ''.$Lambda_inlining$fsx::values@17 + IL_0005: ret + } + + .method public static int32 thisIsInlined1() cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_000a + + IL_0006: ldloc.1 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: stloc.1 + IL_000a: ldloc.1 + IL_000b: call int32[] Lambda_inlining::get_values() + IL_0010: ldlen + IL_0011: conv.i4 + IL_0012: bge.s IL_0027 + + IL_0014: call int32[] Lambda_inlining::get_values() + IL_0019: ldloc.1 + IL_001a: ldelem [runtime]System.Int32 + IL_001f: stloc.2 + IL_0020: ldloc.0 + IL_0021: ldloc.2 + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldc.i4.1 + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0006 + + IL_002a: ldloc.1 + IL_002b: call int32[] Lambda_inlining::get_values() + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: ceq + IL_0034: pop + IL_0035: ldloc.0 + IL_0036: ret + } + + .method public static int32 thisIsInlined2() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + int32 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.0 + IL_0017: ldc.i4.0 + IL_0018: stloc.1 + IL_0019: ldc.i4.0 + IL_001a: stloc.2 + IL_001b: br.s IL_0021 + + IL_001d: ldloc.2 + IL_001e: ldc.i4.1 + IL_001f: add + IL_0020: stloc.2 + IL_0021: ldloc.2 + IL_0022: ldloc.0 + IL_0023: ldlen + IL_0024: conv.i4 + IL_0025: bge.s IL_0036 + + IL_0027: ldloc.0 + IL_0028: ldloc.2 + IL_0029: ldelem [runtime]System.Int32 + IL_002e: stloc.3 + IL_002f: ldloc.1 + IL_0030: ldloc.3 + IL_0031: add + IL_0032: stloc.1 + IL_0033: ldc.i4.1 + IL_0034: br.s IL_0037 + + IL_0036: ldc.i4.0 + IL_0037: brtrue.s IL_001d + + IL_0039: ldloc.2 + IL_003a: ldloc.0 + IL_003b: ldlen + IL_003c: conv.i4 + IL_003d: ceq + IL_003f: pop + IL_0040: ldloc.1 + IL_0041: ret + } + + .method public static int32 thisIsNotInlined1() cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, + int32[] V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.1 + IL_0017: ldloc.1 + IL_0018: newobj instance void Lambda_inlining/thisIsNotInlined1@24::.ctor(int32[]) + IL_001d: stloc.0 + IL_001e: ldc.i4.0 + IL_001f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0024: stloc.2 + IL_0025: ldloc.0 + IL_0026: ldloc.2 + IL_0027: newobj instance void Lambda_inlining/'thisIsNotInlined1@24-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0031: pop + IL_0032: ldloc.2 + IL_0033: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0038: ret + } + + .property int32[] values() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get int32[] Lambda_inlining::get_values() + } +} + +.class private abstract auto ansi sealed ''.$Lambda_inlining$fsx + extends [runtime]System.Object +{ + .field static assembly initonly int32[] values@17 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stsfld int32[] ''.$Lambda_inlining$fsx::values@17 + IL_001b: ldc.i4.0 + IL_001c: ldc.i4.1 + IL_001d: ldc.i4 0x2710 + IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0027: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_002c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0031: stsfld int32[] Lambda_inlining/Test::_svalues + IL_0036: ldc.i4.2 + IL_0037: volatile. + IL_0039: stsfld int32 Lambda_inlining/Test::init@26 + IL_003e: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx new file mode 100644 index 00000000000..34398d16cce --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx @@ -0,0 +1,24 @@ +// +// { "optimization": { "reported_in": "#8983", "reported_by": "@NinoFloris", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// + +let inline mapOption mapper option = + match option with + | Some x -> Some(mapper x) + | None -> None + +let almostErasedOption() = + let y () = 3 + + match Some(y()) |> mapOption (fun x -> x + 2) with + | Some x -> 5 + | None -> 4 + +let unnecessaryOption() = + let y () = 3 + + match Some(y()) |> mapOption (fun x -> x + 2) with + | Some x -> x + | None -> 4 + +System.Console.WriteLine() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl new file mode 100644 index 00000000000..41b4918dc17 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl @@ -0,0 +1,133 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Option_elision_non_constant_result + extends [runtime]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 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 + mapOption(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapper, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 option) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, + !!a V_1) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_0005 + + IL_0003: br.s IL_001b + + IL_0005: ldarg.1 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() + IL_000d: stloc.1 + IL_000e: ldarg.0 + IL_000f: ldloc.1 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_001a: ret + + IL_001b: ldnull + IL_001c: ret + } + + .method public static int32 almostErasedOption() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.5 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0006: brtrue.s IL_000a + + IL_0008: br.s IL_000c + + IL_000a: ldc.i4.5 + IL_000b: ret + + IL_000c: ldc.i4.4 + IL_000d: ret + } + + .method public static int32 unnecessaryOption() cil managed + { + + .maxstack 3 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0) + IL_0000: ldc.i4.5 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brtrue.s IL_000c + + IL_000a: br.s IL_0013 + + IL_000c: ldloc.0 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() + IL_0012: ret + + IL_0013: ldc.i4.4 + IL_0014: ret + } + +} + +.class private abstract auto ansi sealed ''.$Option_elision_non_constant_result$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx new file mode 100644 index 00000000000..5fcf9685e08 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx @@ -0,0 +1,30 @@ +// +// { "optimization": { "reported_in": "#6329", "reported_by": "@NinoFloris", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +open System.Runtime.CompilerServices + +type LoggerLevel = A = 0 | B = 1 + +type Logger() = + let messages = System.Collections.Generic.List(10000); + + [] + let nop () = () + member this.Log(level : LoggerLevel, msg : string) = + messages.Add(msg) + nop() + + member this.Log(level : LoggerLevel, obj : 'a) = + messages.Add(obj.ToString()) + nop() + +type TailLogger() = + let messages = System.Collections.Generic.List(10000); + + member this.Log(level : LoggerLevel, msg : string) = + messages.Add(msg) + + member this.Log(level : LoggerLevel, obj : 'a) = + messages.Add(obj.ToString()) + +System.Console.WriteLine() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl new file mode 100644 index 00000000000..0294f07b88f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl @@ -0,0 +1,203 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 8:0:0:0 +} +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Spurious_tail + extends [runtime]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 ) + .class auto ansi serializable sealed nested public LoggerLevel + extends [runtime]System.Enum + { + .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 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype Spurious_tail/LoggerLevel A = int32(0x00000000) + .field public static literal valuetype Spurious_tail/LoggerLevel B = int32(0x00000001) + } + + .class auto ansi serializable nested public Logger + extends [runtime]System.Object + { + .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 ) + .field assembly class [System.Collections]System.Collections.Generic.List`1 messages + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4 0x2710 + IL_000e: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(int32) + IL_0013: stfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0018: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + string msg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0006: ldarg.2 + IL_0007: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_000c: ldarg.0 + IL_000d: callvirt instance void Spurious_tail/Logger::'nop'() + IL_0012: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + !!a obj) cil managed + { + + .maxstack 4 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0006: ldarg.2 + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: constrained. !!a + IL_0010: callvirt instance string [runtime]System.Object::ToString() + IL_0015: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_001a: ldarg.0 + IL_001b: callvirt instance void Spurious_tail/Logger::'nop'() + IL_0020: ret + } + + .method assembly hidebysig instance void + 'nop'() cil managed aggressiveinlining + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ret + } + + } + + .class auto ansi serializable nested public TailLogger + extends [runtime]System.Object + { + .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 ) + .field assembly class [System.Collections]System.Collections.Generic.List`1 messages + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4 0x2710 + IL_000e: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(int32) + IL_0013: stfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0018: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + string msg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0006: ldarg.2 + IL_0007: tail. + IL_0009: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_000e: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + !!a obj) cil managed + { + + .maxstack 4 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0006: ldarg.2 + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: constrained. !!a + IL_0010: callvirt instance string [runtime]System.Object::ToString() + IL_0015: tail. + IL_0017: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_001c: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Spurious_tail$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx new file mode 100644 index 00000000000..c80f4c62e07 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx @@ -0,0 +1,14 @@ +// +// { "optimization": { "reported_in": "#6454", "reported_by": "@auduchinok", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +// [] +type S<'T>(x: 'T[]) = + static let empty = S<'T>(null) + static member Empty = empty + +[] +type S2<'T>(x: 'T[]) = + static let empty = S2<'T>.M() + static member M() = empty + +System.Console.WriteLine() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl new file mode 100644 index 00000000000..b7c232c39a7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl @@ -0,0 +1,357 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Static_init_field + extends [runtime]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 ) + .class auto ansi serializable nested public beforefieldinit S`1 + extends [runtime]System.Object + { + .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 ) + .field static assembly class Static_init_field/S`1 empty + .field static assembly int32 init@5 + .method public specialname rtspecialname + instance void .ctor(!T[] x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: newobj instance void class Static_init_field/S`1::.ctor(!0[]) + IL_0006: stsfld class Static_init_field/S`1 class Static_init_field/S`1::empty + IL_000b: ldc.i4.1 + IL_000c: volatile. + IL_000e: stsfld int32 class Static_init_field/S`1::init@5 + IL_0013: ret + } + + .method public specialname static class Static_init_field/S`1 + get_Empty() cil managed + { + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 class Static_init_field/S`1::init@5 + IL_0007: ldc.i4.1 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld class Static_init_field/S`1 class Static_init_field/S`1::empty + IL_0016: ret + } + + .property class Static_init_field/S`1 + Empty() + { + .get class Static_init_field/S`1 Static_init_field/S`1::get_Empty() + } + } + + .class sequential ansi serializable sealed nested public beforefieldinit S2`1 + extends [runtime]System.ValueType + implements class [runtime]System.IEquatable`1>, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IComparable`1>, + [runtime]System.IComparable, + [runtime]System.Collections.IStructuralComparable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .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 ) + .field static assembly object empty + .field static assembly int32 'init@10-1' + .field assembly !T[] x + .method public hidebysig virtual final + instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0005: ldarg.0 + IL_0006: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000b: ldarga.s obj + IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0012: tail. + IL_0014: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0019: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: unbox.any valuetype Static_init_field/S2`1 + IL_0006: stloc.0 + IL_0007: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_000c: ldarg.0 + IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0012: ldloca.s V_0 + IL_0014: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0019: tail. + IL_001b: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0020: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: unbox.any valuetype Static_init_field/S2`1 + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: ldarg.0 + IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000e: ldloca.s V_0 + IL_0010: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0015: tail. + IL_0017: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_001c: ret + } + + .method public hidebysig virtual final + instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4 0x9e3779b9 + IL_0007: ldarg.1 + IL_0008: ldarg.0 + IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_0013: ldloc.0 + IL_0014: ldc.i4.6 + IL_0015: shl + IL_0016: ldloc.0 + IL_0017: ldc.i4.2 + IL_0018: shr + IL_0019: add + IL_001a: add + IL_001b: add + IL_001c: stloc.0 + IL_001d: ldloc.0 + IL_001e: ret + } + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 valuetype Static_init_field/S2`1::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000b: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: isinst valuetype Static_init_field/S2`1 + IL_0006: brfalse.s IL_0025 + + IL_0008: ldarg.1 + IL_0009: unbox.any valuetype Static_init_field/S2`1 + IL_000e: stloc.0 + IL_000f: ldarg.2 + IL_0010: ldarg.0 + IL_0011: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0016: ldloca.s V_0 + IL_0018: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_001d: tail. + IL_001f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_0024: ret + + IL_0025: ldc.i4.0 + IL_0026: ret + } + + .method public specialname rtspecialname + instance void .ctor(!T[] x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld !0[] valuetype Static_init_field/S2`1::x + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call object valuetype Static_init_field/S2`1::M() + IL_0005: stsfld object valuetype Static_init_field/S2`1::empty + IL_000a: ldc.i4.1 + IL_000b: volatile. + IL_000d: stsfld int32 valuetype Static_init_field/S2`1::'init@10-1' + IL_0012: ret + } + + .method public static object M() cil managed + { + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 valuetype Static_init_field/S2`1::'init@10-1' + IL_0007: ldc.i4.1 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld object valuetype Static_init_field/S2`1::empty + IL_0016: ret + } + + .method public hidebysig virtual final + instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0006: ldarga.s obj + IL_0008: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000d: tail. + IL_000f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, + !!0) + IL_0014: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (valuetype Static_init_field/S2`1 V_0, + valuetype Static_init_field/S2`1 V_1) + IL_0000: ldarg.1 + IL_0001: isinst valuetype Static_init_field/S2`1 + IL_0006: brfalse.s IL_0026 + + IL_0008: ldarg.1 + IL_0009: unbox.any valuetype Static_init_field/S2`1 + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: stloc.1 + IL_0011: ldarg.0 + IL_0012: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0017: ldloca.s V_1 + IL_0019: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_001e: tail. + IL_0020: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, + !!0) + IL_0025: ret + + IL_0026: ldc.i4.0 + IL_0027: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Static_init_field$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx new file mode 100644 index 00000000000..3617e01fb7c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx @@ -0,0 +1,36 @@ +// +// { "optimization": { "reported_in": "#6984", "reported_by": "@teo-tsirpanis", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +let factorialOk1 x = + let rec impl x acc = + if x = 0UL then + acc + else + impl (x - 1UL) (x * acc) + impl x 1UL + +let factorialOk2 x = + let rec impl x acc = + if x = 0UL then + acc + else + impl <|| (x - 1UL, x * acc) + impl x 1UL + +let factorialNotOk1 x = + let rec impl x acc = + if x = 0UL then + acc + else + impl (x - 1UL) <| x * acc + impl x 1UL + +let factorialNotOk2 x = + let rec impl x acc = + if x = 0UL then + acc + else + (impl (x-1UL)) (x * acc) + impl x 1UL + +System.Console.WriteLine() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl new file mode 100644 index 00000000000..7f08989cd53 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl @@ -0,0 +1,300 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Tailcall_last_expression_parens + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@21-3' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Tailcall_last_expression_parens/'impl@21-3' @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: tail. + IL_0004: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, + uint64) + IL_0009: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@21-3'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@29-5' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Tailcall_last_expression_parens/'impl@29-5' @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, + uint64) + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@29-5'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_000a: ret + } + + } + + .method assembly static uint64 impl@5(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.1 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 + } + + .method public static uint64 factorialOk1(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::impl@5(uint64, + uint64) + IL_0008: ret + } + + .method assembly static uint64 'impl@13-1'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.1 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 + } + + .method public static uint64 factorialOk2(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::'impl@13-1'(uint64, + uint64) + IL_0008: ret + } + + .method assembly static uint64 'impl@21-2'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: brtrue.s IL_000b + + IL_0009: ldarg.1 + IL_000a: ret + + IL_000b: ldloc.0 + IL_000c: ldarg.0 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: sub + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_0015: ldarg.0 + IL_0016: ldarg.1 + IL_0017: mul + IL_0018: tail. + IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001f: ret + } + + .method public static uint64 factorialNotOk1(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: tail. + IL_0005: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, + uint64) + IL_000a: ret + } + + .method assembly static uint64 'impl@29-4'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: brtrue.s IL_000b + + IL_0009: ldarg.1 + IL_000a: ret + + IL_000b: ldloc.0 + IL_000c: ldarg.0 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: sub + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_0015: ldarg.0 + IL_0016: ldarg.1 + IL_0017: mul + IL_0018: tail. + IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001f: ret + } + + .method public static uint64 factorialNotOk2(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, + uint64) + IL_0008: ret + } + +} + +.class private abstract auto ansi sealed ''.$Tailcall_last_expression_parens$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx new file mode 100644 index 00000000000..14be757b9dd --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx @@ -0,0 +1,11 @@ +// +// { "optimization": { "reported_in": "#5019", "reported_by": "@rspeele,@ForNever", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// +open System.Collections.Generic +type C() = + member this.M() = + let x = typedefof> + () + + +System.Console.WriteLine() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl new file mode 100644 index 00000000000..8bd78c1214d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl @@ -0,0 +1,117 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 8:0:0:0 +} +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Typedefof + extends [runtime]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 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .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 ) + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig instance void + M() cil managed + { + + .maxstack 3 + .locals init (class [runtime]System.Type V_0, + class [runtime]System.Type V_1) + IL_0000: ldtoken class [System.Collections]System.Collections.Generic.List`1 + IL_0005: call class [netstandard]System.Type [netstandard]System.Type::GetTypeFromHandle(valuetype [netstandard]System.RuntimeTypeHandle) + IL_000a: stloc.1 + IL_000b: ldloc.1 + IL_000c: callvirt instance bool [netstandard]System.Type::get_IsGenericType() + IL_0011: brfalse.s IL_001b + + IL_0013: ldloc.1 + IL_0014: callvirt instance class [netstandard]System.Type [netstandard]System.Type::GetGenericTypeDefinition() + IL_0019: br.s IL_001c + + IL_001b: ldloc.1 + IL_001c: stloc.0 + IL_001d: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Typedefof$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx new file mode 100644 index 00000000000..185cd97fb80 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx @@ -0,0 +1,35 @@ +// +// { "optimization": { "reported_in": "#5291", "reported_by": "@jack-pappas", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// + +open System.Collections.Generic +open OptimizedClosures + +[] +let foldStrong (folder : 'State -> 'T -> 'State) state (enumerator : ('TEnumerator :> IEnumerator<'T>)) : 'State = + let folder = FSharpFunc<_,_,_>.Adapt folder + + let mutable enumerator' = enumerator + let mutable state = state + while enumerator'.MoveNext () do + state <- folder.Invoke (state, enumerator.Current) + state + +[] +let inline fold< ^State, ^T, ^TSeq, ^TEnumerator + when ^TSeq: (member GetEnumerator: unit -> ^TEnumerator) + and ^TEnumerator :> IEnumerator< ^T > > + (folder : ^State -> ^T -> ^State) state (source : ^TSeq) : 'State = + // This 'use' binding causes unnecessary boxing of 'enumerator'. + use enumerator = (^TSeq : (member GetEnumerator: unit -> ^TEnumerator) (source)) + foldStrong folder state enumerator + + +let testFoldOnListT () = + let items = ResizeArray ([| 1; 1; 2; 3; 5; 8 |]) + + ("", items) + ||> fold (fun state x -> + state + string x) + +System.Console.WriteLine(testFoldOnListT()) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.err.bsl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.bsl new file mode 100644 index 00000000000..94e19be70c3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.bsl @@ -0,0 +1,347 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 8:0:0:0 +} +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Use_binding_on_struct_enumerator + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit testFoldOnListT@32 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance string + Invoke(string state, + int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: box [runtime]System.Int32 + IL_0007: unbox.any [runtime]System.IFormattable + IL_000c: ldnull + IL_000d: call class [netstandard]System.Globalization.CultureInfo [netstandard]System.Globalization.CultureInfo::get_InvariantCulture() + IL_0012: callvirt instance string [netstandard]System.IFormattable::ToString(string, + class [netstandard]System.IFormatProvider) + IL_0017: call string [runtime]System.String::Concat(string, + string) + IL_001c: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Use_binding_on_struct_enumerator/testFoldOnListT@32::.ctor() + IL_0005: stsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_000a: ret + } + + } + + .field static assembly valuetype ''/T71288_24Bytes@ field71289@ at I_00003991 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TEnumerator enumerator) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 0A 66 6F 6C 64 53 74 72 6F 6E 67 00 00 ) + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + !!TEnumerator V_1, + !!State V_2, + !!TEnumerator V_3) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: stloc.1 + IL_0009: ldarg.1 + IL_000a: stloc.2 + IL_000b: br.s IL_0024 + + IL_000d: ldloc.0 + IL_000e: ldloc.2 + IL_000f: ldarg.2 + IL_0010: stloc.3 + IL_0011: ldloca.s V_3 + IL_0013: constrained. !!TEnumerator + IL_0019: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_001e: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0023: stloc.2 + IL_0024: ldloca.s V_1 + IL_0026: constrained. !!TEnumerator + IL_002c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0031: brtrue.s IL_000d + + IL_0033: ldloc.2 + IL_0034: ret + } + + .method public static !!State Fold) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: brfalse.s IL_000b + + IL_0003: ldnull + IL_0004: unbox.any !!TEnumerator + IL_0009: br.s IL_0016 + + IL_000b: ldstr "Dynamic invocation of GetEnumerator is not supported" + IL_0010: newobj instance void [runtime]System.NotSupportedException::.ctor(string) + IL_0015: throw + + IL_0016: stloc.0 + .try + { + IL_0017: ldarg.0 + IL_0018: ldarg.1 + IL_0019: ldloc.0 + IL_001a: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_001f: stloc.1 + IL_0020: leave.s IL_0039 + + } + finally + { + IL_0022: ldloc.0 + IL_0023: box !!TEnumerator + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.2 + IL_002e: ldloc.2 + IL_002f: brfalse.s IL_0038 + + IL_0031: ldloc.2 + IL_0032: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0037: endfinally + IL_0038: endfinally + } + IL_0039: ldloc.1 + IL_003a: ret + } + + .method public static !!State Fold$W) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 getEnumerator, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldarg.0 + IL_0001: ldarg.3 + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + .try + { + IL_0008: ldarg.1 + IL_0009: ldarg.2 + IL_000a: ldloc.0 + IL_000b: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0010: stloc.1 + IL_0011: leave.s IL_002a + + } + finally + { + IL_0013: ldloc.0 + IL_0014: box !!TEnumerator + IL_0019: isinst [runtime]System.IDisposable + IL_001e: stloc.2 + IL_001f: ldloc.2 + IL_0020: brfalse.s IL_0029 + + IL_0022: ldloc.2 + IL_0023: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0028: endfinally + IL_0029: endfinally + } + IL_002a: ldloc.1 + IL_002b: ret + } + + .method public static string testFoldOnListT() cil managed + { + + .maxstack 5 + .locals init (class [System.Collections]System.Collections.Generic.List`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_1, + valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator V_2, + string V_3, + class [runtime]System.IDisposable V_4) + IL_0000: ldc.i4.6 + IL_0001: newarr [runtime]System.Int32 + IL_0006: dup + IL_0007: ldtoken field valuetype ''/T71288_24Bytes@ Use_binding_on_struct_enumerator::field71289@ + IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, + valuetype [runtime]System.RuntimeFieldHandle) + IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.0 + IL_0017: ldsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_001c: stloc.1 + IL_001d: ldloc.0 + IL_001e: callvirt instance valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator class [System.Collections]System.Collections.Generic.List`1::GetEnumerator() + IL_0023: stloc.2 + .try + { + IL_0024: ldloc.1 + IL_0025: ldstr "" + IL_002a: ldloc.2 + IL_002b: call !!0 Use_binding_on_struct_enumerator::FoldStrong>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0030: stloc.3 + IL_0031: leave.s IL_004d + + } + finally + { + IL_0033: ldloc.2 + IL_0034: box valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator + IL_0039: isinst [runtime]System.IDisposable + IL_003e: stloc.s V_4 + IL_0040: ldloc.s V_4 + IL_0042: brfalse.s IL_004c + + IL_0044: ldloc.s V_4 + IL_0046: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_004b: endfinally + IL_004c: endfinally + } + IL_004d: ldloc.3 + IL_004e: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_0006: ldsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_000b: pop + IL_000c: ret + } + +} + +.class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + +} + +.class private abstract auto ansi sealed beforefieldinit '' + extends [runtime]System.Object +{ + .class explicit ansi sealed nested assembly beforefieldinit T71288_24Bytes@ + extends [runtime]System.ValueType + { + .pack 0 + .size 24 + } + +} + + + + +.data cil I_00003991 = bytearray ( + 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 + 05 00 00 00 08 00 00 00) + diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 4f04946a466..08a1506f0fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -175,9 +175,11 @@ - + + + diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index a97b214acde..dce93956c4a 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -315,8 +315,11 @@ module rec CompilerAssertHelpers = // lookup the last static constructor // of the assembly types, which should match // the equivalent of a .fsx entry point - let moduleInitType = asm.GetTypes() |> Array.last - moduleInitType.GetConstructors(BindingFlags.Static ||| BindingFlags.NonPublic).[0] :> MethodBase + let startupcodeType = asm.GetTypes() |> Array.tryFindBack (fun m -> m.Name.StartsWith "$" && m.Name.EndsWith "$fsx") + match startupcodeType with + | None -> failwith $"unable to find startup code in script {asm.Location}" + | Some moduleInitType -> + moduleInitType.GetConstructors(BindingFlags.Static ||| BindingFlags.NonPublic).[0] :> MethodBase else entryPoint let args = mkDefaultArgs entryPoint From 630153a675dc035619ace2847ae723024d7c194b Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Fri, 24 Nov 2023 23:26:57 +0100 Subject: [PATCH 02/13] baselines should be split for debug & release (and maybe net472 / netcore) --- ...unction_no_alloc.fsx.il.netcore.debug.bsl} | 0 ...nction_no_alloc.fsx.il.netcore.release.bsl | 194 ++++ ..._same_expression.fsx.il.netcore.debug.bsl} | 0 ...same_expression.fsx.il.netcore.release.bsl | 172 ++++ ...loop_custom_step.fsx.il.netcore.debug.bsl} | 0 ...oop_custom_step.fsx.il.netcore.release.bsl | 113 +++ ...for_loop_non_int.fsx.il.netcore.debug.bsl} | 0 ...or_loop_non_int.fsx.il.netcore.release.bsl | 154 +++ ..._bool_expression.fsx.il.netcore.debug.bsl} | 0 ...bool_expression.fsx.il.netcore.release.bsl | 115 +++ ...ace_array_update.fsx.il.netcore.debug.bsl} | 0 ...ce_array_update.fsx.il.netcore.release.bsl | 296 ++++++ ... lambda_inlining.fsx.il.netcore.debug.bsl} | 0 ...lambda_inlining.fsx.il.netcore.release.bsl | 884 ++++++++++++++++++ ..._constant_result.fsx.il.netcore.debug.bsl} | 0 ...constant_result.fsx.il.netcore.release.bsl | 133 +++ ...=> spurious_tail.fsx.il.netcore.debug.bsl} | 0 .../spurious_tail.fsx.il.netcore.release.bsl | 203 ++++ ...tatic_init_field.fsx.il.netcore.debug.bsl} | 0 ...atic_init_field.fsx.il.netcore.release.bsl | 357 +++++++ ...xpression_parens.fsx.il.netcore.debug.bsl} | 0 ...pression_parens.fsx.il.netcore.release.bsl | 300 ++++++ ...bsl => typedefof.fsx.il.netcore.debug.bsl} | 0 .../typedefof.fsx.il.netcore.release.bsl | 117 +++ ...truct_enumerator.fsx.il.netcore.debug.bsl} | 8 +- ...ruct_enumerator.fsx.il.netcore.release.bsl | 347 +++++++ 26 files changed, 3389 insertions(+), 4 deletions(-) rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{array_of_function_no_alloc.fsx.il.bsl => array_of_function_no_alloc.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{du_for_same_expression.fsx.il.bsl => du_for_same_expression.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{for_loop_custom_step.fsx.il.bsl => for_loop_custom_step.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{for_loop_non_int.fsx.il.bsl => for_loop_non_int.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{if_then_else_bool_expression.fsx.il.bsl => if_then_else_bool_expression.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{inplace_array_update.fsx.il.bsl => inplace_array_update.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{lambda_inlining.fsx.il.bsl => lambda_inlining.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{option_elision_non_constant_result.fsx.il.bsl => option_elision_non_constant_result.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{spurious_tail.fsx.il.bsl => spurious_tail.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{static_init_field.fsx.il.bsl => static_init_field.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{tailcall_last_expression_parens.fsx.il.bsl => tailcall_last_expression_parens.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{typedefof.fsx.il.bsl => typedefof.fsx.il.netcore.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{use_binding_on_struct_enumerator.fsx.il.bsl => use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl} (98%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..ad36e15d2d8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl @@ -0,0 +1,194 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Array_of_function_no_alloc + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit runAll@9 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field static assembly initonly class Array_of_function_no_alloc/runAll@9 @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] source, + int32 index) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Array_of_function_no_alloc/runAll@9::.ctor() + IL_0005: stsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance + IL_000a: ret + } + + } + + .method public static int32 exampleFunc(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.2 + IL_0002: add + IL_0003: ret + } + + .method public static int32 runAll(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, + int32 x) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_001a + + IL_0006: ldloc.0 + IL_0007: ldsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance + IL_000c: ldarg.0 + IL_000d: ldloc.1 + IL_000e: ldarg.1 + IL_000f: call !!1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[],int32>::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>, + !0, + !1, + !!0) + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.1 + IL_001a: ldloc.1 + IL_001b: ldarg.0 + IL_001c: ldlen + IL_001d: conv.i4 + IL_001e: blt.s IL_0006 + + IL_0020: ldloc.0 + IL_0021: ret + } + + .method public static int32 runAllNoAlloc(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, + int32 x) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_001c + + IL_0006: ldarg.0 + IL_0007: ldloc.1 + IL_0008: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + IL_000d: stloc.2 + IL_000e: ldloc.0 + IL_000f: ldloc.2 + IL_0010: ldarg.1 + IL_0011: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.1 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: stloc.1 + IL_001c: ldloc.1 + IL_001d: ldarg.0 + IL_001e: ldlen + IL_001f: conv.i4 + IL_0020: blt.s IL_0006 + + IL_0022: ldloc.0 + IL_0023: ret + } + +} + +.class private abstract auto ansi sealed ''.$Array_of_function_no_alloc$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..855944f3085 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl @@ -0,0 +1,172 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Du_for_same_expression + extends [runtime]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 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + map(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapping, + valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 result) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (!!c V_0, + !!a V_1) + IL_0000: ldarga.s result + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_001b + + IL_000c: ldarga.s result + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_001a: ret + + IL_001b: ldarga.s result + IL_001d: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0022: stloc.1 + IL_0023: ldarg.0 + IL_0024: ldloc.1 + IL_0025: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_002a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_002f: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1) + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: constrained. !!a + IL_002b: callvirt instance string [runtime]System.Object::ToString() + IL_0030: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0035: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 8 + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0025: ret + } + +} + +.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 3 + IL_0000: ldstr "" + IL_0005: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_000a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_000f: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0014: call void [runtime]System.Console::WriteLine(object) + IL_0019: ldstr "" + IL_001e: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0023: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0028: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_002d: call void [runtime]System.Console::WriteLine(object) + IL_0032: ldstr "" + IL_0037: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_003c: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0041: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0046: call void [runtime]System.Console::WriteLine(object) + IL_004b: ldstr "" + IL_0050: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0055: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_005a: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_005f: call void [runtime]System.Console::WriteLine(object) + IL_0064: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..841f1df59c1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl @@ -0,0 +1,113 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed For_loop_custom_step + extends [runtime]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 g() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.2 + IL_0002: ldc.i4.s 15 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0009: stloc.0 + IL_000a: ldloc.0 + IL_000b: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0010: stloc.1 + .try + { + IL_0011: br.s IL_001e + + IL_0013: ldloc.1 + IL_0014: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0019: call void [runtime]System.Console::WriteLine(int32) + IL_001e: ldloc.1 + IL_001f: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0024: brtrue.s IL_0013 + + IL_0026: leave.s IL_003a + + } + finally + { + IL_0028: ldloc.1 + IL_0029: isinst [runtime]System.IDisposable + IL_002e: stloc.2 + IL_002f: ldloc.2 + IL_0030: brfalse.s IL_0039 + + IL_0032: ldloc.2 + IL_0033: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0038: endfinally + IL_0039: endfinally + } + IL_003a: ret + } + +} + +.class private abstract auto ansi sealed ''.$For_loop_custom_step$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_custom_step::g() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..95b1ecd4a27 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl @@ -0,0 +1,154 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed For_loop_non_int + extends [runtime]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 assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 + get_inputSequence@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0005: ret + } + + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 + get_enumerator@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_0005: ret + } + + .property class [runtime]System.Collections.Generic.IEnumerable`1 + inputSequence@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + } + .property class [runtime]System.Collections.Generic.IEnumerator`1 + enumerator@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + } +} + +.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx + extends [runtime]System.Object +{ + .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 5 + .locals init (int64 V_0, + class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 100 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + IL_0016: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + .try + { + IL_0020: br.s IL_0044 + + IL_0022: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0027: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_002c: stloc.0 + IL_002d: ldstr "hello" + IL_0032: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_0037: stloc.1 + IL_0038: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() + IL_003d: ldloc.1 + IL_003e: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter(class [runtime]System.IO.TextWriter, + class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_0043: pop + IL_0044: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0049: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_004e: brtrue.s IL_0022 + + IL_0050: leave.s IL_0068 + + } + finally + { + IL_0052: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0057: isinst [runtime]System.IDisposable + IL_005c: stloc.2 + IL_005d: ldloc.2 + IL_005e: brfalse.s IL_0067 + + IL_0060: ldloc.2 + IL_0061: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0066: endfinally + IL_0067: endfinally + } + IL_0068: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..754fdd99e8c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl @@ -0,0 +1,115 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed If_then_else_bool_expression + extends [runtime]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 bool foo(bool a, + bool b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0005 + + IL_0003: ldc.i4.0 + IL_0004: ret + + IL_0005: ldarg.1 + IL_0006: brfalse.s IL_000a + + IL_0008: ldc.i4.0 + IL_0009: ret + + IL_000a: ldc.i4.1 + IL_000b: ret + } + + .method public static bool bar(bool a, + bool b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0008 + + IL_0003: ldarg.1 + IL_0004: ldc.i4.0 + IL_0005: ceq + IL_0007: ret + + IL_0008: ldc.i4.0 + IL_0009: ret + } + +} + +.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: call bool If_then_else_bool_expression::foo(bool, + bool) + IL_0007: call void [runtime]System.Console::WriteLine(bool) + IL_000c: ldc.i4.1 + IL_000d: ldc.i4.0 + IL_000e: call bool If_then_else_bool_expression::bar(bool, + bool) + IL_0013: call void [runtime]System.Console::WriteLine(bool) + IL_0018: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..01bd5b94704 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl @@ -0,0 +1,296 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Inplace_array_update + extends [runtime]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 ) + .class abstract auto ansi sealed nested public Foo + extends [runtime]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 !!a[] bar(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: tail. + IL_0005: call !!2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Map2(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0[], + !!1[]) + IL_000a: ret + } + + .method public static void barInPlace(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0023 + + IL_0004: ldarg.2 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: ldloc.0 + IL_0009: ldelem !!a + IL_000e: ldarg.2 + IL_000f: ldloc.0 + IL_0010: ldelem !!a + IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001a: stelem !!a + IL_001f: ldloc.0 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.0 + IL_0023: ldloc.0 + IL_0024: ldarg.2 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_0004 + + IL_0029: ret + } + + .method public static void barInPlaceInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0023 + + IL_0004: ldarg.2 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: ldloc.0 + IL_0009: ldelem !!a + IL_000e: ldarg.2 + IL_000f: ldloc.0 + IL_0010: ldelem !!a + IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001a: stelem !!a + IL_001f: ldloc.0 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.0 + IL_0023: ldloc.0 + IL_0024: ldarg.2 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_0004 + + IL_0029: ret + } + + .method public static void barInPlaceOptClosure(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldc.i4.0 + IL_0008: stloc.1 + IL_0009: br.s IL_002a + + IL_000b: ldarg.2 + IL_000c: ldloc.1 + IL_000d: ldloc.0 + IL_000e: ldarg.1 + IL_000f: ldloc.1 + IL_0010: ldelem !!a + IL_0015: ldarg.2 + IL_0016: ldloc.1 + IL_0017: ldelem !!a + IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0021: stelem !!a + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldarg.2 + IL_002c: ldlen + IL_002d: conv.i4 + IL_002e: blt.s IL_000b + + IL_0030: ret + } + + .method public static void barInPlaceOptClosureInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldc.i4.0 + IL_0008: stloc.1 + IL_0009: br.s IL_002a + + IL_000b: ldarg.2 + IL_000c: ldloc.1 + IL_000d: ldloc.0 + IL_000e: ldarg.1 + IL_000f: ldloc.1 + IL_0010: ldelem !!a + IL_0015: ldarg.2 + IL_0016: ldloc.1 + IL_0017: ldelem !!a + IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0021: stelem !!a + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldarg.2 + IL_002c: ldlen + IL_002d: conv.i4 + IL_002e: blt.s IL_000b + + IL_0030: ret + } + + .method public static void barFunInside(float32[] a, + float32[] b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + float32 V_1, + float32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_002e + + IL_0004: ldarg.1 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldloc.0 + IL_0008: ldelem [runtime]System.Single + IL_000d: stloc.1 + IL_000e: ldarg.1 + IL_000f: ldloc.0 + IL_0010: ldelem [runtime]System.Single + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.r4 0.69999999 + IL_001c: mul + IL_001d: ldloc.2 + IL_001e: ldc.r4 0.30000001 + IL_0023: mul + IL_0024: add + IL_0025: stelem [runtime]System.Single + IL_002a: ldloc.0 + IL_002b: ldc.i4.1 + IL_002c: add + IL_002d: stloc.0 + IL_002e: ldloc.0 + IL_002f: ldarg.1 + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: blt.s IL_0004 + + IL_0034: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Inplace_array_update$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..a005329849e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl @@ -0,0 +1,884 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Lambda_inlining + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit fold@14 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> class Lambda_inlining/fold@14::f + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s + IL_0014: ret + } + + .method public strict virtual instance bool + Invoke(!b v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> class Lambda_inlining/fold@14::f + IL_000c: ldarg.0 + IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s + IL_0012: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0017: ldarg.1 + IL_0018: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001d: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0022: ldc.i4.1 + IL_0023: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined1@24 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined1@24-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + + .class auto ansi serializable nested public Test + extends [runtime]System.Object + { + .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 ) + .field assembly int32[] _values + .field static assembly int32[] _svalues + .field static assembly int32 init@26 + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4.0 + IL_000a: ldc.i4.1 + IL_000b: ldc.i4 0x2710 + IL_0010: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0015: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_001a: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_001f: stfld int32[] Lambda_inlining/Test::_values + IL_0024: ret + } + + .method public hidebysig instance int32 + thisIsInlined2() cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_000a + + IL_0006: ldloc.1 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: stloc.1 + IL_000a: ldloc.1 + IL_000b: call int32[] Lambda_inlining::get_values() + IL_0010: ldlen + IL_0011: conv.i4 + IL_0012: bge.s IL_0027 + + IL_0014: call int32[] Lambda_inlining::get_values() + IL_0019: ldloc.1 + IL_001a: ldelem [runtime]System.Int32 + IL_001f: stloc.2 + IL_0020: ldloc.0 + IL_0021: ldloc.2 + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldc.i4.1 + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0006 + + IL_002a: ldloc.1 + IL_002b: call int32[] Lambda_inlining::get_values() + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: ceq + IL_0034: pop + IL_0035: ldloc.0 + IL_0036: ret + } + + .method public hidebysig instance int32 + thisIsInlined3() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: ldfld int32[] Lambda_inlining/Test::_values + IL_0007: callvirt instance int32 Lambda_inlining/Test::'array'(int32[]) + IL_000c: ret + } + + .method public hidebysig instance int32 + thisIsNotInlined2() cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, + int32[] V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) + IL_0000: ldarg.0 + IL_0001: ldfld int32[] Lambda_inlining/Test::_values + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: newobj instance void Lambda_inlining/thisIsNotInlined2@35::.ctor(int32[]) + IL_000d: stloc.0 + IL_000e: ldc.i4.0 + IL_000f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0014: stloc.2 + IL_0015: ldloc.0 + IL_0016: ldloc.2 + IL_0017: newobj instance void Lambda_inlining/'thisIsNotInlined2@35-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0021: pop + IL_0022: ldloc.2 + IL_0023: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0028: ret + } + + .method public hidebysig instance int32 + thisIsNotInlined3() cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, + int32[] V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) + IL_0000: volatile. + IL_0002: ldsfld int32 Lambda_inlining/Test::init@26 + IL_0007: ldc.i4.2 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld int32[] Lambda_inlining/Test::_svalues + IL_0016: stloc.1 + IL_0017: ldloc.1 + IL_0018: newobj instance void Lambda_inlining/thisIsNotInlined3@36::.ctor(int32[]) + IL_001d: stloc.0 + IL_001e: ldc.i4.0 + IL_001f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0024: stloc.2 + IL_0025: ldloc.0 + IL_0026: ldloc.2 + IL_0027: newobj instance void Lambda_inlining/'thisIsNotInlined3@36-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0031: pop + IL_0032: ldloc.2 + IL_0033: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0038: ret + } + + .method assembly hidebysig instance int32 + 'array'(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_000a + + IL_0006: ldloc.1 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: stloc.1 + IL_000a: ldloc.1 + IL_000b: ldarg.1 + IL_000c: ldlen + IL_000d: conv.i4 + IL_000e: bge.s IL_001f + + IL_0010: ldarg.1 + IL_0011: ldloc.1 + IL_0012: ldelem [runtime]System.Int32 + IL_0017: stloc.2 + IL_0018: ldloc.0 + IL_0019: ldloc.2 + IL_001a: add + IL_001b: stloc.0 + IL_001c: ldc.i4.1 + IL_001d: br.s IL_0020 + + IL_001f: ldc.i4.0 + IL_0020: brtrue.s IL_0006 + + IL_0022: ldloc.1 + IL_0023: ldarg.1 + IL_0024: ldlen + IL_0025: conv.i4 + IL_0026: ceq + IL_0028: pop + IL_0029: ldloc.0 + IL_002a: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Lambda_inlining$fsx::init@ + IL_0006: ldsfld int32 ''.$Lambda_inlining$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined2@35 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined2@35-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined3@36 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined3@36-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool + Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + + .method public static bool ofArray(!!a[] vs, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + .param [2] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldlen + IL_000b: conv.i4 + IL_000c: bge.s IL_001d + + IL_000e: ldarg.1 + IL_000f: ldarg.0 + IL_0010: ldloc.0 + IL_0011: ldelem !!a + IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001b: br.s IL_001e + + IL_001d: ldc.i4.0 + IL_001e: brtrue.s IL_0004 + + IL_0020: ldloc.0 + IL_0021: ldarg.0 + IL_0022: ldlen + IL_0023: conv.i4 + IL_0024: ceq + IL_0026: ret + } + + .method public static !!a fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a z, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> ps) 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 ) + .param [1] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) + .param [3] + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) + IL_0000: ldarg.1 + IL_0001: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: ldarg.0 + IL_0009: ldloc.0 + IL_000a: newobj instance void class Lambda_inlining/fold@14::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_000f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0014: pop + IL_0015: ldloc.0 + IL_0016: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_001b: ret + } + + .method public specialname static int32[] + get_values() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32[] ''.$Lambda_inlining$fsx::values@17 + IL_0005: ret + } + + .method public static int32 thisIsInlined1() cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_000a + + IL_0006: ldloc.1 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: stloc.1 + IL_000a: ldloc.1 + IL_000b: call int32[] Lambda_inlining::get_values() + IL_0010: ldlen + IL_0011: conv.i4 + IL_0012: bge.s IL_0027 + + IL_0014: call int32[] Lambda_inlining::get_values() + IL_0019: ldloc.1 + IL_001a: ldelem [runtime]System.Int32 + IL_001f: stloc.2 + IL_0020: ldloc.0 + IL_0021: ldloc.2 + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldc.i4.1 + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0006 + + IL_002a: ldloc.1 + IL_002b: call int32[] Lambda_inlining::get_values() + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: ceq + IL_0034: pop + IL_0035: ldloc.0 + IL_0036: ret + } + + .method public static int32 thisIsInlined2() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + int32 V_1, + int32 V_2, + int32 V_3) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.0 + IL_0017: ldc.i4.0 + IL_0018: stloc.1 + IL_0019: ldc.i4.0 + IL_001a: stloc.2 + IL_001b: br.s IL_0021 + + IL_001d: ldloc.2 + IL_001e: ldc.i4.1 + IL_001f: add + IL_0020: stloc.2 + IL_0021: ldloc.2 + IL_0022: ldloc.0 + IL_0023: ldlen + IL_0024: conv.i4 + IL_0025: bge.s IL_0036 + + IL_0027: ldloc.0 + IL_0028: ldloc.2 + IL_0029: ldelem [runtime]System.Int32 + IL_002e: stloc.3 + IL_002f: ldloc.1 + IL_0030: ldloc.3 + IL_0031: add + IL_0032: stloc.1 + IL_0033: ldc.i4.1 + IL_0034: br.s IL_0037 + + IL_0036: ldc.i4.0 + IL_0037: brtrue.s IL_001d + + IL_0039: ldloc.2 + IL_003a: ldloc.0 + IL_003b: ldlen + IL_003c: conv.i4 + IL_003d: ceq + IL_003f: pop + IL_0040: ldloc.1 + IL_0041: ret + } + + .method public static int32 thisIsNotInlined1() cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, + int32[] V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.1 + IL_0017: ldloc.1 + IL_0018: newobj instance void Lambda_inlining/thisIsNotInlined1@24::.ctor(int32[]) + IL_001d: stloc.0 + IL_001e: ldc.i4.0 + IL_001f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0024: stloc.2 + IL_0025: ldloc.0 + IL_0026: ldloc.2 + IL_0027: newobj instance void Lambda_inlining/'thisIsNotInlined1@24-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) + IL_0031: pop + IL_0032: ldloc.2 + IL_0033: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0038: ret + } + + .property int32[] values() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get int32[] Lambda_inlining::get_values() + } +} + +.class private abstract auto ansi sealed ''.$Lambda_inlining$fsx + extends [runtime]System.Object +{ + .field static assembly initonly int32[] values@17 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stsfld int32[] ''.$Lambda_inlining$fsx::values@17 + IL_001b: ldc.i4.0 + IL_001c: ldc.i4.1 + IL_001d: ldc.i4 0x2710 + IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0027: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_002c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0031: stsfld int32[] Lambda_inlining/Test::_svalues + IL_0036: ldc.i4.2 + IL_0037: volatile. + IL_0039: stsfld int32 Lambda_inlining/Test::init@26 + IL_003e: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..41b4918dc17 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl @@ -0,0 +1,133 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Option_elision_non_constant_result + extends [runtime]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 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 + mapOption(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapper, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 option) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, + !!a V_1) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_0005 + + IL_0003: br.s IL_001b + + IL_0005: ldarg.1 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() + IL_000d: stloc.1 + IL_000e: ldarg.0 + IL_000f: ldloc.1 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_001a: ret + + IL_001b: ldnull + IL_001c: ret + } + + .method public static int32 almostErasedOption() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.5 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0006: brtrue.s IL_000a + + IL_0008: br.s IL_000c + + IL_000a: ldc.i4.5 + IL_000b: ret + + IL_000c: ldc.i4.4 + IL_000d: ret + } + + .method public static int32 unnecessaryOption() cil managed + { + + .maxstack 3 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0) + IL_0000: ldc.i4.5 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brtrue.s IL_000c + + IL_000a: br.s IL_0013 + + IL_000c: ldloc.0 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() + IL_0012: ret + + IL_0013: ldc.i4.4 + IL_0014: ret + } + +} + +.class private abstract auto ansi sealed ''.$Option_elision_non_constant_result$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..0294f07b88f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl @@ -0,0 +1,203 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 8:0:0:0 +} +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Spurious_tail + extends [runtime]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 ) + .class auto ansi serializable sealed nested public LoggerLevel + extends [runtime]System.Enum + { + .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 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype Spurious_tail/LoggerLevel A = int32(0x00000000) + .field public static literal valuetype Spurious_tail/LoggerLevel B = int32(0x00000001) + } + + .class auto ansi serializable nested public Logger + extends [runtime]System.Object + { + .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 ) + .field assembly class [System.Collections]System.Collections.Generic.List`1 messages + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4 0x2710 + IL_000e: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(int32) + IL_0013: stfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0018: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + string msg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0006: ldarg.2 + IL_0007: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_000c: ldarg.0 + IL_000d: callvirt instance void Spurious_tail/Logger::'nop'() + IL_0012: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + !!a obj) cil managed + { + + .maxstack 4 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0006: ldarg.2 + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: constrained. !!a + IL_0010: callvirt instance string [runtime]System.Object::ToString() + IL_0015: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_001a: ldarg.0 + IL_001b: callvirt instance void Spurious_tail/Logger::'nop'() + IL_0020: ret + } + + .method assembly hidebysig instance void + 'nop'() cil managed aggressiveinlining + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ret + } + + } + + .class auto ansi serializable nested public TailLogger + extends [runtime]System.Object + { + .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 ) + .field assembly class [System.Collections]System.Collections.Generic.List`1 messages + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4 0x2710 + IL_000e: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(int32) + IL_0013: stfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0018: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + string msg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0006: ldarg.2 + IL_0007: tail. + IL_0009: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_000e: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + !!a obj) cil managed + { + + .maxstack 4 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0006: ldarg.2 + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: constrained. !!a + IL_0010: callvirt instance string [runtime]System.Object::ToString() + IL_0015: tail. + IL_0017: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) + IL_001c: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Spurious_tail$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..b7c232c39a7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl @@ -0,0 +1,357 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Static_init_field + extends [runtime]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 ) + .class auto ansi serializable nested public beforefieldinit S`1 + extends [runtime]System.Object + { + .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 ) + .field static assembly class Static_init_field/S`1 empty + .field static assembly int32 init@5 + .method public specialname rtspecialname + instance void .ctor(!T[] x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: newobj instance void class Static_init_field/S`1::.ctor(!0[]) + IL_0006: stsfld class Static_init_field/S`1 class Static_init_field/S`1::empty + IL_000b: ldc.i4.1 + IL_000c: volatile. + IL_000e: stsfld int32 class Static_init_field/S`1::init@5 + IL_0013: ret + } + + .method public specialname static class Static_init_field/S`1 + get_Empty() cil managed + { + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 class Static_init_field/S`1::init@5 + IL_0007: ldc.i4.1 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld class Static_init_field/S`1 class Static_init_field/S`1::empty + IL_0016: ret + } + + .property class Static_init_field/S`1 + Empty() + { + .get class Static_init_field/S`1 Static_init_field/S`1::get_Empty() + } + } + + .class sequential ansi serializable sealed nested public beforefieldinit S2`1 + extends [runtime]System.ValueType + implements class [runtime]System.IEquatable`1>, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IComparable`1>, + [runtime]System.IComparable, + [runtime]System.Collections.IStructuralComparable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .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 ) + .field static assembly object empty + .field static assembly int32 'init@10-1' + .field assembly !T[] x + .method public hidebysig virtual final + instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0005: ldarg.0 + IL_0006: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000b: ldarga.s obj + IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0012: tail. + IL_0014: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0019: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: unbox.any valuetype Static_init_field/S2`1 + IL_0006: stloc.0 + IL_0007: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_000c: ldarg.0 + IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0012: ldloca.s V_0 + IL_0014: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0019: tail. + IL_001b: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0020: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: unbox.any valuetype Static_init_field/S2`1 + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: ldarg.0 + IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000e: ldloca.s V_0 + IL_0010: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0015: tail. + IL_0017: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_001c: ret + } + + .method public hidebysig virtual final + instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4 0x9e3779b9 + IL_0007: ldarg.1 + IL_0008: ldarg.0 + IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_0013: ldloc.0 + IL_0014: ldc.i4.6 + IL_0015: shl + IL_0016: ldloc.0 + IL_0017: ldc.i4.2 + IL_0018: shr + IL_0019: add + IL_001a: add + IL_001b: add + IL_001c: stloc.0 + IL_001d: ldloc.0 + IL_001e: ret + } + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 valuetype Static_init_field/S2`1::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000b: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: isinst valuetype Static_init_field/S2`1 + IL_0006: brfalse.s IL_0025 + + IL_0008: ldarg.1 + IL_0009: unbox.any valuetype Static_init_field/S2`1 + IL_000e: stloc.0 + IL_000f: ldarg.2 + IL_0010: ldarg.0 + IL_0011: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0016: ldloca.s V_0 + IL_0018: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_001d: tail. + IL_001f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_0024: ret + + IL_0025: ldc.i4.0 + IL_0026: ret + } + + .method public specialname rtspecialname + instance void .ctor(!T[] x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld !0[] valuetype Static_init_field/S2`1::x + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call object valuetype Static_init_field/S2`1::M() + IL_0005: stsfld object valuetype Static_init_field/S2`1::empty + IL_000a: ldc.i4.1 + IL_000b: volatile. + IL_000d: stsfld int32 valuetype Static_init_field/S2`1::'init@10-1' + IL_0012: ret + } + + .method public static object M() cil managed + { + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 valuetype Static_init_field/S2`1::'init@10-1' + IL_0007: ldc.i4.1 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld object valuetype Static_init_field/S2`1::empty + IL_0016: ret + } + + .method public hidebysig virtual final + instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0006: ldarga.s obj + IL_0008: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000d: tail. + IL_000f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, + !!0) + IL_0014: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (valuetype Static_init_field/S2`1 V_0, + valuetype Static_init_field/S2`1 V_1) + IL_0000: ldarg.1 + IL_0001: isinst valuetype Static_init_field/S2`1 + IL_0006: brfalse.s IL_0026 + + IL_0008: ldarg.1 + IL_0009: unbox.any valuetype Static_init_field/S2`1 + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: stloc.1 + IL_0011: ldarg.0 + IL_0012: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0017: ldloca.s V_1 + IL_0019: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_001e: tail. + IL_0020: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, + !!0) + IL_0025: ret + + IL_0026: ldc.i4.0 + IL_0027: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Static_init_field$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..7f08989cd53 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl @@ -0,0 +1,300 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Tailcall_last_expression_parens + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@21-3' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Tailcall_last_expression_parens/'impl@21-3' @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: tail. + IL_0004: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, + uint64) + IL_0009: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@21-3'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@29-5' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Tailcall_last_expression_parens/'impl@29-5' @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, + uint64) + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@29-5'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_000a: ret + } + + } + + .method assembly static uint64 impl@5(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.1 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 + } + + .method public static uint64 factorialOk1(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::impl@5(uint64, + uint64) + IL_0008: ret + } + + .method assembly static uint64 'impl@13-1'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.1 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 + } + + .method public static uint64 factorialOk2(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::'impl@13-1'(uint64, + uint64) + IL_0008: ret + } + + .method assembly static uint64 'impl@21-2'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: brtrue.s IL_000b + + IL_0009: ldarg.1 + IL_000a: ret + + IL_000b: ldloc.0 + IL_000c: ldarg.0 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: sub + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_0015: ldarg.0 + IL_0016: ldarg.1 + IL_0017: mul + IL_0018: tail. + IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001f: ret + } + + .method public static uint64 factorialNotOk1(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: tail. + IL_0005: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, + uint64) + IL_000a: ret + } + + .method assembly static uint64 'impl@29-4'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: brtrue.s IL_000b + + IL_0009: ldarg.1 + IL_000a: ret + + IL_000b: ldloc.0 + IL_000c: ldarg.0 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: sub + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_0015: ldarg.0 + IL_0016: ldarg.1 + IL_0017: mul + IL_0018: tail. + IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001f: ret + } + + .method public static uint64 factorialNotOk2(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, + uint64) + IL_0008: ret + } + +} + +.class private abstract auto ansi sealed ''.$Tailcall_last_expression_parens$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..8bd78c1214d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl @@ -0,0 +1,117 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 8:0:0:0 +} +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Typedefof + extends [runtime]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 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .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 ) + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig instance void + M() cil managed + { + + .maxstack 3 + .locals init (class [runtime]System.Type V_0, + class [runtime]System.Type V_1) + IL_0000: ldtoken class [System.Collections]System.Collections.Generic.List`1 + IL_0005: call class [netstandard]System.Type [netstandard]System.Type::GetTypeFromHandle(valuetype [netstandard]System.RuntimeTypeHandle) + IL_000a: stloc.1 + IL_000b: ldloc.1 + IL_000c: callvirt instance bool [netstandard]System.Type::get_IsGenericType() + IL_0011: brfalse.s IL_001b + + IL_0013: ldloc.1 + IL_0014: callvirt instance class [netstandard]System.Type [netstandard]System.Type::GetGenericTypeDefinition() + IL_0019: br.s IL_001c + + IL_001b: ldloc.1 + IL_001c: stloc.0 + IL_001d: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Typedefof$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl similarity index 98% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl index 94e19be70c3..7e87b34019b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl @@ -97,7 +97,7 @@ } - .field static assembly valuetype ''/T71288_24Bytes@ field71289@ at I_00003991 + .field static assembly valuetype ''/T71309_24Bytes@ field71310@ at I_000039AA .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -253,7 +253,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T71288_24Bytes@ Use_binding_on_struct_enumerator::field71289@ + IL_0007: ldtoken field valuetype ''/T71309_24Bytes@ Use_binding_on_struct_enumerator::field71310@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -329,7 +329,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T71288_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T71309_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -341,7 +341,7 @@ -.data cil I_00003991 = bytearray ( +.data cil I_000039AA = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl new file mode 100644 index 00000000000..7f9efcee7b8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl @@ -0,0 +1,347 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 8:0:0:0 +} +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Use_binding_on_struct_enumerator + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit testFoldOnListT@32 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance string + Invoke(string state, + int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: box [runtime]System.Int32 + IL_0007: unbox.any [runtime]System.IFormattable + IL_000c: ldnull + IL_000d: call class [netstandard]System.Globalization.CultureInfo [netstandard]System.Globalization.CultureInfo::get_InvariantCulture() + IL_0012: callvirt instance string [netstandard]System.IFormattable::ToString(string, + class [netstandard]System.IFormatProvider) + IL_0017: call string [runtime]System.String::Concat(string, + string) + IL_001c: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Use_binding_on_struct_enumerator/testFoldOnListT@32::.ctor() + IL_0005: stsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_000a: ret + } + + } + + .field static assembly valuetype ''/T68512_24Bytes@ field68513@ at I_000039B4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TEnumerator enumerator) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 0A 66 6F 6C 64 53 74 72 6F 6E 67 00 00 ) + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + !!TEnumerator V_1, + !!State V_2, + !!TEnumerator V_3) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: stloc.1 + IL_0009: ldarg.1 + IL_000a: stloc.2 + IL_000b: br.s IL_0024 + + IL_000d: ldloc.0 + IL_000e: ldloc.2 + IL_000f: ldarg.2 + IL_0010: stloc.3 + IL_0011: ldloca.s V_3 + IL_0013: constrained. !!TEnumerator + IL_0019: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_001e: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0023: stloc.2 + IL_0024: ldloca.s V_1 + IL_0026: constrained. !!TEnumerator + IL_002c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0031: brtrue.s IL_000d + + IL_0033: ldloc.2 + IL_0034: ret + } + + .method public static !!State Fold) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: brfalse.s IL_000b + + IL_0003: ldnull + IL_0004: unbox.any !!TEnumerator + IL_0009: br.s IL_0016 + + IL_000b: ldstr "Dynamic invocation of GetEnumerator is not supported" + IL_0010: newobj instance void [runtime]System.NotSupportedException::.ctor(string) + IL_0015: throw + + IL_0016: stloc.0 + .try + { + IL_0017: ldarg.0 + IL_0018: ldarg.1 + IL_0019: ldloc.0 + IL_001a: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_001f: stloc.1 + IL_0020: leave.s IL_0039 + + } + finally + { + IL_0022: ldloc.0 + IL_0023: box !!TEnumerator + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.2 + IL_002e: ldloc.2 + IL_002f: brfalse.s IL_0038 + + IL_0031: ldloc.2 + IL_0032: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0037: endfinally + IL_0038: endfinally + } + IL_0039: ldloc.1 + IL_003a: ret + } + + .method public static !!State Fold$W) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 getEnumerator, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldarg.0 + IL_0001: ldarg.3 + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + .try + { + IL_0008: ldarg.1 + IL_0009: ldarg.2 + IL_000a: ldloc.0 + IL_000b: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0010: stloc.1 + IL_0011: leave.s IL_002a + + } + finally + { + IL_0013: ldloc.0 + IL_0014: box !!TEnumerator + IL_0019: isinst [runtime]System.IDisposable + IL_001e: stloc.2 + IL_001f: ldloc.2 + IL_0020: brfalse.s IL_0029 + + IL_0022: ldloc.2 + IL_0023: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0028: endfinally + IL_0029: endfinally + } + IL_002a: ldloc.1 + IL_002b: ret + } + + .method public static string testFoldOnListT() cil managed + { + + .maxstack 5 + .locals init (class [System.Collections]System.Collections.Generic.List`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_1, + valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator V_2, + string V_3, + class [runtime]System.IDisposable V_4) + IL_0000: ldc.i4.6 + IL_0001: newarr [runtime]System.Int32 + IL_0006: dup + IL_0007: ldtoken field valuetype ''/T68512_24Bytes@ Use_binding_on_struct_enumerator::field68513@ + IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, + valuetype [runtime]System.RuntimeFieldHandle) + IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.0 + IL_0017: ldsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_001c: stloc.1 + IL_001d: ldloc.0 + IL_001e: callvirt instance valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator class [System.Collections]System.Collections.Generic.List`1::GetEnumerator() + IL_0023: stloc.2 + .try + { + IL_0024: ldloc.1 + IL_0025: ldstr "" + IL_002a: ldloc.2 + IL_002b: call !!0 Use_binding_on_struct_enumerator::FoldStrong>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0030: stloc.3 + IL_0031: leave.s IL_004d + + } + finally + { + IL_0033: ldloc.2 + IL_0034: box valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator + IL_0039: isinst [runtime]System.IDisposable + IL_003e: stloc.s V_4 + IL_0040: ldloc.s V_4 + IL_0042: brfalse.s IL_004c + + IL_0044: ldloc.s V_4 + IL_0046: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_004b: endfinally + IL_004c: endfinally + } + IL_004d: ldloc.3 + IL_004e: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_0006: ldsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_000b: pop + IL_000c: ret + } + +} + +.class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + +} + +.class private abstract auto ansi sealed beforefieldinit '' + extends [runtime]System.Object +{ + .class explicit ansi sealed nested assembly beforefieldinit T68512_24Bytes@ + extends [runtime]System.ValueType + { + .pack 0 + .size 24 + } + +} + + + + +.data cil I_000039B4 = bytearray ( + 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 + 05 00 00 00 08 00 00 00) + From 259cd6838edd9c868f9d5beb22e3d04faa83740c Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 25 Nov 2023 00:02:46 +0100 Subject: [PATCH 03/13] rerun --- .../EmittedIL/Optimization/OptimizationTests.fs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs index f5dda0db06a..9a747e4ef78 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/OptimizationTests.fs @@ -3,7 +3,6 @@ open Xunit open FSharp.Test open FSharp.Test.Compiler let [] folder = __SOURCE_DIRECTORY__ + "/samples" - [ Date: Sat, 25 Nov 2023 11:56:53 +0100 Subject: [PATCH 04/13] adjust baselines again, remove those that are identical between debug / release, and hopefully fix the last failing one. --- ... => array_of_function_no_alloc.fsx.il.bsl} | 0 ...nction_no_alloc.fsx.il.netcore.release.bsl | 194 ---- ...ug.bsl => for_loop_custom_step.fsx.il.bsl} | 0 ...oop_custom_step.fsx.il.netcore.release.bsl | 113 --- ...> if_then_else_bool_expression.fsx.il.bsl} | 0 ...bool_expression.fsx.il.netcore.release.bsl | 115 --- ...ug.bsl => inplace_array_update.fsx.il.bsl} | 0 ...ce_array_update.fsx.il.netcore.release.bsl | 296 ------ ...e.debug.bsl => lambda_inlining.fsx.il.bsl} | 0 ...lambda_inlining.fsx.il.netcore.release.bsl | 884 ------------------ ...on_elision_non_constant_result.fsx.il.bsl} | 0 ...constant_result.fsx.il.netcore.release.bsl | 133 --- ...ore.debug.bsl => spurious_tail.fsx.il.bsl} | 0 .../spurious_tail.fsx.il.netcore.release.bsl | 203 ---- ...debug.bsl => static_init_field.fsx.il.bsl} | 0 ...atic_init_field.fsx.il.netcore.release.bsl | 357 ------- ...ailcall_last_expression_parens.fsx.il.bsl} | 0 ...pression_parens.fsx.il.netcore.release.bsl | 300 ------ ...netcore.debug.bsl => typedefof.fsx.il.bsl} | 0 .../typedefof.fsx.il.netcore.release.bsl | 117 --- ...ruct_enumerator.fsx.il.netcore.release.bsl | 8 +- 21 files changed, 4 insertions(+), 2716 deletions(-) rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{array_of_function_no_alloc.fsx.il.netcore.debug.bsl => array_of_function_no_alloc.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{for_loop_custom_step.fsx.il.netcore.debug.bsl => for_loop_custom_step.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{if_then_else_bool_expression.fsx.il.netcore.debug.bsl => if_then_else_bool_expression.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{inplace_array_update.fsx.il.netcore.debug.bsl => inplace_array_update.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{lambda_inlining.fsx.il.netcore.debug.bsl => lambda_inlining.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{option_elision_non_constant_result.fsx.il.netcore.debug.bsl => option_elision_non_constant_result.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{spurious_tail.fsx.il.netcore.debug.bsl => spurious_tail.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{static_init_field.fsx.il.netcore.debug.bsl => static_init_field.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{tailcall_last_expression_parens.fsx.il.netcore.debug.bsl => tailcall_last_expression_parens.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{typedefof.fsx.il.netcore.debug.bsl => typedefof.fsx.il.bsl} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl deleted file mode 100644 index ad36e15d2d8..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,194 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Array_of_function_no_alloc - extends [runtime]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 ) - .class auto ansi serializable sealed nested assembly beforefieldinit runAll@9 - extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - { - .field static assembly initonly class Array_of_function_no_alloc/runAll@9 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() - IL_0006: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] source, - int32 index) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.2 - IL_0002: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - IL_0007: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void Array_of_function_no_alloc/runAll@9::.ctor() - IL_0005: stsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance - IL_000a: ret - } - - } - - .method public static int32 exampleFunc(int32 v) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.2 - IL_0002: add - IL_0003: ret - } - - .method public static int32 runAll(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, - int32 x) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - - .maxstack 7 - .locals init (int32 V_0, - int32 V_1) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: stloc.1 - IL_0004: br.s IL_001a - - IL_0006: ldloc.0 - IL_0007: ldsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance - IL_000c: ldarg.0 - IL_000d: ldloc.1 - IL_000e: ldarg.1 - IL_000f: call !!1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[],int32>::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>, - !0, - !1, - !!0) - IL_0014: add - IL_0015: stloc.0 - IL_0016: ldloc.1 - IL_0017: ldc.i4.1 - IL_0018: add - IL_0019: stloc.1 - IL_001a: ldloc.1 - IL_001b: ldarg.0 - IL_001c: ldlen - IL_001d: conv.i4 - IL_001e: blt.s IL_0006 - - IL_0020: ldloc.0 - IL_0021: ret - } - - .method public static int32 runAllNoAlloc(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, - int32 x) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - - .maxstack 5 - .locals init (int32 V_0, - int32 V_1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_2) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: stloc.1 - IL_0004: br.s IL_001c - - IL_0006: ldarg.0 - IL_0007: ldloc.1 - IL_0008: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - IL_000d: stloc.2 - IL_000e: ldloc.0 - IL_000f: ldloc.2 - IL_0010: ldarg.1 - IL_0011: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0016: add - IL_0017: stloc.0 - IL_0018: ldloc.1 - IL_0019: ldc.i4.1 - IL_001a: add - IL_001b: stloc.1 - IL_001c: ldloc.1 - IL_001d: ldarg.0 - IL_001e: ldlen - IL_001f: conv.i4 - IL_0020: blt.s IL_0006 - - IL_0022: ldloc.0 - IL_0023: ret - } - -} - -.class private abstract auto ansi sealed ''.$Array_of_function_no_alloc$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl deleted file mode 100644 index 841f1df59c1..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed For_loop_custom_step - extends [runtime]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 g() cil managed - { - - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, - class [runtime]System.IDisposable V_2) - IL_0000: ldc.i4.0 - IL_0001: ldc.i4.2 - IL_0002: ldc.i4.s 15 - IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0009: stloc.0 - IL_000a: ldloc.0 - IL_000b: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_0010: stloc.1 - .try - { - IL_0011: br.s IL_001e - - IL_0013: ldloc.1 - IL_0014: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0019: call void [runtime]System.Console::WriteLine(int32) - IL_001e: ldloc.1 - IL_001f: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_0024: brtrue.s IL_0013 - - IL_0026: leave.s IL_003a - - } - finally - { - IL_0028: ldloc.1 - IL_0029: isinst [runtime]System.IDisposable - IL_002e: stloc.2 - IL_002f: ldloc.2 - IL_0030: brfalse.s IL_0039 - - IL_0032: ldloc.2 - IL_0033: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0038: endfinally - IL_0039: endfinally - } - IL_003a: ret - } - -} - -.class private abstract auto ansi sealed ''.$For_loop_custom_step$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void For_loop_custom_step::g() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl deleted file mode 100644 index 754fdd99e8c..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed If_then_else_bool_expression - extends [runtime]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 bool foo(bool a, - bool b) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brfalse.s IL_0005 - - IL_0003: ldc.i4.0 - IL_0004: ret - - IL_0005: ldarg.1 - IL_0006: brfalse.s IL_000a - - IL_0008: ldc.i4.0 - IL_0009: ret - - IL_000a: ldc.i4.1 - IL_000b: ret - } - - .method public static bool bar(bool a, - bool b) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brtrue.s IL_0008 - - IL_0003: ldarg.1 - IL_0004: ldc.i4.0 - IL_0005: ceq - IL_0007: ret - - IL_0008: ldc.i4.0 - IL_0009: ret - } - -} - -.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.0 - IL_0002: call bool If_then_else_bool_expression::foo(bool, - bool) - IL_0007: call void [runtime]System.Console::WriteLine(bool) - IL_000c: ldc.i4.1 - IL_000d: ldc.i4.0 - IL_000e: call bool If_then_else_bool_expression::bar(bool, - bool) - IL_0013: call void [runtime]System.Console::WriteLine(bool) - IL_0018: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl deleted file mode 100644 index 01bd5b94704..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,296 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Inplace_array_update - extends [runtime]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 ) - .class abstract auto ansi sealed nested public Foo - extends [runtime]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 !!a[] bar(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, - !!a[] a, - !!a[] b) 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 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: ldarg.2 - IL_0003: tail. - IL_0005: call !!2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Map2(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, - !!0[], - !!1[]) - IL_000a: ret - } - - .method public static void barInPlace(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, - !!a[] a, - !!a[] b) 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 8 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0023 - - IL_0004: ldarg.2 - IL_0005: ldloc.0 - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: ldloc.0 - IL_0009: ldelem !!a - IL_000e: ldarg.2 - IL_000f: ldloc.0 - IL_0010: ldelem !!a - IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, - !0, - !1) - IL_001a: stelem !!a - IL_001f: ldloc.0 - IL_0020: ldc.i4.1 - IL_0021: add - IL_0022: stloc.0 - IL_0023: ldloc.0 - IL_0024: ldarg.2 - IL_0025: ldlen - IL_0026: conv.i4 - IL_0027: blt.s IL_0004 - - IL_0029: ret - } - - .method public static void barInPlaceInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, - !!a[] a, - !!a[] b) 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 8 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0023 - - IL_0004: ldarg.2 - IL_0005: ldloc.0 - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: ldloc.0 - IL_0009: ldelem !!a - IL_000e: ldarg.2 - IL_000f: ldloc.0 - IL_0010: ldelem !!a - IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, - !0, - !1) - IL_001a: stelem !!a - IL_001f: ldloc.0 - IL_0020: ldc.i4.1 - IL_0021: add - IL_0022: stloc.0 - IL_0023: ldloc.0 - IL_0024: ldarg.2 - IL_0025: ldlen - IL_0026: conv.i4 - IL_0027: blt.s IL_0004 - - IL_0029: ret - } - - .method public static void barInPlaceOptClosure(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, - !!a[] a, - !!a[] b) 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 8 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, - int32 V_1) - IL_0000: ldarg.0 - IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0006: stloc.0 - IL_0007: ldc.i4.0 - IL_0008: stloc.1 - IL_0009: br.s IL_002a - - IL_000b: ldarg.2 - IL_000c: ldloc.1 - IL_000d: ldloc.0 - IL_000e: ldarg.1 - IL_000f: ldloc.1 - IL_0010: ldelem !!a - IL_0015: ldarg.2 - IL_0016: ldloc.1 - IL_0017: ldelem !!a - IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, - !1) - IL_0021: stelem !!a - IL_0026: ldloc.1 - IL_0027: ldc.i4.1 - IL_0028: add - IL_0029: stloc.1 - IL_002a: ldloc.1 - IL_002b: ldarg.2 - IL_002c: ldlen - IL_002d: conv.i4 - IL_002e: blt.s IL_000b - - IL_0030: ret - } - - .method public static void barInPlaceOptClosureInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, - !!a[] a, - !!a[] b) 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 8 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, - int32 V_1) - IL_0000: ldarg.0 - IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0006: stloc.0 - IL_0007: ldc.i4.0 - IL_0008: stloc.1 - IL_0009: br.s IL_002a - - IL_000b: ldarg.2 - IL_000c: ldloc.1 - IL_000d: ldloc.0 - IL_000e: ldarg.1 - IL_000f: ldloc.1 - IL_0010: ldelem !!a - IL_0015: ldarg.2 - IL_0016: ldloc.1 - IL_0017: ldelem !!a - IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, - !1) - IL_0021: stelem !!a - IL_0026: ldloc.1 - IL_0027: ldc.i4.1 - IL_0028: add - IL_0029: stloc.1 - IL_002a: ldloc.1 - IL_002b: ldarg.2 - IL_002c: ldlen - IL_002d: conv.i4 - IL_002e: blt.s IL_000b - - IL_0030: ret - } - - .method public static void barFunInside(float32[] a, - float32[] b) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - - .maxstack 7 - .locals init (int32 V_0, - float32 V_1, - float32 V_2) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_002e - - IL_0004: ldarg.1 - IL_0005: ldloc.0 - IL_0006: ldarg.0 - IL_0007: ldloc.0 - IL_0008: ldelem [runtime]System.Single - IL_000d: stloc.1 - IL_000e: ldarg.1 - IL_000f: ldloc.0 - IL_0010: ldelem [runtime]System.Single - IL_0015: stloc.2 - IL_0016: ldloc.1 - IL_0017: ldc.r4 0.69999999 - IL_001c: mul - IL_001d: ldloc.2 - IL_001e: ldc.r4 0.30000001 - IL_0023: mul - IL_0024: add - IL_0025: stelem [runtime]System.Single - IL_002a: ldloc.0 - IL_002b: ldc.i4.1 - IL_002c: add - IL_002d: stloc.0 - IL_002e: ldloc.0 - IL_002f: ldarg.1 - IL_0030: ldlen - IL_0031: conv.i4 - IL_0032: blt.s IL_0004 - - IL_0034: ret - } - - } - -} - -.class private abstract auto ansi sealed ''.$Inplace_array_update$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl deleted file mode 100644 index a005329849e..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,884 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Lambda_inlining - extends [runtime]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 ) - .class auto ansi serializable sealed nested assembly beforefieldinit fold@14 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> class Lambda_inlining/fold@14::f - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s - IL_0014: ret - } - - .method public strict virtual instance bool - Invoke(!b v) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> class Lambda_inlining/fold@14::f - IL_000c: ldarg.0 - IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 class Lambda_inlining/fold@14::s - IL_0012: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0017: ldarg.1 - IL_0018: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, - !0, - !1) - IL_001d: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) - IL_0022: ldc.i4.1 - IL_0023: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined1@24 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> - { - .field public int32[] vs - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(int32[] vs) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed - { - - .maxstack 7 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0008 - - IL_0004: ldloc.0 - IL_0005: ldc.i4.1 - IL_0006: add - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: ldarg.0 - IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs - IL_000f: ldlen - IL_0010: conv.i4 - IL_0011: bge.s IL_0027 - - IL_0013: ldarg.1 - IL_0014: ldarg.0 - IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs - IL_001a: ldloc.0 - IL_001b: ldelem [runtime]System.Int32 - IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0025: br.s IL_0028 - - IL_0027: ldc.i4.0 - IL_0028: brtrue.s IL_0004 - - IL_002a: ldloc.0 - IL_002b: ldarg.0 - IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined1@24::vs - IL_0031: ldlen - IL_0032: conv.i4 - IL_0033: ceq - IL_0035: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined1@24-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(int32 v) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined1@24-1'::s - IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0011: ldarg.1 - IL_0012: add - IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) - IL_0018: ldc.i4.1 - IL_0019: ret - } - - } - - .class auto ansi serializable nested public Test - extends [runtime]System.Object - { - .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 ) - .field assembly int32[] _values - .field static assembly int32[] _svalues - .field static assembly int32 init@26 - .method public specialname rtspecialname - instance void .ctor() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ldarg.0 - IL_0009: ldc.i4.0 - IL_000a: ldc.i4.1 - IL_000b: ldc.i4 0x2710 - IL_0010: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0015: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_001a: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_001f: stfld int32[] Lambda_inlining/Test::_values - IL_0024: ret - } - - .method public hidebysig instance int32 - thisIsInlined2() cil managed - { - - .maxstack 4 - .locals init (int32 V_0, - int32 V_1, - int32 V_2) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: stloc.1 - IL_0004: br.s IL_000a - - IL_0006: ldloc.1 - IL_0007: ldc.i4.1 - IL_0008: add - IL_0009: stloc.1 - IL_000a: ldloc.1 - IL_000b: call int32[] Lambda_inlining::get_values() - IL_0010: ldlen - IL_0011: conv.i4 - IL_0012: bge.s IL_0027 - - IL_0014: call int32[] Lambda_inlining::get_values() - IL_0019: ldloc.1 - IL_001a: ldelem [runtime]System.Int32 - IL_001f: stloc.2 - IL_0020: ldloc.0 - IL_0021: ldloc.2 - IL_0022: add - IL_0023: stloc.0 - IL_0024: ldc.i4.1 - IL_0025: br.s IL_0028 - - IL_0027: ldc.i4.0 - IL_0028: brtrue.s IL_0006 - - IL_002a: ldloc.1 - IL_002b: call int32[] Lambda_inlining::get_values() - IL_0030: ldlen - IL_0031: conv.i4 - IL_0032: ceq - IL_0034: pop - IL_0035: ldloc.0 - IL_0036: ret - } - - .method public hidebysig instance int32 - thisIsInlined3() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.0 - IL_0002: ldfld int32[] Lambda_inlining/Test::_values - IL_0007: callvirt instance int32 Lambda_inlining/Test::'array'(int32[]) - IL_000c: ret - } - - .method public hidebysig instance int32 - thisIsNotInlined2() cil managed - { - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, - int32[] V_1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) - IL_0000: ldarg.0 - IL_0001: ldfld int32[] Lambda_inlining/Test::_values - IL_0006: stloc.1 - IL_0007: ldloc.1 - IL_0008: newobj instance void Lambda_inlining/thisIsNotInlined2@35::.ctor(int32[]) - IL_000d: stloc.0 - IL_000e: ldc.i4.0 - IL_000f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) - IL_0014: stloc.2 - IL_0015: ldloc.0 - IL_0016: ldloc.2 - IL_0017: newobj instance void Lambda_inlining/'thisIsNotInlined2@35-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) - IL_0021: pop - IL_0022: ldloc.2 - IL_0023: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0028: ret - } - - .method public hidebysig instance int32 - thisIsNotInlined3() cil managed - { - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, - int32[] V_1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) - IL_0000: volatile. - IL_0002: ldsfld int32 Lambda_inlining/Test::init@26 - IL_0007: ldc.i4.2 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32[] Lambda_inlining/Test::_svalues - IL_0016: stloc.1 - IL_0017: ldloc.1 - IL_0018: newobj instance void Lambda_inlining/thisIsNotInlined3@36::.ctor(int32[]) - IL_001d: stloc.0 - IL_001e: ldc.i4.0 - IL_001f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) - IL_0024: stloc.2 - IL_0025: ldloc.0 - IL_0026: ldloc.2 - IL_0027: newobj instance void Lambda_inlining/'thisIsNotInlined3@36-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) - IL_0031: pop - IL_0032: ldloc.2 - IL_0033: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0038: ret - } - - .method assembly hidebysig instance int32 - 'array'(int32[] vs) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 4 - .locals init (int32 V_0, - int32 V_1, - int32 V_2) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: stloc.1 - IL_0004: br.s IL_000a - - IL_0006: ldloc.1 - IL_0007: ldc.i4.1 - IL_0008: add - IL_0009: stloc.1 - IL_000a: ldloc.1 - IL_000b: ldarg.1 - IL_000c: ldlen - IL_000d: conv.i4 - IL_000e: bge.s IL_001f - - IL_0010: ldarg.1 - IL_0011: ldloc.1 - IL_0012: ldelem [runtime]System.Int32 - IL_0017: stloc.2 - IL_0018: ldloc.0 - IL_0019: ldloc.2 - IL_001a: add - IL_001b: stloc.0 - IL_001c: ldc.i4.1 - IL_001d: br.s IL_0020 - - IL_001f: ldc.i4.0 - IL_0020: brtrue.s IL_0006 - - IL_0022: ldloc.1 - IL_0023: ldarg.1 - IL_0024: ldlen - IL_0025: conv.i4 - IL_0026: ceq - IL_0028: pop - IL_0029: ldloc.0 - IL_002a: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$Lambda_inlining$fsx::init@ - IL_0006: ldsfld int32 ''.$Lambda_inlining$fsx::init@ - IL_000b: pop - IL_000c: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined2@35 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> - { - .field public int32[] vs - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(int32[] vs) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed - { - - .maxstack 7 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0008 - - IL_0004: ldloc.0 - IL_0005: ldc.i4.1 - IL_0006: add - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: ldarg.0 - IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_000f: ldlen - IL_0010: conv.i4 - IL_0011: bge.s IL_0027 - - IL_0013: ldarg.1 - IL_0014: ldarg.0 - IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_001a: ldloc.0 - IL_001b: ldelem [runtime]System.Int32 - IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0025: br.s IL_0028 - - IL_0027: ldc.i4.0 - IL_0028: brtrue.s IL_0004 - - IL_002a: ldloc.0 - IL_002b: ldarg.0 - IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_0031: ldlen - IL_0032: conv.i4 - IL_0033: ceq - IL_0035: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined2@35-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(int32 v) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s - IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0011: ldarg.1 - IL_0012: add - IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) - IL_0018: ldc.i4.1 - IL_0019: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined3@36 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> - { - .field public int32[] vs - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(int32[] vs) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed - { - - .maxstack 7 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0008 - - IL_0004: ldloc.0 - IL_0005: ldc.i4.1 - IL_0006: add - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: ldarg.0 - IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_000f: ldlen - IL_0010: conv.i4 - IL_0011: bge.s IL_0027 - - IL_0013: ldarg.1 - IL_0014: ldarg.0 - IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_001a: ldloc.0 - IL_001b: ldelem [runtime]System.Int32 - IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0025: br.s IL_0028 - - IL_0027: ldc.i4.0 - IL_0028: brtrue.s IL_0004 - - IL_002a: ldloc.0 - IL_002b: ldarg.0 - IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_0031: ldlen - IL_0032: conv.i4 - IL_0033: ceq - IL_0035: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined3@36-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(int32 v) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s - IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0011: ldarg.1 - IL_0012: add - IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) - IL_0018: ldc.i4.1 - IL_0019: ret - } - - } - - .method public static bool ofArray(!!a[] vs, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - .param [2] - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 5 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0008 - - IL_0004: ldloc.0 - IL_0005: ldc.i4.1 - IL_0006: add - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: ldarg.0 - IL_000a: ldlen - IL_000b: conv.i4 - IL_000c: bge.s IL_001d - - IL_000e: ldarg.1 - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: ldelem !!a - IL_0016: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001b: br.s IL_001e - - IL_001d: ldc.i4.0 - IL_001e: brtrue.s IL_0004 - - IL_0020: ldloc.0 - IL_0021: ldarg.0 - IL_0022: ldlen - IL_0023: conv.i4 - IL_0024: ceq - IL_0026: ret - } - - .method public static !!a fold(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, - !!a z, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> ps) 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 ) - .param [1] - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) - .param [3] - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.InlineIfLambdaAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 5 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) - IL_0000: ldarg.1 - IL_0001: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) - IL_0006: stloc.0 - IL_0007: ldarg.2 - IL_0008: ldarg.0 - IL_0009: ldloc.0 - IL_000a: newobj instance void class Lambda_inlining/fold@14::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_000f: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) - IL_0014: pop - IL_0015: ldloc.0 - IL_0016: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_001b: ret - } - - .method public specialname static int32[] - get_values() cil managed - { - - .maxstack 8 - IL_0000: ldsfld int32[] ''.$Lambda_inlining$fsx::values@17 - IL_0005: ret - } - - .method public static int32 thisIsInlined1() cil managed - { - - .maxstack 4 - .locals init (int32 V_0, - int32 V_1, - int32 V_2) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: stloc.1 - IL_0004: br.s IL_000a - - IL_0006: ldloc.1 - IL_0007: ldc.i4.1 - IL_0008: add - IL_0009: stloc.1 - IL_000a: ldloc.1 - IL_000b: call int32[] Lambda_inlining::get_values() - IL_0010: ldlen - IL_0011: conv.i4 - IL_0012: bge.s IL_0027 - - IL_0014: call int32[] Lambda_inlining::get_values() - IL_0019: ldloc.1 - IL_001a: ldelem [runtime]System.Int32 - IL_001f: stloc.2 - IL_0020: ldloc.0 - IL_0021: ldloc.2 - IL_0022: add - IL_0023: stloc.0 - IL_0024: ldc.i4.1 - IL_0025: br.s IL_0028 - - IL_0027: ldc.i4.0 - IL_0028: brtrue.s IL_0006 - - IL_002a: ldloc.1 - IL_002b: call int32[] Lambda_inlining::get_values() - IL_0030: ldlen - IL_0031: conv.i4 - IL_0032: ceq - IL_0034: pop - IL_0035: ldloc.0 - IL_0036: ret - } - - .method public static int32 thisIsInlined2() cil managed - { - - .maxstack 5 - .locals init (int32[] V_0, - int32 V_1, - int32 V_2, - int32 V_3) - IL_0000: ldc.i4.0 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4 0x2710 - IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0016: stloc.0 - IL_0017: ldc.i4.0 - IL_0018: stloc.1 - IL_0019: ldc.i4.0 - IL_001a: stloc.2 - IL_001b: br.s IL_0021 - - IL_001d: ldloc.2 - IL_001e: ldc.i4.1 - IL_001f: add - IL_0020: stloc.2 - IL_0021: ldloc.2 - IL_0022: ldloc.0 - IL_0023: ldlen - IL_0024: conv.i4 - IL_0025: bge.s IL_0036 - - IL_0027: ldloc.0 - IL_0028: ldloc.2 - IL_0029: ldelem [runtime]System.Int32 - IL_002e: stloc.3 - IL_002f: ldloc.1 - IL_0030: ldloc.3 - IL_0031: add - IL_0032: stloc.1 - IL_0033: ldc.i4.1 - IL_0034: br.s IL_0037 - - IL_0036: ldc.i4.0 - IL_0037: brtrue.s IL_001d - - IL_0039: ldloc.2 - IL_003a: ldloc.0 - IL_003b: ldlen - IL_003c: conv.i4 - IL_003d: ceq - IL_003f: pop - IL_0040: ldloc.1 - IL_0041: ret - } - - .method public static int32 thisIsNotInlined1() cil managed - { - - .maxstack 5 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> V_0, - int32[] V_1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_2) - IL_0000: ldc.i4.0 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4 0x2710 - IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0016: stloc.1 - IL_0017: ldloc.1 - IL_0018: newobj instance void Lambda_inlining/thisIsNotInlined1@24::.ctor(int32[]) - IL_001d: stloc.0 - IL_001e: ldc.i4.0 - IL_001f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) - IL_0024: stloc.2 - IL_0025: ldloc.0 - IL_0026: ldloc.2 - IL_0027: newobj instance void Lambda_inlining/'thisIsNotInlined1@24-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) - IL_0031: pop - IL_0032: ldloc.2 - IL_0033: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0038: ret - } - - .property int32[] values() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get int32[] Lambda_inlining::get_values() - } -} - -.class private abstract auto ansi sealed ''.$Lambda_inlining$fsx - extends [runtime]System.Object -{ - .field static assembly initonly int32[] values@17 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4 0x2710 - IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0016: stsfld int32[] ''.$Lambda_inlining$fsx::values@17 - IL_001b: ldc.i4.0 - IL_001c: ldc.i4.1 - IL_001d: ldc.i4 0x2710 - IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0027: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_002c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0031: stsfld int32[] Lambda_inlining/Test::_svalues - IL_0036: ldc.i4.2 - IL_0037: volatile. - IL_0039: stsfld int32 Lambda_inlining/Test::init@26 - IL_003e: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl deleted file mode 100644 index 41b4918dc17..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,133 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Option_elision_non_constant_result - extends [runtime]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 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 - mapOption(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapper, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 option) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - !!a V_1) - IL_0000: ldarg.1 - IL_0001: brtrue.s IL_0005 - - IL_0003: br.s IL_001b - - IL_0005: ldarg.1 - IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_000d: stloc.1 - IL_000e: ldarg.0 - IL_000f: ldloc.1 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_001a: ret - - IL_001b: ldnull - IL_001c: ret - } - - .method public static int32 almostErasedOption() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.5 - IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_0006: brtrue.s IL_000a - - IL_0008: br.s IL_000c - - IL_000a: ldc.i4.5 - IL_000b: ret - - IL_000c: ldc.i4.4 - IL_000d: ret - } - - .method public static int32 unnecessaryOption() cil managed - { - - .maxstack 3 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0) - IL_0000: ldc.i4.5 - IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: brtrue.s IL_000c - - IL_000a: br.s IL_0013 - - IL_000c: ldloc.0 - IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0012: ret - - IL_0013: ldc.i4.4 - IL_0014: ret - } - -} - -.class private abstract auto ansi sealed ''.$Option_elision_non_constant_result$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl deleted file mode 100644 index 0294f07b88f..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,203 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern System.Collections -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 -} -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Spurious_tail - extends [runtime]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 ) - .class auto ansi serializable sealed nested public LoggerLevel - extends [runtime]System.Enum - { - .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 ) - .field public specialname rtspecialname int32 value__ - .field public static literal valuetype Spurious_tail/LoggerLevel A = int32(0x00000000) - .field public static literal valuetype Spurious_tail/LoggerLevel B = int32(0x00000001) - } - - .class auto ansi serializable nested public Logger - extends [runtime]System.Object - { - .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 ) - .field assembly class [System.Collections]System.Collections.Generic.List`1 messages - .method public specialname rtspecialname - instance void .ctor() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ldarg.0 - IL_0009: ldc.i4 0x2710 - IL_000e: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(int32) - IL_0013: stfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages - IL_0018: ret - } - - .method public hidebysig instance void - Log(valuetype Spurious_tail/LoggerLevel level, - string msg) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages - IL_0006: ldarg.2 - IL_0007: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) - IL_000c: ldarg.0 - IL_000d: callvirt instance void Spurious_tail/Logger::'nop'() - IL_0012: ret - } - - .method public hidebysig instance void - Log(valuetype Spurious_tail/LoggerLevel level, - !!a obj) cil managed - { - - .maxstack 4 - .locals init (!!a V_0) - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/Logger::messages - IL_0006: ldarg.2 - IL_0007: stloc.0 - IL_0008: ldloca.s V_0 - IL_000a: constrained. !!a - IL_0010: callvirt instance string [runtime]System.Object::ToString() - IL_0015: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) - IL_001a: ldarg.0 - IL_001b: callvirt instance void Spurious_tail/Logger::'nop'() - IL_0020: ret - } - - .method assembly hidebysig instance void - 'nop'() cil managed aggressiveinlining - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ret - } - - } - - .class auto ansi serializable nested public TailLogger - extends [runtime]System.Object - { - .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 ) - .field assembly class [System.Collections]System.Collections.Generic.List`1 messages - .method public specialname rtspecialname - instance void .ctor() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ldarg.0 - IL_0009: ldc.i4 0x2710 - IL_000e: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(int32) - IL_0013: stfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages - IL_0018: ret - } - - .method public hidebysig instance void - Log(valuetype Spurious_tail/LoggerLevel level, - string msg) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages - IL_0006: ldarg.2 - IL_0007: tail. - IL_0009: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) - IL_000e: ret - } - - .method public hidebysig instance void - Log(valuetype Spurious_tail/LoggerLevel level, - !!a obj) cil managed - { - - .maxstack 4 - .locals init (!!a V_0) - IL_0000: ldarg.0 - IL_0001: ldfld class [System.Collections]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages - IL_0006: ldarg.2 - IL_0007: stloc.0 - IL_0008: ldloca.s V_0 - IL_000a: constrained. !!a - IL_0010: callvirt instance string [runtime]System.Object::ToString() - IL_0015: tail. - IL_0017: callvirt instance void class [System.Collections]System.Collections.Generic.List`1::Add(!0) - IL_001c: ret - } - - } - -} - -.class private abstract auto ansi sealed ''.$Spurious_tail$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl deleted file mode 100644 index b7c232c39a7..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,357 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Static_init_field - extends [runtime]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 ) - .class auto ansi serializable nested public beforefieldinit S`1 - extends [runtime]System.Object - { - .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 ) - .field static assembly class Static_init_field/S`1 empty - .field static assembly int32 init@5 - .method public specialname rtspecialname - instance void .ctor(!T[] x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldnull - IL_0001: newobj instance void class Static_init_field/S`1::.ctor(!0[]) - IL_0006: stsfld class Static_init_field/S`1 class Static_init_field/S`1::empty - IL_000b: ldc.i4.1 - IL_000c: volatile. - IL_000e: stsfld int32 class Static_init_field/S`1::init@5 - IL_0013: ret - } - - .method public specialname static class Static_init_field/S`1 - get_Empty() cil managed - { - - .maxstack 8 - IL_0000: volatile. - IL_0002: ldsfld int32 class Static_init_field/S`1::init@5 - IL_0007: ldc.i4.1 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld class Static_init_field/S`1 class Static_init_field/S`1::empty - IL_0016: ret - } - - .property class Static_init_field/S`1 - Empty() - { - .get class Static_init_field/S`1 Static_init_field/S`1::get_Empty() - } - } - - .class sequential ansi serializable sealed nested public beforefieldinit S2`1 - extends [runtime]System.ValueType - implements class [runtime]System.IEquatable`1>, - [runtime]System.Collections.IStructuralEquatable, - class [runtime]System.IComparable`1>, - [runtime]System.IComparable, - [runtime]System.Collections.IStructuralComparable - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) - .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 ) - .field static assembly object empty - .field static assembly int32 'init@10-1' - .field assembly !T[] x - .method public hidebysig virtual final - instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0005: ldarg.0 - IL_0006: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_000b: ldarga.s obj - IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_0012: tail. - IL_0014: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, - !!0, - !!0) - IL_0019: ret - } - - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 5 - .locals init (valuetype Static_init_field/S2`1 V_0) - IL_0000: ldarg.1 - IL_0001: unbox.any valuetype Static_init_field/S2`1 - IL_0006: stloc.0 - IL_0007: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_000c: ldarg.0 - IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_0012: ldloca.s V_0 - IL_0014: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_0019: tail. - IL_001b: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, - !!0, - !!0) - IL_0020: ret - } - - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 5 - .locals init (valuetype Static_init_field/S2`1 V_0) - IL_0000: ldarg.1 - IL_0001: unbox.any valuetype Static_init_field/S2`1 - IL_0006: stloc.0 - IL_0007: ldarg.2 - IL_0008: ldarg.0 - IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_000e: ldloca.s V_0 - IL_0010: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_0015: tail. - IL_0017: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, - !!0, - !!0) - IL_001c: ret - } - - .method public hidebysig virtual final - instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 7 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldc.i4 0x9e3779b9 - IL_0007: ldarg.1 - IL_0008: ldarg.0 - IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, - !!0) - IL_0013: ldloc.0 - IL_0014: ldc.i4.6 - IL_0015: shl - IL_0016: ldloc.0 - IL_0017: ldc.i4.2 - IL_0018: shr - IL_0019: add - IL_001a: add - IL_001b: add - IL_001c: stloc.0 - IL_001d: ldloc.0 - IL_001e: ret - } - - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0006: call instance int32 valuetype Static_init_field/S2`1::GetHashCode(class [runtime]System.Collections.IEqualityComparer) - IL_000b: ret - } - - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 5 - .locals init (valuetype Static_init_field/S2`1 V_0) - IL_0000: ldarg.1 - IL_0001: isinst valuetype Static_init_field/S2`1 - IL_0006: brfalse.s IL_0025 - - IL_0008: ldarg.1 - IL_0009: unbox.any valuetype Static_init_field/S2`1 - IL_000e: stloc.0 - IL_000f: ldarg.2 - IL_0010: ldarg.0 - IL_0011: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_0016: ldloca.s V_0 - IL_0018: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_001d: tail. - IL_001f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, - !!0, - !!0) - IL_0024: ret - - IL_0025: ldc.i4.0 - IL_0026: ret - } - - .method public specialname rtspecialname - instance void .ctor(!T[] x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stfld !0[] valuetype Static_init_field/S2`1::x - IL_0007: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call object valuetype Static_init_field/S2`1::M() - IL_0005: stsfld object valuetype Static_init_field/S2`1::empty - IL_000a: ldc.i4.1 - IL_000b: volatile. - IL_000d: stsfld int32 valuetype Static_init_field/S2`1::'init@10-1' - IL_0012: ret - } - - .method public static object M() cil managed - { - - .maxstack 8 - IL_0000: volatile. - IL_0002: ldsfld int32 valuetype Static_init_field/S2`1::'init@10-1' - IL_0007: ldc.i4.1 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld object valuetype Static_init_field/S2`1::empty - IL_0016: ret - } - - .method public hidebysig virtual final - instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_0006: ldarga.s obj - IL_0008: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_000d: tail. - IL_000f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, - !!0) - IL_0014: ret - } - - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 4 - .locals init (valuetype Static_init_field/S2`1 V_0, - valuetype Static_init_field/S2`1 V_1) - IL_0000: ldarg.1 - IL_0001: isinst valuetype Static_init_field/S2`1 - IL_0006: brfalse.s IL_0026 - - IL_0008: ldarg.1 - IL_0009: unbox.any valuetype Static_init_field/S2`1 - IL_000e: stloc.0 - IL_000f: ldloc.0 - IL_0010: stloc.1 - IL_0011: ldarg.0 - IL_0012: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_0017: ldloca.s V_1 - IL_0019: ldfld !0[] valuetype Static_init_field/S2`1::x - IL_001e: tail. - IL_0020: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, - !!0) - IL_0025: ret - - IL_0026: ldc.i4.0 - IL_0027: ret - } - - } - -} - -.class private abstract auto ansi sealed ''.$Static_init_field$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl deleted file mode 100644 index 7f08989cd53..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,300 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Tailcall_last_expression_parens - extends [runtime]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 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@21-3' - extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 - { - .field static assembly initonly class Tailcall_last_expression_parens/'impl@21-3' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() - IL_0006: ret - } - - .method public strict virtual instance uint64 - Invoke(uint64 x, - uint64 acc) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.2 - IL_0002: tail. - IL_0004: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, - uint64) - IL_0009: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@21-3'::.ctor() - IL_0005: stsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance - IL_000a: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@29-5' - extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 - { - .field static assembly initonly class Tailcall_last_expression_parens/'impl@29-5' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() - IL_0006: ret - } - - .method public strict virtual instance uint64 - Invoke(uint64 x, - uint64 acc) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.2 - IL_0002: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, - uint64) - IL_0007: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@29-5'::.ctor() - IL_0005: stsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance - IL_000a: ret - } - - } - - .method assembly static uint64 impl@5(uint64 x, - uint64 acc) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brtrue.s IL_0005 - - IL_0003: ldarg.1 - IL_0004: ret - - IL_0005: ldarg.0 - IL_0006: ldc.i4.1 - IL_0007: conv.i8 - IL_0008: sub - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: mul - IL_000c: starg.s acc - IL_000e: starg.s x - IL_0010: br.s IL_0000 - } - - .method public static uint64 factorialOk1(uint64 x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::impl@5(uint64, - uint64) - IL_0008: ret - } - - .method assembly static uint64 'impl@13-1'(uint64 x, - uint64 acc) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brtrue.s IL_0005 - - IL_0003: ldarg.1 - IL_0004: ret - - IL_0005: ldarg.0 - IL_0006: ldc.i4.1 - IL_0007: conv.i8 - IL_0008: sub - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: mul - IL_000c: starg.s acc - IL_000e: starg.s x - IL_0010: br.s IL_0000 - } - - .method public static uint64 factorialOk2(uint64 x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::'impl@13-1'(uint64, - uint64) - IL_0008: ret - } - - .method assembly static uint64 'impl@21-2'(uint64 x, - uint64 acc) cil managed - { - - .maxstack 5 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) - IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance - IL_0005: stloc.0 - IL_0006: ldarg.0 - IL_0007: brtrue.s IL_000b - - IL_0009: ldarg.1 - IL_000a: ret - - IL_000b: ldloc.0 - IL_000c: ldarg.0 - IL_000d: ldc.i4.1 - IL_000e: conv.i8 - IL_000f: sub - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) - IL_0015: ldarg.0 - IL_0016: ldarg.1 - IL_0017: mul - IL_0018: tail. - IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001f: ret - } - - .method public static uint64 factorialNotOk1(uint64 x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: tail. - IL_0005: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, - uint64) - IL_000a: ret - } - - .method assembly static uint64 'impl@29-4'(uint64 x, - uint64 acc) cil managed - { - - .maxstack 5 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) - IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance - IL_0005: stloc.0 - IL_0006: ldarg.0 - IL_0007: brtrue.s IL_000b - - IL_0009: ldarg.1 - IL_000a: ret - - IL_000b: ldloc.0 - IL_000c: ldarg.0 - IL_000d: ldc.i4.1 - IL_000e: conv.i8 - IL_000f: sub - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) - IL_0015: ldarg.0 - IL_0016: ldarg.1 - IL_0017: mul - IL_0018: tail. - IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001f: ret - } - - .method public static uint64 factorialNotOk2(uint64 x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, - uint64) - IL_0008: ret - } - -} - -.class private abstract auto ansi sealed ''.$Tailcall_last_expression_parens$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.debug.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl deleted file mode 100644 index 8bd78c1214d..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.release.bsl +++ /dev/null @@ -1,117 +0,0 @@ - - - - - -.assembly extern runtime { } -.assembly extern FSharp.Core { } -.assembly extern System.Collections -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 -} -.assembly extern netstandard -{ - .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) - .ver 2:1:0:0 -} -.assembly extern runtime { } -.assembly assembly -{ - .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 ) - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.assembly -{ - - -} -.mresource public FSharpOptimizationData.assembly -{ - - -} -.module assembly.dll - -.imagebase {value} -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 - - - - - -.class public abstract auto ansi sealed Typedefof - extends [runtime]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 ) - .class auto ansi serializable nested public C - extends [runtime]System.Object - { - .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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ret - } - - .method public hidebysig instance void - M() cil managed - { - - .maxstack 3 - .locals init (class [runtime]System.Type V_0, - class [runtime]System.Type V_1) - IL_0000: ldtoken class [System.Collections]System.Collections.Generic.List`1 - IL_0005: call class [netstandard]System.Type [netstandard]System.Type::GetTypeFromHandle(valuetype [netstandard]System.RuntimeTypeHandle) - IL_000a: stloc.1 - IL_000b: ldloc.1 - IL_000c: callvirt instance bool [netstandard]System.Type::get_IsGenericType() - IL_0011: brfalse.s IL_001b - - IL_0013: ldloc.1 - IL_0014: callvirt instance class [netstandard]System.Type [netstandard]System.Type::GetGenericTypeDefinition() - IL_0019: br.s IL_001c - - IL_001b: ldloc.1 - IL_001c: stloc.0 - IL_001d: ret - } - - } - -} - -.class private abstract auto ansi sealed ''.$Typedefof$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() - IL_0005: ret - } - -} - - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl index 7f9efcee7b8..c8b5bf4f29c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl @@ -97,7 +97,7 @@ } - .field static assembly valuetype ''/T68512_24Bytes@ field68513@ at I_000039B4 + .field static assembly valuetype ''/T75332_24Bytes@ field75333@ at I_0000399B .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -253,7 +253,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T68512_24Bytes@ Use_binding_on_struct_enumerator::field68513@ + IL_0007: ldtoken field valuetype ''/T75332_24Bytes@ Use_binding_on_struct_enumerator::field75333@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -329,7 +329,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T68512_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T75332_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -341,7 +341,7 @@ -.data cil I_000039B4 = bytearray ( +.data cil I_0000399B = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) From 7a5b5419fb912b1fa757fffc044f58c644a7a3b6 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sun, 24 Mar 2024 10:09:29 +0100 Subject: [PATCH 05/13] adjust base lines, split for netcore / net472 targets --- ...ray_of_function_no_alloc.fsx.il.net472.bsl | 194 ++++++++++ ...y_of_function_no_alloc.fsx.il.netcore.bsl} | 0 .../samples/du_for_same_expression.fsx.il.bsl | 176 +++++++++ .../samples/for_loop_custom_step.fsx | 5 +- .../for_loop_custom_step.fsx.il.net472.bsl | 113 ++++++ ...> for_loop_custom_step.fsx.il.netcore.bsl} | 1 + .../for_loop_non_int.fsx.il.net472.bsl | 144 +++++++ ...hen_else_bool_expression.fsx.il.net472.bsl | 115 ++++++ ...n_else_bool_expression.fsx.il.netcore.bsl} | 1 + .../inplace_array_update.fsx.il.net472.bsl | 296 +++++++++++++++ ...> inplace_array_update.fsx.il.netcore.bsl} | 0 ...sion_non_constant_result.fsx.il.net472.bsl | 133 +++++++ ...on_non_constant_result.fsx.il.netcore.bsl} | 0 .../samples/spurious_tail.fsx.il.net472.bsl | 198 ++++++++++ ...l.bsl => spurious_tail.fsx.il.netcore.bsl} | 0 .../static_init_field.fsx.il.net472.bsl | 357 ++++++++++++++++++ ...l => static_init_field.fsx.il.netcore.bsl} | 0 ...l_last_expression_parens.fsx.il.net472.bsl | 300 +++++++++++++++ ...last_expression_parens.fsx.il.netcore.bsl} | 0 .../samples/typedefof.fsx.il.net472.bsl | 112 ++++++ ...sx.il.bsl => typedefof.fsx.il.netcore.bsl} | 0 ..._struct_enumerator.fsx.il.net472.debug.bsl | 342 +++++++++++++++++ ...truct_enumerator.fsx.il.net472.release.bsl | 347 +++++++++++++++++ ...struct_enumerator.fsx.il.netcore.debug.bsl | 9 +- 24 files changed, 2838 insertions(+), 5 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{array_of_function_no_alloc.fsx.il.bsl => array_of_function_no_alloc.fsx.il.netcore.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{for_loop_custom_step.fsx.il.bsl => for_loop_custom_step.fsx.il.netcore.bsl} (99%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{if_then_else_bool_expression.fsx.il.bsl => if_then_else_bool_expression.fsx.il.netcore.bsl} (99%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{inplace_array_update.fsx.il.bsl => inplace_array_update.fsx.il.netcore.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{option_elision_non_constant_result.fsx.il.bsl => option_elision_non_constant_result.fsx.il.netcore.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{spurious_tail.fsx.il.bsl => spurious_tail.fsx.il.netcore.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{static_init_field.fsx.il.bsl => static_init_field.fsx.il.netcore.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{tailcall_last_expression_parens.fsx.il.bsl => tailcall_last_expression_parens.fsx.il.netcore.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{typedefof.fsx.il.bsl => typedefof.fsx.il.netcore.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl new file mode 100644 index 00000000000..0b9edcf34be --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl @@ -0,0 +1,194 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Array_of_function_no_alloc + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit runAll@9 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field static assembly initonly class Array_of_function_no_alloc/runAll@9 @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] source, + int32 index) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Array_of_function_no_alloc/runAll@9::.ctor() + IL_0005: stsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance + IL_000a: ret + } + + } + + .method public static int32 exampleFunc(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.2 + IL_0002: add + IL_0003: ret + } + + .method public static int32 runAll(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, + int32 x) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_001a + + IL_0006: ldloc.0 + IL_0007: ldsfld class Array_of_function_no_alloc/runAll@9 Array_of_function_no_alloc/runAll@9::@_instance + IL_000c: ldarg.0 + IL_000d: ldloc.1 + IL_000e: ldarg.1 + IL_000f: call !!1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[],int32>::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>>, + !0, + !1, + !!0) + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.1 + IL_001a: ldloc.1 + IL_001b: ldarg.0 + IL_001c: ldlen + IL_001d: conv.i4 + IL_001e: blt.s IL_0006 + + IL_0020: ldloc.0 + IL_0021: ret + } + + .method public static int32 runAllNoAlloc(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2[] fArr, + int32 x) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: br.s IL_001c + + IL_0006: ldarg.0 + IL_0007: ldloc.1 + IL_0008: ldelem class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + IL_000d: stloc.2 + IL_000e: ldloc.0 + IL_000f: ldloc.2 + IL_0010: ldarg.1 + IL_0011: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.1 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: stloc.1 + IL_001c: ldloc.1 + IL_001d: ldarg.0 + IL_001e: ldlen + IL_001f: conv.i4 + IL_0020: blt.s IL_0006 + + IL_0022: ldloc.0 + IL_0023: ret + } + +} + +.class private abstract auto ansi sealed ''.$Array_of_function_no_alloc$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl new file mode 100644 index 00000000000..4884fb57f03 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl @@ -0,0 +1,176 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Du_for_same_expression + extends [runtime]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 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + map(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapping, + valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 result) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (!!c V_0, + !!a V_1) + IL_0000: ldarga.s result + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_001b + + IL_000c: ldarga.s result + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_001a: ret + + IL_001b: ldarga.s result + IL_001d: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0022: stloc.1 + IL_0023: ldarg.0 + IL_0024: ldloc.1 + IL_0025: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_002a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_002f: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1) + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: constrained. !!a + IL_002b: callvirt instance string [runtime]System.Object::ToString() + IL_0030: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0035: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 3 + .locals init (!!a V_0) + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Identity(!!0) + IL_0027: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_002c: ret + } + +} + +.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 3 + IL_0000: ldstr "" + IL_0005: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_000a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_000f: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0014: call void [runtime]System.Console::WriteLine(object) + IL_0019: ldstr "" + IL_001e: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0023: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0028: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_002d: call void [runtime]System.Console::WriteLine(object) + IL_0032: ldstr "" + IL_0037: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_003c: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0041: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0046: call void [runtime]System.Console::WriteLine(object) + IL_004b: ldstr "" + IL_0050: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0055: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_005a: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_005f: call void [runtime]System.Console::WriteLine(object) + IL_0064: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx index 781664041bf..bd9d176ddea 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx @@ -1,5 +1,8 @@ // -// { "optimization": { "reported_in": "#9548", "reported_by": "@teo-tsirpanis", "last_know_version_not_optimizing": "8", "first_known_version_optimizing": null } } +// { "optimization": { "reported_in": "#9548", "reported_by": "@teo-tsirpanis" +// , "last_know_version_not_optimizing": "8", "first_known_version_optimizing": 9 +// , "fixed_in" :"#16650", "fixed_by": "@brianrourkeboll"} +// } // open System diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl new file mode 100644 index 00000000000..67c94256b97 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl @@ -0,0 +1,113 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed For_loop_custom_step + extends [runtime]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 g() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, + class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.2 + IL_0002: ldc.i4.s 15 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0009: stloc.0 + IL_000a: ldloc.0 + IL_000b: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_0010: stloc.1 + .try + { + IL_0011: br.s IL_001e + + IL_0013: ldloc.1 + IL_0014: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_0019: call void [runtime]System.Console::WriteLine(int32) + IL_001e: ldloc.1 + IL_001f: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0024: brtrue.s IL_0013 + + IL_0026: leave.s IL_003a + + } + finally + { + IL_0028: ldloc.1 + IL_0029: isinst [runtime]System.IDisposable + IL_002e: stloc.2 + IL_002f: ldloc.2 + IL_0030: brfalse.s IL_0039 + + IL_0032: ldloc.2 + IL_0033: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0038: endfinally + IL_0039: endfinally + } + IL_003a: ret + } + +} + +.class private abstract auto ansi sealed ''.$For_loop_custom_step$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_custom_step::g() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.bsl similarity index 99% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.bsl index 841f1df59c1..f4dccbc72db 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.bsl @@ -111,3 +111,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl new file mode 100644 index 00000000000..df0ca617f03 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl @@ -0,0 +1,144 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed For_loop_non_int + extends [runtime]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 assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 + get_inputSequence@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0005: ret + } + + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 + get_enumerator@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_0005: ret + } + + .property class [runtime]System.Collections.Generic.IEnumerable`1 + inputSequence@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + } + .property class [runtime]System.Collections.Generic.IEnumerator`1 + enumerator@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + } +} + +.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx + extends [runtime]System.Object +{ + .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 5 + .locals init (int64 V_0, + class [runtime]System.IDisposable V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 100 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + IL_0016: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + .try + { + IL_0020: br.s IL_003d + + IL_0022: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0027: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_002c: stloc.0 + IL_002d: ldstr "hello" + IL_0032: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_0037: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_003c: pop + IL_003d: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0042: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0047: brtrue.s IL_0022 + + IL_0049: leave.s IL_0061 + + } + finally + { + IL_004b: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0050: isinst [runtime]System.IDisposable + IL_0055: stloc.1 + IL_0056: ldloc.1 + IL_0057: brfalse.s IL_0060 + + IL_0059: ldloc.1 + IL_005a: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_005f: endfinally + IL_0060: endfinally + } + IL_0061: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl new file mode 100644 index 00000000000..44a561bc0de --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl @@ -0,0 +1,115 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed If_then_else_bool_expression + extends [runtime]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 bool foo(bool a, + bool b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_0005 + + IL_0003: ldc.i4.0 + IL_0004: ret + + IL_0005: ldarg.1 + IL_0006: brfalse.s IL_000a + + IL_0008: ldc.i4.0 + IL_0009: ret + + IL_000a: ldc.i4.1 + IL_000b: ret + } + + .method public static bool bar(bool a, + bool b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0008 + + IL_0003: ldarg.1 + IL_0004: ldc.i4.0 + IL_0005: ceq + IL_0007: ret + + IL_0008: ldc.i4.0 + IL_0009: ret + } + +} + +.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: call bool If_then_else_bool_expression::foo(bool, + bool) + IL_0007: call void [runtime]System.Console::WriteLine(bool) + IL_000c: ldc.i4.1 + IL_000d: ldc.i4.0 + IL_000e: call bool If_then_else_bool_expression::bar(bool, + bool) + IL_0013: call void [runtime]System.Console::WriteLine(bool) + IL_0018: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.bsl similarity index 99% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.bsl index 754fdd99e8c..fc5e5a4078d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.bsl @@ -113,3 +113,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl new file mode 100644 index 00000000000..40f428ea39d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl @@ -0,0 +1,296 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Inplace_array_update + extends [runtime]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 ) + .class abstract auto ansi sealed nested public Foo + extends [runtime]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 !!a[] bar(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: tail. + IL_0005: call !!2[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Map2(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0[], + !!1[]) + IL_000a: ret + } + + .method public static void barInPlace(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0023 + + IL_0004: ldarg.2 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: ldloc.0 + IL_0009: ldelem !!a + IL_000e: ldarg.2 + IL_000f: ldloc.0 + IL_0010: ldelem !!a + IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001a: stelem !!a + IL_001f: ldloc.0 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.0 + IL_0023: ldloc.0 + IL_0024: ldarg.2 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_0004 + + IL_0029: ret + } + + .method public static void barInPlaceInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0023 + + IL_0004: ldarg.2 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: ldloc.0 + IL_0009: ldelem !!a + IL_000e: ldarg.2 + IL_000f: ldloc.0 + IL_0010: ldelem !!a + IL_0015: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_001a: stelem !!a + IL_001f: ldloc.0 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.0 + IL_0023: ldloc.0 + IL_0024: ldarg.2 + IL_0025: ldlen + IL_0026: conv.i4 + IL_0027: blt.s IL_0004 + + IL_0029: ret + } + + .method public static void barInPlaceOptClosure(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldc.i4.0 + IL_0008: stloc.1 + IL_0009: br.s IL_002a + + IL_000b: ldarg.2 + IL_000c: ldloc.1 + IL_000d: ldloc.0 + IL_000e: ldarg.1 + IL_000f: ldloc.1 + IL_0010: ldelem !!a + IL_0015: ldarg.2 + IL_0016: ldloc.1 + IL_0017: ldelem !!a + IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0021: stelem !!a + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldarg.2 + IL_002c: ldlen + IL_002d: conv.i4 + IL_002e: blt.s IL_000b + + IL_0030: ret + } + + .method public static void barInPlaceOptClosureInline(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> f, + !!a[] a, + !!a[] b) 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 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldc.i4.0 + IL_0008: stloc.1 + IL_0009: br.s IL_002a + + IL_000b: ldarg.2 + IL_000c: ldloc.1 + IL_000d: ldloc.0 + IL_000e: ldarg.1 + IL_000f: ldloc.1 + IL_0010: ldelem !!a + IL_0015: ldarg.2 + IL_0016: ldloc.1 + IL_0017: ldelem !!a + IL_001c: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0021: stelem !!a + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldarg.2 + IL_002c: ldlen + IL_002d: conv.i4 + IL_002e: blt.s IL_000b + + IL_0030: ret + } + + .method public static void barFunInside(float32[] a, + float32[] b) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + float32 V_1, + float32 V_2) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_002e + + IL_0004: ldarg.1 + IL_0005: ldloc.0 + IL_0006: ldarg.0 + IL_0007: ldloc.0 + IL_0008: ldelem [runtime]System.Single + IL_000d: stloc.1 + IL_000e: ldarg.1 + IL_000f: ldloc.0 + IL_0010: ldelem [runtime]System.Single + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.r4 0.69999999 + IL_001c: mul + IL_001d: ldloc.2 + IL_001e: ldc.r4 0.30000001 + IL_0023: mul + IL_0024: add + IL_0025: stelem [runtime]System.Single + IL_002a: ldloc.0 + IL_002b: ldc.i4.1 + IL_002c: add + IL_002d: stloc.0 + IL_002e: ldloc.0 + IL_002f: ldarg.1 + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: blt.s IL_0004 + + IL_0034: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Inplace_array_update$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl new file mode 100644 index 00000000000..29b06eeec9a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl @@ -0,0 +1,133 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Option_elision_non_constant_result + extends [runtime]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 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 + mapOption(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapper, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 option) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, + !!a V_1) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_0005 + + IL_0003: br.s IL_001b + + IL_0005: ldarg.1 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() + IL_000d: stloc.1 + IL_000e: ldarg.0 + IL_000f: ldloc.1 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_001a: ret + + IL_001b: ldnull + IL_001c: ret + } + + .method public static int32 almostErasedOption() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.5 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0006: brtrue.s IL_000a + + IL_0008: br.s IL_000c + + IL_000a: ldc.i4.5 + IL_000b: ret + + IL_000c: ldc.i4.4 + IL_000d: ret + } + + .method public static int32 unnecessaryOption() cil managed + { + + .maxstack 3 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0) + IL_0000: ldc.i4.5 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brtrue.s IL_000c + + IL_000a: br.s IL_0013 + + IL_000c: ldloc.0 + IL_000d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() + IL_0012: ret + + IL_0013: ldc.i4.4 + IL_0014: ret + } + +} + +.class private abstract auto ansi sealed ''.$Option_elision_non_constant_result$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl new file mode 100644 index 00000000000..25549cc1926 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl @@ -0,0 +1,198 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Spurious_tail + extends [runtime]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 ) + .class auto ansi serializable sealed nested public LoggerLevel + extends [runtime]System.Enum + { + .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 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype Spurious_tail/LoggerLevel A = int32(0x00000000) + .field public static literal valuetype Spurious_tail/LoggerLevel B = int32(0x00000001) + } + + .class auto ansi serializable nested public Logger + extends [runtime]System.Object + { + .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 ) + .field assembly class [runtime]System.Collections.Generic.List`1 messages + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4 0x2710 + IL_000e: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) + IL_0013: stfld class [runtime]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0018: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + string msg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0006: ldarg.2 + IL_0007: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) + IL_000c: ldarg.0 + IL_000d: callvirt instance void Spurious_tail/Logger::'nop'() + IL_0012: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + !!a obj) cil managed + { + + .maxstack 4 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Collections.Generic.List`1 Spurious_tail/Logger::messages + IL_0006: ldarg.2 + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: constrained. !!a + IL_0010: callvirt instance string [runtime]System.Object::ToString() + IL_0015: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) + IL_001a: ldarg.0 + IL_001b: callvirt instance void Spurious_tail/Logger::'nop'() + IL_0020: ret + } + + .method assembly hidebysig instance void + 'nop'() cil managed aggressiveinlining + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ret + } + + } + + .class auto ansi serializable nested public TailLogger + extends [runtime]System.Object + { + .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 ) + .field assembly class [runtime]System.Collections.Generic.List`1 messages + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: ldc.i4 0x2710 + IL_000e: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) + IL_0013: stfld class [runtime]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0018: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + string msg) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0006: ldarg.2 + IL_0007: tail. + IL_0009: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) + IL_000e: ret + } + + .method public hidebysig instance void + Log(valuetype Spurious_tail/LoggerLevel level, + !!a obj) cil managed + { + + .maxstack 4 + .locals init (!!a V_0) + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Collections.Generic.List`1 Spurious_tail/TailLogger::messages + IL_0006: ldarg.2 + IL_0007: stloc.0 + IL_0008: ldloca.s V_0 + IL_000a: constrained. !!a + IL_0010: callvirt instance string [runtime]System.Object::ToString() + IL_0015: tail. + IL_0017: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) + IL_001c: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Spurious_tail$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl new file mode 100644 index 00000000000..d2367032978 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl @@ -0,0 +1,357 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Static_init_field + extends [runtime]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 ) + .class auto ansi serializable nested public beforefieldinit S`1 + extends [runtime]System.Object + { + .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 ) + .field static assembly class Static_init_field/S`1 empty + .field static assembly int32 init@5 + .method public specialname rtspecialname + instance void .ctor(!T[] x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: newobj instance void class Static_init_field/S`1::.ctor(!0[]) + IL_0006: stsfld class Static_init_field/S`1 class Static_init_field/S`1::empty + IL_000b: ldc.i4.1 + IL_000c: volatile. + IL_000e: stsfld int32 class Static_init_field/S`1::init@5 + IL_0013: ret + } + + .method public specialname static class Static_init_field/S`1 + get_Empty() cil managed + { + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 class Static_init_field/S`1::init@5 + IL_0007: ldc.i4.1 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld class Static_init_field/S`1 class Static_init_field/S`1::empty + IL_0016: ret + } + + .property class Static_init_field/S`1 + Empty() + { + .get class Static_init_field/S`1 Static_init_field/S`1::get_Empty() + } + } + + .class sequential ansi serializable sealed nested public beforefieldinit S2`1 + extends [runtime]System.ValueType + implements class [runtime]System.IEquatable`1>, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IComparable`1>, + [runtime]System.IComparable, + [runtime]System.Collections.IStructuralComparable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .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 ) + .field static assembly object empty + .field static assembly int32 'init@10-1' + .field assembly !T[] x + .method public hidebysig virtual final + instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0005: ldarg.0 + IL_0006: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000b: ldarga.s obj + IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0012: tail. + IL_0014: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0019: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: unbox.any valuetype Static_init_field/S2`1 + IL_0006: stloc.0 + IL_0007: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_000c: ldarg.0 + IL_000d: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0012: ldloca.s V_0 + IL_0014: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0019: tail. + IL_001b: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_0020: ret + } + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: unbox.any valuetype Static_init_field/S2`1 + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: ldarg.0 + IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000e: ldloca.s V_0 + IL_0010: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0015: tail. + IL_0017: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonWithComparerIntrinsic(class [runtime]System.Collections.IComparer, + !!0, + !!0) + IL_001c: ret + } + + .method public hidebysig virtual final + instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4 0x9e3779b9 + IL_0007: ldarg.1 + IL_0008: ldarg.0 + IL_0009: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000e: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, + !!0) + IL_0013: ldloc.0 + IL_0014: ldc.i4.6 + IL_0015: shl + IL_0016: ldloc.0 + IL_0017: ldc.i4.2 + IL_0018: shr + IL_0019: add + IL_001a: add + IL_001b: add + IL_001c: stloc.0 + IL_001d: ldloc.0 + IL_001e: ret + } + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: call instance int32 valuetype Static_init_field/S2`1::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000b: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (valuetype Static_init_field/S2`1 V_0) + IL_0000: ldarg.1 + IL_0001: isinst valuetype Static_init_field/S2`1 + IL_0006: brfalse.s IL_0025 + + IL_0008: ldarg.1 + IL_0009: unbox.any valuetype Static_init_field/S2`1 + IL_000e: stloc.0 + IL_000f: ldarg.2 + IL_0010: ldarg.0 + IL_0011: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0016: ldloca.s V_0 + IL_0018: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_001d: tail. + IL_001f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityWithComparerIntrinsic(class [runtime]System.Collections.IEqualityComparer, + !!0, + !!0) + IL_0024: ret + + IL_0025: ldc.i4.0 + IL_0026: ret + } + + .method public specialname rtspecialname + instance void .ctor(!T[] x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld !0[] valuetype Static_init_field/S2`1::x + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call object valuetype Static_init_field/S2`1::M() + IL_0005: stsfld object valuetype Static_init_field/S2`1::empty + IL_000a: ldc.i4.1 + IL_000b: volatile. + IL_000d: stsfld int32 valuetype Static_init_field/S2`1::'init@10-1' + IL_0012: ret + } + + .method public static object M() cil managed + { + + .maxstack 8 + IL_0000: volatile. + IL_0002: ldsfld int32 valuetype Static_init_field/S2`1::'init@10-1' + IL_0007: ldc.i4.1 + IL_0008: bge.s IL_0011 + + IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() + IL_000f: br.s IL_0011 + + IL_0011: ldsfld object valuetype Static_init_field/S2`1::empty + IL_0016: ret + } + + .method public hidebysig virtual final + instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0006: ldarga.s obj + IL_0008: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_000d: tail. + IL_000f: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, + !!0) + IL_0014: ret + } + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (valuetype Static_init_field/S2`1 V_0, + valuetype Static_init_field/S2`1 V_1) + IL_0000: ldarg.1 + IL_0001: isinst valuetype Static_init_field/S2`1 + IL_0006: brfalse.s IL_0026 + + IL_0008: ldarg.1 + IL_0009: unbox.any valuetype Static_init_field/S2`1 + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: stloc.1 + IL_0011: ldarg.0 + IL_0012: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_0017: ldloca.s V_1 + IL_0019: ldfld !0[] valuetype Static_init_field/S2`1::x + IL_001e: tail. + IL_0020: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityERIntrinsic(!!0, + !!0) + IL_0025: ret + + IL_0026: ldc.i4.0 + IL_0027: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Static_init_field$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl new file mode 100644 index 00000000000..15c5d84b476 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl @@ -0,0 +1,300 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Tailcall_last_expression_parens + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@21-3' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Tailcall_last_expression_parens/'impl@21-3' @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: tail. + IL_0004: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, + uint64) + IL_0009: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@21-3'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@29-5' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Tailcall_last_expression_parens/'impl@29-5' @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, + uint64) + IL_0007: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@29-5'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_000a: ret + } + + } + + .method assembly static uint64 impl@5(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.1 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 + } + + .method public static uint64 factorialOk1(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::impl@5(uint64, + uint64) + IL_0008: ret + } + + .method assembly static uint64 'impl@13-1'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.1 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 + } + + .method public static uint64 factorialOk2(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::'impl@13-1'(uint64, + uint64) + IL_0008: ret + } + + .method assembly static uint64 'impl@21-2'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: brtrue.s IL_000b + + IL_0009: ldarg.1 + IL_000a: ret + + IL_000b: ldloc.0 + IL_000c: ldarg.0 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: sub + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_0015: ldarg.0 + IL_0016: ldarg.1 + IL_0017: mul + IL_0018: tail. + IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001f: ret + } + + .method public static uint64 factorialNotOk1(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: tail. + IL_0005: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, + uint64) + IL_000a: ret + } + + .method assembly static uint64 'impl@29-4'(uint64 x, + uint64 acc) cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: brtrue.s IL_000b + + IL_0009: ldarg.1 + IL_000a: ret + + IL_000b: ldloc.0 + IL_000c: ldarg.0 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: sub + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_0015: ldarg.0 + IL_0016: ldarg.1 + IL_0017: mul + IL_0018: tail. + IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001f: ret + } + + .method public static uint64 factorialNotOk2(uint64 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, + uint64) + IL_0008: ret + } + +} + +.class private abstract auto ansi sealed ''.$Tailcall_last_expression_parens$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl new file mode 100644 index 00000000000..2b118a7f177 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl @@ -0,0 +1,112 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:0:0:0 +} +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Typedefof + extends [runtime]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 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .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 ) + .method public specialname rtspecialname + instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ret + } + + .method public hidebysig instance void + M() cil managed + { + + .maxstack 3 + .locals init (class [runtime]System.Type V_0, + class [runtime]System.Type V_1) + IL_0000: ldtoken class [runtime]System.Collections.Generic.List`1 + IL_0005: call class [netstandard]System.Type [netstandard]System.Type::GetTypeFromHandle(valuetype [netstandard]System.RuntimeTypeHandle) + IL_000a: stloc.1 + IL_000b: ldloc.1 + IL_000c: callvirt instance bool [netstandard]System.Type::get_IsGenericType() + IL_0011: brfalse.s IL_001b + + IL_0013: ldloc.1 + IL_0014: callvirt instance class [netstandard]System.Type [netstandard]System.Type::GetGenericTypeDefinition() + IL_0019: br.s IL_001c + + IL_001b: ldloc.1 + IL_001c: stloc.0 + IL_001d: ret + } + + } + +} + +.class private abstract auto ansi sealed ''.$Typedefof$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl new file mode 100644 index 00000000000..fda509152f7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl @@ -0,0 +1,342 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:0:0:0 +} +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Use_binding_on_struct_enumerator + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit testFoldOnListT@32 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance string + Invoke(string state, + int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: box [runtime]System.Int32 + IL_0007: unbox.any [runtime]System.IFormattable + IL_000c: ldnull + IL_000d: call class [netstandard]System.Globalization.CultureInfo [netstandard]System.Globalization.CultureInfo::get_InvariantCulture() + IL_0012: callvirt instance string [netstandard]System.IFormattable::ToString(string, + class [netstandard]System.IFormatProvider) + IL_0017: call string [runtime]System.String::Concat(string, + string) + IL_001c: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Use_binding_on_struct_enumerator/testFoldOnListT@32::.ctor() + IL_0005: stsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_000a: ret + } + + } + + .field static assembly valuetype ''/T71036_24Bytes@ field71037@ at I_00003917 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TEnumerator enumerator) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 0A 66 6F 6C 64 53 74 72 6F 6E 67 00 00 ) + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + !!TEnumerator V_1, + !!State V_2, + !!TEnumerator V_3) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: stloc.1 + IL_0009: ldarg.1 + IL_000a: stloc.2 + IL_000b: br.s IL_0024 + + IL_000d: ldloc.0 + IL_000e: ldloc.2 + IL_000f: ldarg.2 + IL_0010: stloc.3 + IL_0011: ldloca.s V_3 + IL_0013: constrained. !!TEnumerator + IL_0019: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_001e: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0023: stloc.2 + IL_0024: ldloca.s V_1 + IL_0026: constrained. !!TEnumerator + IL_002c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0031: brtrue.s IL_000d + + IL_0033: ldloc.2 + IL_0034: ret + } + + .method public static !!State Fold) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: brfalse.s IL_000b + + IL_0003: ldnull + IL_0004: unbox.any !!TEnumerator + IL_0009: br.s IL_0016 + + IL_000b: ldstr "Dynamic invocation of GetEnumerator is not supported" + IL_0010: newobj instance void [runtime]System.NotSupportedException::.ctor(string) + IL_0015: throw + + IL_0016: stloc.0 + .try + { + IL_0017: ldarg.0 + IL_0018: ldarg.1 + IL_0019: ldloc.0 + IL_001a: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_001f: stloc.1 + IL_0020: leave.s IL_0039 + + } + finally + { + IL_0022: ldloc.0 + IL_0023: box !!TEnumerator + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.2 + IL_002e: ldloc.2 + IL_002f: brfalse.s IL_0038 + + IL_0031: ldloc.2 + IL_0032: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0037: endfinally + IL_0038: endfinally + } + IL_0039: ldloc.1 + IL_003a: ret + } + + .method public static !!State Fold$W) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 getEnumerator, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldarg.0 + IL_0001: ldarg.3 + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + .try + { + IL_0008: ldarg.1 + IL_0009: ldarg.2 + IL_000a: ldloc.0 + IL_000b: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0010: stloc.1 + IL_0011: leave.s IL_002a + + } + finally + { + IL_0013: ldloc.0 + IL_0014: box !!TEnumerator + IL_0019: isinst [runtime]System.IDisposable + IL_001e: stloc.2 + IL_001f: ldloc.2 + IL_0020: brfalse.s IL_0029 + + IL_0022: ldloc.2 + IL_0023: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0028: endfinally + IL_0029: endfinally + } + IL_002a: ldloc.1 + IL_002b: ret + } + + .method public static string testFoldOnListT() cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Collections.Generic.List`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_1, + valuetype [runtime]System.Collections.Generic.List`1/Enumerator V_2, + string V_3, + class [runtime]System.IDisposable V_4) + IL_0000: ldc.i4.6 + IL_0001: newarr [runtime]System.Int32 + IL_0006: dup + IL_0007: ldtoken field valuetype ''/T71036_24Bytes@ Use_binding_on_struct_enumerator::field71037@ + IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, + valuetype [runtime]System.RuntimeFieldHandle) + IL_0011: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.0 + IL_0017: ldsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_001c: stloc.1 + IL_001d: ldloc.0 + IL_001e: callvirt instance valuetype [runtime]System.Collections.Generic.List`1/Enumerator class [runtime]System.Collections.Generic.List`1::GetEnumerator() + IL_0023: stloc.2 + .try + { + IL_0024: ldloc.1 + IL_0025: ldstr "" + IL_002a: ldloc.2 + IL_002b: call !!0 Use_binding_on_struct_enumerator::FoldStrong>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0030: stloc.3 + IL_0031: leave.s IL_004d + + } + finally + { + IL_0033: ldloc.2 + IL_0034: box valuetype [runtime]System.Collections.Generic.List`1/Enumerator + IL_0039: isinst [runtime]System.IDisposable + IL_003e: stloc.s V_4 + IL_0040: ldloc.s V_4 + IL_0042: brfalse.s IL_004c + + IL_0044: ldloc.s V_4 + IL_0046: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_004b: endfinally + IL_004c: endfinally + } + IL_004d: ldloc.3 + IL_004e: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_0006: ldsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_000b: pop + IL_000c: ret + } + +} + +.class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + +} + +.class private abstract auto ansi sealed beforefieldinit '' + extends [runtime]System.Object +{ + .class explicit ansi sealed nested assembly beforefieldinit T71036_24Bytes@ + extends [runtime]System.ValueType + { + .pack 0 + .size 24 + } + +} + + + + +.data cil I_00003917 = bytearray ( + 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 + 05 00 00 00 08 00 00 00) + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl new file mode 100644 index 00000000000..c8b5bf4f29c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl @@ -0,0 +1,347 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly extern System.Collections +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 8:0:0:0 +} +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 +} +.assembly extern runtime { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Use_binding_on_struct_enumerator + extends [runtime]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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit testFoldOnListT@32 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance string + Invoke(string state, + int32 x) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: box [runtime]System.Int32 + IL_0007: unbox.any [runtime]System.IFormattable + IL_000c: ldnull + IL_000d: call class [netstandard]System.Globalization.CultureInfo [netstandard]System.Globalization.CultureInfo::get_InvariantCulture() + IL_0012: callvirt instance string [netstandard]System.IFormattable::ToString(string, + class [netstandard]System.IFormatProvider) + IL_0017: call string [runtime]System.String::Concat(string, + string) + IL_001c: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Use_binding_on_struct_enumerator/testFoldOnListT@32::.ctor() + IL_0005: stsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_000a: ret + } + + } + + .field static assembly valuetype ''/T75332_24Bytes@ field75333@ at I_0000399B + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TEnumerator enumerator) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 0A 66 6F 6C 64 53 74 72 6F 6E 67 00 00 ) + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 V_0, + !!TEnumerator V_1, + !!State V_2, + !!TEnumerator V_3) + IL_0000: ldarg.0 + IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Adapt(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0006: stloc.0 + IL_0007: ldarg.2 + IL_0008: stloc.1 + IL_0009: ldarg.1 + IL_000a: stloc.2 + IL_000b: br.s IL_0024 + + IL_000d: ldloc.0 + IL_000e: ldloc.2 + IL_000f: ldarg.2 + IL_0010: stloc.3 + IL_0011: ldloca.s V_3 + IL_0013: constrained. !!TEnumerator + IL_0019: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_001e: callvirt instance !2 class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::Invoke(!0, + !1) + IL_0023: stloc.2 + IL_0024: ldloca.s V_1 + IL_0026: constrained. !!TEnumerator + IL_002c: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0031: brtrue.s IL_000d + + IL_0033: ldloc.2 + IL_0034: ret + } + + .method public static !!State Fold) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldc.i4.0 + IL_0001: brfalse.s IL_000b + + IL_0003: ldnull + IL_0004: unbox.any !!TEnumerator + IL_0009: br.s IL_0016 + + IL_000b: ldstr "Dynamic invocation of GetEnumerator is not supported" + IL_0010: newobj instance void [runtime]System.NotSupportedException::.ctor(string) + IL_0015: throw + + IL_0016: stloc.0 + .try + { + IL_0017: ldarg.0 + IL_0018: ldarg.1 + IL_0019: ldloc.0 + IL_001a: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_001f: stloc.1 + IL_0020: leave.s IL_0039 + + } + finally + { + IL_0022: ldloc.0 + IL_0023: box !!TEnumerator + IL_0028: isinst [runtime]System.IDisposable + IL_002d: stloc.2 + IL_002e: ldloc.2 + IL_002f: brfalse.s IL_0038 + + IL_0031: ldloc.2 + IL_0032: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0037: endfinally + IL_0038: endfinally + } + IL_0039: ldloc.1 + IL_003a: ret + } + + .method public static !!State Fold$W) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 getEnumerator, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 04 66 6F 6C 64 00 00 ) + + .maxstack 5 + .locals init (!!TEnumerator V_0, + !!State V_1, + class [runtime]System.IDisposable V_2) + IL_0000: ldarg.0 + IL_0001: ldarg.3 + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + .try + { + IL_0008: ldarg.1 + IL_0009: ldarg.2 + IL_000a: ldloc.0 + IL_000b: call !!0 Use_binding_on_struct_enumerator::FoldStrong(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0010: stloc.1 + IL_0011: leave.s IL_002a + + } + finally + { + IL_0013: ldloc.0 + IL_0014: box !!TEnumerator + IL_0019: isinst [runtime]System.IDisposable + IL_001e: stloc.2 + IL_001f: ldloc.2 + IL_0020: brfalse.s IL_0029 + + IL_0022: ldloc.2 + IL_0023: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0028: endfinally + IL_0029: endfinally + } + IL_002a: ldloc.1 + IL_002b: ret + } + + .method public static string testFoldOnListT() cil managed + { + + .maxstack 5 + .locals init (class [System.Collections]System.Collections.Generic.List`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_1, + valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator V_2, + string V_3, + class [runtime]System.IDisposable V_4) + IL_0000: ldc.i4.6 + IL_0001: newarr [runtime]System.Int32 + IL_0006: dup + IL_0007: ldtoken field valuetype ''/T75332_24Bytes@ Use_binding_on_struct_enumerator::field75333@ + IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, + valuetype [runtime]System.RuntimeFieldHandle) + IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stloc.0 + IL_0017: ldsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance + IL_001c: stloc.1 + IL_001d: ldloc.0 + IL_001e: callvirt instance valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator class [System.Collections]System.Collections.Generic.List`1::GetEnumerator() + IL_0023: stloc.2 + .try + { + IL_0024: ldloc.1 + IL_0025: ldstr "" + IL_002a: ldloc.2 + IL_002b: call !!0 Use_binding_on_struct_enumerator::FoldStrong>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) + IL_0030: stloc.3 + IL_0031: leave.s IL_004d + + } + finally + { + IL_0033: ldloc.2 + IL_0034: box valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator + IL_0039: isinst [runtime]System.IDisposable + IL_003e: stloc.s V_4 + IL_0040: ldloc.s V_4 + IL_0042: brfalse.s IL_004c + + IL_0044: ldloc.s V_4 + IL_0046: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_004b: endfinally + IL_004c: endfinally + } + IL_004d: ldloc.3 + IL_004e: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_0006: ldsfld int32 ''.$Use_binding_on_struct_enumerator$fsx::init@ + IL_000b: pop + IL_000c: ret + } + +} + +.class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + +} + +.class private abstract auto ansi sealed beforefieldinit '' + extends [runtime]System.Object +{ + .class explicit ansi sealed nested assembly beforefieldinit T75332_24Bytes@ + extends [runtime]System.ValueType + { + .pack 0 + .size 24 + } + +} + + + + +.data cil I_0000399B = bytearray ( + 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 + 05 00 00 00 08 00 00 00) + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl index 7e87b34019b..db0bab7c51c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl @@ -97,7 +97,7 @@ } - .field static assembly valuetype ''/T71309_24Bytes@ field71310@ at I_000039AA + .field static assembly valuetype ''/T71036_24Bytes@ field71037@ at I_0000395F .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -253,7 +253,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T71309_24Bytes@ Use_binding_on_struct_enumerator::field71310@ + IL_0007: ldtoken field valuetype ''/T71036_24Bytes@ Use_binding_on_struct_enumerator::field71037@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -329,7 +329,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T71309_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T71036_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -341,7 +341,8 @@ -.data cil I_000039AA = bytearray ( +.data cil I_0000395F = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) + From d445b75605f634a504861b04c3874533a7edba43 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Tue, 26 Mar 2024 19:46:52 +0100 Subject: [PATCH 06/13] update baselines --- ...ray_of_function_no_alloc.fsx.il.net472.bsl | 30 +- ...ay_of_function_no_alloc.fsx.il.netcore.bsl | 31 +- .../samples/du_for_same_expression.fsx.il.bsl | 44 +- ...r_same_expression.fsx.il.netcore.debug.bsl | 45 +- .../for_loop_custom_step.fsx.il.net472.bsl | 24 +- .../for_loop_custom_step.fsx.il.netcore.bsl | 24 +- .../for_loop_non_int.fsx.il.net472.bsl | 85 +-- .../for_loop_non_int.fsx.il.netcore.debug.bsl | 81 +-- ...hen_else_bool_expression.fsx.il.net472.bsl | 38 +- ...en_else_bool_expression.fsx.il.netcore.bsl | 38 +- .../inplace_array_update.fsx.il.net472.bsl | 24 +- .../inplace_array_update.fsx.il.netcore.bsl | 25 +- .../samples/lambda_inlining.fsx.il.bsl | 532 +++++++++--------- ...sion_non_constant_result.fsx.il.net472.bsl | 24 +- ...ion_non_constant_result.fsx.il.netcore.bsl | 25 +- .../samples/spurious_tail.fsx.il.net472.bsl | 33 +- .../samples/spurious_tail.fsx.il.netcore.bsl | 36 +- .../static_init_field.fsx.il.net472.bsl | 57 +- .../static_init_field.fsx.il.netcore.bsl | 58 +- ...l_last_expression_parens.fsx.il.net472.bsl | 348 +++++++----- ..._last_expression_parens.fsx.il.netcore.bsl | 349 +++++++----- .../samples/typedefof.fsx.il.net472.bsl | 30 +- .../samples/typedefof.fsx.il.netcore.bsl | 33 +- ..._struct_enumerator.fsx.il.net472.debug.bsl | 34 +- ...struct_enumerator.fsx.il.netcore.debug.bsl | 36 +- 25 files changed, 1272 insertions(+), 812 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl index 0b9edcf34be..39dffd1b737 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.net472.bsl @@ -43,8 +43,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field static assembly initonly class Array_of_function_no_alloc/runAll@9 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -67,8 +66,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -167,6 +165,25 @@ IL_0023: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Array_of_function_no_alloc$fsx::init@ + IL_0006: ldsfld int32 ''.$Array_of_function_no_alloc$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Array_of_function_no_alloc$fsx @@ -176,12 +193,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Array_of_function_no_alloc::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.bsl index ad36e15d2d8..474229111ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.il.netcore.bsl @@ -44,8 +44,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3[],int32,class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field static assembly initonly class Array_of_function_no_alloc/runAll@9 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -68,8 +67,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -168,6 +166,25 @@ IL_0023: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Array_of_function_no_alloc$fsx::init@ + IL_0006: ldsfld int32 ''.$Array_of_function_no_alloc$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Array_of_function_no_alloc$fsx @@ -177,12 +194,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Array_of_function_no_alloc::staticInitialization@() IL_0005: ret } @@ -192,3 +208,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl index 4884fb57f03..a1656131408 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl @@ -72,8 +72,7 @@ IL_002f: ret } - .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 - ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed { .maxstack 3 @@ -103,8 +102,7 @@ IL_0035: ret } - .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 - ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed { .maxstack 3 @@ -130,17 +128,18 @@ IL_002c: ret } -} + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_0006: ldsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_000b: pop + IL_000c: ret + } -.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 3 @@ -169,6 +168,23 @@ } +.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void Du_for_same_expression::staticInitialization@() + IL_0005: ret + } + +} + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.debug.bsl index b5f17e0c867..cb3a48ce126 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.debug.bsl @@ -73,8 +73,7 @@ IL_002f: ret } - .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 - ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed { .maxstack 3 @@ -104,8 +103,7 @@ IL_0035: ret } - .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 - ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed { .maxstack 3 @@ -131,17 +129,18 @@ IL_002c: ret } -} + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_0006: ldsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_000b: pop + IL_000c: ret + } -.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 3 @@ -170,6 +169,24 @@ } +.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void Du_for_same_expression::staticInitialization@() + IL_0005: ret + } + +} + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl index 67c94256b97..5cef9f96c1e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.net472.bsl @@ -86,6 +86,25 @@ IL_003a: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$For_loop_custom_step$fsx::init@ + IL_0006: ldsfld int32 ''.$For_loop_custom_step$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_custom_step::g() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$For_loop_custom_step$fsx @@ -95,12 +114,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void For_loop_custom_step::g() + IL_0000: call void For_loop_custom_step::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.bsl index f4dccbc72db..3f1c43f9852 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.il.netcore.bsl @@ -87,6 +87,25 @@ IL_003a: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$For_loop_custom_step$fsx::init@ + IL_0006: ldsfld int32 ''.$For_loop_custom_step$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_custom_step::g() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$For_loop_custom_step$fsx @@ -96,12 +115,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void For_loop_custom_step::g() + IL_0000: call void For_loop_custom_step::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl index df0ca617f03..013cc35284e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl @@ -39,51 +39,38 @@ extends [runtime]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 assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 - get_inputSequence@4() cil managed + .field static assembly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 get_inputSequence@4() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 IL_0005: ret } - .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 - get_enumerator@4() cil managed + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 get_enumerator@4() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 IL_0005: ret } - .property class [runtime]System.Collections.Generic.IEnumerable`1 - inputSequence@4() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() - } - .property class [runtime]System.Collections.Generic.IEnumerator`1 - enumerator@4() + .method private specialname rtspecialname static void .cctor() cil managed { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_0006: ldsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_000b: pop + IL_000c: ret } -} -.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx - extends [runtime]System.Object -{ - .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 5 @@ -96,12 +83,12 @@ IL_0004: ldc.i4.s 100 IL_0006: conv.i8 IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, - int64, - int64) - IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + int64, + int64) + IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() IL_0016: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 .try { IL_0020: br.s IL_003d @@ -136,9 +123,39 @@ IL_0061: ret } + .property class [runtime]System.Collections.Generic.IEnumerable`1 + inputSequence@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + } + .property class [runtime]System.Collections.Generic.IEnumerator`1 + enumerator@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + } +} + +.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_non_int::staticInitialization@() + IL_0005: ret + } + } + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.debug.bsl index df0ca617f03..1c8f81f7893 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.debug.bsl @@ -39,51 +39,38 @@ extends [runtime]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 assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 - get_inputSequence@4() cil managed + .field static assembly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 get_inputSequence@4() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 IL_0005: ret } - .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 - get_enumerator@4() cil managed + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 get_enumerator@4() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 IL_0005: ret } - .property class [runtime]System.Collections.Generic.IEnumerable`1 - inputSequence@4() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() - } - .property class [runtime]System.Collections.Generic.IEnumerator`1 - enumerator@4() + .method private specialname rtspecialname static void .cctor() cil managed { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_0006: ldsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_000b: pop + IL_000c: ret } -} -.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx - extends [runtime]System.Object -{ - .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 5 @@ -98,10 +85,10 @@ IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, int64, int64) - IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() IL_0016: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 .try { IL_0020: br.s IL_003d @@ -136,9 +123,39 @@ IL_0061: ret } + .property class [runtime]System.Collections.Generic.IEnumerable`1 + inputSequence@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + } + .property class [runtime]System.Collections.Generic.IEnumerator`1 + enumerator@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + } +} + +.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_non_int::staticInitialization@() + IL_0005: ret + } + } + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl index 44a561bc0de..ee9de97e33f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.net472.bsl @@ -79,17 +79,18 @@ IL_0009: ret } -} + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$If_then_else_bool_expression$fsx::init@ + IL_0006: ldsfld int32 ''.$If_then_else_bool_expression$fsx::init@ + IL_000b: pop + IL_000c: ret + } -.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 8 @@ -108,6 +109,23 @@ } +.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void If_then_else_bool_expression::staticInitialization@() + IL_0005: ret + } + +} + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.bsl index fc5e5a4078d..0a45b2f2763 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.il.netcore.bsl @@ -80,17 +80,18 @@ IL_0009: ret } -} + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$If_then_else_bool_expression$fsx::init@ + IL_0006: ldsfld int32 ''.$If_then_else_bool_expression$fsx::init@ + IL_000b: pop + IL_000c: ret + } -.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 8 @@ -109,6 +110,23 @@ } +.class private abstract auto ansi sealed ''.$If_then_else_bool_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void If_then_else_bool_expression::staticInitialization@() + IL_0005: ret + } + +} + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl index 40f428ea39d..5b3fea2cc3f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.net472.bsl @@ -269,6 +269,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Inplace_array_update$fsx::init@ + IL_0006: ldsfld int32 ''.$Inplace_array_update$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Inplace_array_update$fsx @@ -278,12 +297,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Inplace_array_update::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.bsl index 01bd5b94704..8b377601531 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.il.netcore.bsl @@ -270,6 +270,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Inplace_array_update$fsx::init@ + IL_0006: ldsfld int32 ''.$Inplace_array_update$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Inplace_array_update$fsx @@ -279,12 +298,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Inplace_array_update::staticInitialization@() IL_0005: ret } @@ -294,3 +312,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl index a005329849e..b4314541564 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.il.bsl @@ -63,8 +63,7 @@ IL_0014: ret } - .method public strict virtual instance bool - Invoke(!b v) cil managed + .method public strict virtual instance bool Invoke(!b v) cil managed { .maxstack 8 @@ -93,8 +92,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(int32[] vs) cil managed + .method assembly specialname rtspecialname instance void .ctor(int32[] vs) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -108,8 +106,7 @@ IL_000d: ret } - .method public strict virtual instance bool - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + .method public strict virtual instance bool Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed { .maxstack 7 @@ -158,8 +155,7 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -173,8 +169,7 @@ IL_000d: ret } - .method public strict virtual instance bool - Invoke(int32 v) cil managed + .method public strict virtual instance bool Invoke(int32 v) cil managed { .maxstack 8 @@ -196,11 +191,214 @@ extends [runtime]System.Object { .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 ) + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined2@35 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/Test/thisIsNotInlined2@35::vs + IL_000d: ret + } + + .method public strict virtual instance bool Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/Test/thisIsNotInlined2@35::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/Test/thisIsNotInlined2@35::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/Test/thisIsNotInlined2@35::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined2@35-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/Test/'thisIsNotInlined2@35-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/Test/'thisIsNotInlined2@35-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/Test/'thisIsNotInlined2@35-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined3@36 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> + { + .field public int32[] vs + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32[] vs) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32[] Lambda_inlining/Test/thisIsNotInlined3@36::vs + IL_000d: ret + } + + .method public strict virtual instance bool Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_0008 + + IL_0004: ldloc.0 + IL_0005: ldc.i4.1 + IL_0006: add + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.0 + IL_000a: ldfld int32[] Lambda_inlining/Test/thisIsNotInlined3@36::vs + IL_000f: ldlen + IL_0010: conv.i4 + IL_0011: bge.s IL_0027 + + IL_0013: ldarg.1 + IL_0014: ldarg.0 + IL_0015: ldfld int32[] Lambda_inlining/Test/thisIsNotInlined3@36::vs + IL_001a: ldloc.0 + IL_001b: ldelem [runtime]System.Int32 + IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0025: br.s IL_0028 + + IL_0027: ldc.i4.0 + IL_0028: brtrue.s IL_0004 + + IL_002a: ldloc.0 + IL_002b: ldarg.0 + IL_002c: ldfld int32[] Lambda_inlining/Test/thisIsNotInlined3@36::vs + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ceq + IL_0035: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined3@36-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/Test/'thisIsNotInlined3@36-1'::s + IL_000d: ret + } + + .method public strict virtual instance bool Invoke(int32 v) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/Test/'thisIsNotInlined3@36-1'::s + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/Test/'thisIsNotInlined3@36-1'::s + IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() + IL_0011: ldarg.1 + IL_0012: add + IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) + IL_0018: ldc.i4.1 + IL_0019: ret + } + + } + .field assembly int32[] _values .field static assembly int32[] _svalues .field static assembly int32 init@26 - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -221,8 +419,7 @@ IL_0024: ret } - .method public hidebysig instance int32 - thisIsInlined2() cil managed + .method public hidebysig instance int32 thisIsInlined2() cil managed { .maxstack 4 @@ -269,8 +466,7 @@ IL_0036: ret } - .method public hidebysig instance int32 - thisIsInlined3() cil managed + .method public hidebysig instance int32 thisIsInlined3() cil managed { .maxstack 8 @@ -281,8 +477,7 @@ IL_000c: ret } - .method public hidebysig instance int32 - thisIsNotInlined2() cil managed + .method public hidebysig instance int32 thisIsNotInlined2() cil managed { .maxstack 4 @@ -293,14 +488,14 @@ IL_0001: ldfld int32[] Lambda_inlining/Test::_values IL_0006: stloc.1 IL_0007: ldloc.1 - IL_0008: newobj instance void Lambda_inlining/thisIsNotInlined2@35::.ctor(int32[]) + IL_0008: newobj instance void Lambda_inlining/Test/thisIsNotInlined2@35::.ctor(int32[]) IL_000d: stloc.0 IL_000e: ldc.i4.0 IL_000f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) IL_0014: stloc.2 IL_0015: ldloc.0 IL_0016: ldloc.2 - IL_0017: newobj instance void Lambda_inlining/'thisIsNotInlined2@35-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_0017: newobj instance void Lambda_inlining/Test/'thisIsNotInlined2@35-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) IL_0021: pop IL_0022: ldloc.2 @@ -308,8 +503,7 @@ IL_0028: ret } - .method public hidebysig instance int32 - thisIsNotInlined3() cil managed + .method public hidebysig instance int32 thisIsNotInlined3() cil managed { .maxstack 4 @@ -327,14 +521,14 @@ IL_0011: ldsfld int32[] Lambda_inlining/Test::_svalues IL_0016: stloc.1 IL_0017: ldloc.1 - IL_0018: newobj instance void Lambda_inlining/thisIsNotInlined3@36::.ctor(int32[]) + IL_0018: newobj instance void Lambda_inlining/Test/thisIsNotInlined3@36::.ctor(int32[]) IL_001d: stloc.0 IL_001e: ldc.i4.0 IL_001f: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) IL_0024: stloc.2 IL_0025: ldloc.0 IL_0026: ldloc.2 - IL_0027: newobj instance void Lambda_inlining/'thisIsNotInlined3@36-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_0027: newobj instance void Lambda_inlining/Test/'thisIsNotInlined3@36-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::Invoke(!0) IL_0031: pop IL_0032: ldloc.2 @@ -342,8 +536,7 @@ IL_0038: ret } - .method assembly hidebysig instance int32 - 'array'(int32[] vs) cil managed + .method assembly hidebysig instance int32 'array'(int32[] vs) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -391,8 +584,7 @@ IL_002a: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -403,220 +595,29 @@ IL_000c: ret } - } - - .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined2@35 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> - { - .field public int32[] vs - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(int32[] vs) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed - { - - .maxstack 7 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0008 - - IL_0004: ldloc.0 - IL_0005: ldc.i4.1 - IL_0006: add - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: ldarg.0 - IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_000f: ldlen - IL_0010: conv.i4 - IL_0011: bge.s IL_0027 - - IL_0013: ldarg.1 - IL_0014: ldarg.0 - IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_001a: ldloc.0 - IL_001b: ldelem [runtime]System.Int32 - IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0025: br.s IL_0028 - - IL_0027: ldc.i4.0 - IL_0028: brtrue.s IL_0004 - - IL_002a: ldloc.0 - IL_002b: ldarg.0 - IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined2@35::vs - IL_0031: ldlen - IL_0032: conv.i4 - IL_0033: ceq - IL_0035: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined2@35-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(int32 v) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined2@35-1'::s - IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0011: ldarg.1 - IL_0012: add - IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) - IL_0018: ldc.i4.1 - IL_0019: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit thisIsNotInlined3@36 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool> - { - .field public int32[] vs - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(int32[] vs) cil managed + .method assembly specialname static void staticInitialization@() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,bool>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed - { - - .maxstack 7 - .locals init (int32 V_0) IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_0008 - - IL_0004: ldloc.0 - IL_0005: ldc.i4.1 - IL_0006: add - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: ldarg.0 - IL_000a: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_000f: ldlen - IL_0010: conv.i4 - IL_0011: bge.s IL_0027 - - IL_0013: ldarg.1 - IL_0014: ldarg.0 - IL_0015: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_001a: ldloc.0 - IL_001b: ldelem [runtime]System.Int32 - IL_0020: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0025: br.s IL_0028 - - IL_0027: ldc.i4.0 - IL_0028: brtrue.s IL_0004 - - IL_002a: ldloc.0 - IL_002b: ldarg.0 - IL_002c: ldfld int32[] Lambda_inlining/thisIsNotInlined3@36::vs - IL_0031: ldlen - IL_0032: conv.i4 - IL_0033: ceq - IL_0035: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'thisIsNotInlined3@36-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 s) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s - IL_000d: ret - } - - .method public strict virtual instance bool - Invoke(int32 v) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Lambda_inlining/'thisIsNotInlined3@36-1'::s - IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() - IL_0011: ldarg.1 - IL_0012: add - IL_0013: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) - IL_0018: ldc.i4.1 - IL_0019: ret + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stsfld int32[] Lambda_inlining/Test::_svalues + IL_001b: ldc.i4.2 + IL_001c: volatile. + IL_001e: stsfld int32 Lambda_inlining/Test::init@26 + IL_0023: ret } } + .field static assembly int32[] values@17 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static bool ofArray(!!a[] vs, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 r) cil managed { @@ -686,12 +687,11 @@ IL_001b: ret } - .method public specialname static int32[] - get_values() cil managed + .method public specialname static int32[] get_values() cil managed { .maxstack 8 - IL_0000: ldsfld int32[] ''.$Lambda_inlining$fsx::values@17 + IL_0000: ldsfld int32[] Lambda_inlining::values@17 IL_0005: ret } @@ -831,6 +831,34 @@ IL_0038: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Lambda_inlining$fsx::init@ + IL_0006: ldsfld int32 ''.$Lambda_inlining$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.1 + IL_0002: ldc.i4 0x2710 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0016: stsfld int32[] Lambda_inlining::values@17 + IL_001b: call void Lambda_inlining/Test::staticInitialization@() + IL_0020: ret + } + .property int32[] values() { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) @@ -841,39 +869,16 @@ .class private abstract auto ansi sealed ''.$Lambda_inlining$fsx extends [runtime]System.Object { - .field static assembly initonly int32[] values@17 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly int32 init@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4 0x2710 - IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0011: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0016: stsfld int32[] ''.$Lambda_inlining$fsx::values@17 - IL_001b: ldc.i4.0 - IL_001c: ldc.i4.1 - IL_001d: ldc.i4 0x2710 - IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0027: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_002c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0031: stsfld int32[] Lambda_inlining/Test::_svalues - IL_0036: ldc.i4.2 - IL_0037: volatile. - IL_0039: stsfld int32 Lambda_inlining/Test::init@26 - IL_003e: ret + IL_0000: call void Lambda_inlining::staticInitialization@() + IL_0005: ret } } @@ -882,3 +887,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl index 29b06eeec9a..067bc74986d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.net472.bsl @@ -106,6 +106,25 @@ IL_0014: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Option_elision_non_constant_result$fsx::init@ + IL_0006: ldsfld int32 ''.$Option_elision_non_constant_result$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Option_elision_non_constant_result$fsx @@ -115,12 +134,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Option_elision_non_constant_result::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.bsl index 41b4918dc17..065129fff9a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.il.netcore.bsl @@ -107,6 +107,25 @@ IL_0014: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Option_elision_non_constant_result$fsx::init@ + IL_0006: ldsfld int32 ''.$Option_elision_non_constant_result$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Option_elision_non_constant_result$fsx @@ -116,12 +135,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Option_elision_non_constant_result::staticInitialization@() IL_0005: ret } @@ -131,3 +149,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl index 25549cc1926..aec55758862 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.net472.bsl @@ -53,8 +53,7 @@ { .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 ) .field assembly class [runtime]System.Collections.Generic.List`1 messages - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -104,8 +103,7 @@ IL_0020: ret } - .method assembly hidebysig instance void - 'nop'() cil managed aggressiveinlining + .method assembly hidebysig instance void 'nop'() cil managed aggressiveinlining { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -120,8 +118,7 @@ { .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 ) .field assembly class [runtime]System.Collections.Generic.List`1 messages - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -171,6 +168,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Spurious_tail$fsx::init@ + IL_0006: ldsfld int32 ''.$Spurious_tail$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Spurious_tail$fsx @@ -180,12 +196,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Spurious_tail::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.bsl index 0294f07b88f..da47285c762 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.il.netcore.bsl @@ -5,12 +5,12 @@ .assembly extern runtime { } .assembly extern FSharp.Core { } +.assembly extern runtime { } .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 8:0:0:0 } -.assembly extern runtime { } .assembly assembly { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, @@ -59,8 +59,7 @@ { .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 ) .field assembly class [System.Collections]System.Collections.Generic.List`1 messages - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -110,8 +109,7 @@ IL_0020: ret } - .method assembly hidebysig instance void - 'nop'() cil managed aggressiveinlining + .method assembly hidebysig instance void 'nop'() cil managed aggressiveinlining { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -126,8 +124,7 @@ { .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 ) .field assembly class [System.Collections]System.Collections.Generic.List`1 messages - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -177,6 +174,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Spurious_tail$fsx::init@ + IL_0006: ldsfld int32 ''.$Spurious_tail$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Spurious_tail$fsx @@ -186,12 +202,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Spurious_tail::staticInitialization@() IL_0005: ret } @@ -201,3 +216,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl index d2367032978..2da714dba4d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.net472.bsl @@ -45,8 +45,7 @@ .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 ) .field static assembly class Static_init_field/S`1 empty .field static assembly int32 init@5 - .method public specialname rtspecialname - instance void .ctor(!T[] x) cil managed + .method public specialname rtspecialname instance void .ctor(!T[] x) cil managed { .maxstack 8 @@ -57,8 +56,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -71,8 +69,7 @@ IL_0013: ret } - .method public specialname static class Static_init_field/S`1 - get_Empty() cil managed + .method public specialname static class Static_init_field/S`1 get_Empty() cil managed { .maxstack 8 @@ -108,8 +105,7 @@ .field static assembly object empty .field static assembly int32 'init@10-1' .field assembly !T[] x - .method public hidebysig virtual final - instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -126,8 +122,7 @@ IL_0019: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -171,8 +166,7 @@ IL_001c: ret } - .method public hidebysig virtual final - instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -200,8 +194,7 @@ IL_001e: ret } - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -242,8 +235,7 @@ IL_0026: ret } - .method public specialname rtspecialname - instance void .ctor(!T[] x) cil managed + .method public specialname rtspecialname instance void .ctor(!T[] x) cil managed { .maxstack 8 @@ -253,8 +245,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -282,8 +273,7 @@ IL_0016: ret } - .method public hidebysig virtual final - instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed + .method public hidebysig virtual final instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -298,8 +288,7 @@ IL_0014: ret } - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -330,6 +319,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Static_init_field$fsx::init@ + IL_0006: ldsfld int32 ''.$Static_init_field$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Static_init_field$fsx @@ -339,12 +347,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Static_init_field::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.bsl index b7c232c39a7..d322c8b88b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.il.netcore.bsl @@ -46,8 +46,7 @@ .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 ) .field static assembly class Static_init_field/S`1 empty .field static assembly int32 init@5 - .method public specialname rtspecialname - instance void .ctor(!T[] x) cil managed + .method public specialname rtspecialname instance void .ctor(!T[] x) cil managed { .maxstack 8 @@ -58,8 +57,7 @@ IL_0008: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -72,8 +70,7 @@ IL_0013: ret } - .method public specialname static class Static_init_field/S`1 - get_Empty() cil managed + .method public specialname static class Static_init_field/S`1 get_Empty() cil managed { .maxstack 8 @@ -109,8 +106,7 @@ .field static assembly object empty .field static assembly int32 'init@10-1' .field assembly !T[] x - .method public hidebysig virtual final - instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(valuetype Static_init_field/S2`1 obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -127,8 +123,7 @@ IL_0019: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -172,8 +167,7 @@ IL_001c: ret } - .method public hidebysig virtual final - instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -201,8 +195,7 @@ IL_001e: ret } - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -243,8 +236,7 @@ IL_0026: ret } - .method public specialname rtspecialname - instance void .ctor(!T[] x) cil managed + .method public specialname rtspecialname instance void .ctor(!T[] x) cil managed { .maxstack 8 @@ -254,8 +246,7 @@ IL_0007: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -283,8 +274,7 @@ IL_0016: ret } - .method public hidebysig virtual final - instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed + .method public hidebysig virtual final instance bool Equals(valuetype Static_init_field/S2`1 obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -299,8 +289,7 @@ IL_0014: ret } - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -331,6 +320,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Static_init_field$fsx::init@ + IL_0006: ldsfld int32 ''.$Static_init_field$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Static_init_field$fsx @@ -340,12 +348,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Static_init_field::staticInitialization@() IL_0005: ret } @@ -355,3 +362,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl index 15c5d84b476..62dae440bc5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.net472.bsl @@ -39,12 +39,11 @@ extends [runtime]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 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@21-3' + .class auto ansi serializable sealed nested assembly beforefieldinit impl@6 extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - .field static assembly initonly class Tailcall_last_expression_parens/'impl@21-3' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .field static assembly initonly class Tailcall_last_expression_parens/impl@6 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -62,31 +61,39 @@ .maxstack 8 IL_0000: ldarg.1 - IL_0001: ldarg.2 - IL_0002: tail. - IL_0004: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, - uint64) - IL_0009: ret + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.1 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.1 + IL_000a: ldarg.2 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 - IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@21-3'::.ctor() - IL_0005: stsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_0000: newobj instance void Tailcall_last_expression_parens/impl@6::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/impl@6 Tailcall_last_expression_parens/impl@6::@_instance IL_000a: ret } } - .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@29-5' + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@14-1' extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - .field static assembly initonly class Tailcall_last_expression_parens/'impl@29-5' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .field static assembly initonly class Tailcall_last_expression_parens/'impl@14-1' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -104,173 +111,227 @@ .maxstack 8 IL_0000: ldarg.1 - IL_0001: ldarg.2 - IL_0002: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, - uint64) - IL_0007: ret + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.1 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.1 + IL_000a: ldarg.2 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 - IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@29-5'::.ctor() - IL_0005: stsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@14-1'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@14-1' Tailcall_last_expression_parens/'impl@14-1'::@_instance IL_000a: ret } } - .method assembly static uint64 impl@5(uint64 x, - uint64 acc) cil managed + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@22-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brtrue.s IL_0005 - - IL_0003: ldarg.1 - IL_0004: ret - - IL_0005: ldarg.0 - IL_0006: ldc.i4.1 - IL_0007: conv.i8 - IL_0008: sub - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: mul - IL_000c: starg.s acc - IL_000e: starg.s x - IL_0010: br.s IL_0000 - } + .field static assembly initonly class Tailcall_last_expression_parens/'impl@22-2' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldarg.1 + IL_0007: ldc.i4.1 + IL_0008: conv.i8 + IL_0009: sub + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_000f: ldarg.1 + IL_0010: ldarg.2 + IL_0011: mul + IL_0012: tail. + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@22-2'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@22-2' Tailcall_last_expression_parens/'impl@22-2'::@_instance + IL_000a: ret + } - .method public static uint64 factorialOk1(uint64 x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::impl@5(uint64, - uint64) - IL_0008: ret } - .method assembly static uint64 'impl@13-1'(uint64 x, - uint64 acc) cil managed + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@30-3' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brtrue.s IL_0005 - - IL_0003: ldarg.1 - IL_0004: ret - - IL_0005: ldarg.0 - IL_0006: ldc.i4.1 - IL_0007: conv.i8 - IL_0008: sub - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: mul - IL_000c: starg.s acc - IL_000e: starg.s x - IL_0010: br.s IL_0000 + .field static assembly initonly class Tailcall_last_expression_parens/'impl@30-3' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldarg.1 + IL_0007: ldc.i4.1 + IL_0008: conv.i8 + IL_0009: sub + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_000f: ldarg.1 + IL_0010: ldarg.2 + IL_0011: mul + IL_0012: tail. + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@30-3'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@30-3' Tailcall_last_expression_parens/'impl@30-3'::@_instance + IL_000a: ret + } + } - .method public static uint64 factorialOk2(uint64 x) cil managed + .method public static uint64 factorialOk1(uint64 x) cil managed { - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::'impl@13-1'(uint64, - uint64) - IL_0008: ret + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/impl@6 Tailcall_last_expression_parens/impl@6::@_instance + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } - .method assembly static uint64 'impl@21-2'(uint64 x, - uint64 acc) cil managed + .method public static uint64 factorialOk2(uint64 x) cil managed { .maxstack 5 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) - IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@14-1' Tailcall_last_expression_parens/'impl@14-1'::@_instance IL_0005: stloc.0 - IL_0006: ldarg.0 - IL_0007: brtrue.s IL_000b - - IL_0009: ldarg.1 - IL_000a: ret - - IL_000b: ldloc.0 - IL_000c: ldarg.0 - IL_000d: ldc.i4.1 - IL_000e: conv.i8 - IL_000f: sub - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) - IL_0015: ldarg.0 - IL_0016: ldarg.1 - IL_0017: mul - IL_0018: tail. - IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001f: ret + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } .method public static uint64 factorialNotOk1(uint64 x) cil managed { - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: tail. - IL_0005: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, - uint64) - IL_000a: ret + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@22-2' Tailcall_last_expression_parens/'impl@22-2'::@_instance + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } - .method assembly static uint64 'impl@29-4'(uint64 x, - uint64 acc) cil managed + .method public static uint64 factorialNotOk2(uint64 x) cil managed { .maxstack 5 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) - IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@30-3' Tailcall_last_expression_parens/'impl@30-3'::@_instance IL_0005: stloc.0 - IL_0006: ldarg.0 - IL_0007: brtrue.s IL_000b - - IL_0009: ldarg.1 - IL_000a: ret - - IL_000b: ldloc.0 - IL_000c: ldarg.0 - IL_000d: ldc.i4.1 - IL_000e: conv.i8 - IL_000f: sub - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) - IL_0015: ldarg.0 - IL_0016: ldarg.1 - IL_0017: mul - IL_0018: tail. - IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001f: ret + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } - .method public static uint64 factorialNotOk2(uint64 x) cil managed + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Tailcall_last_expression_parens$fsx::init@ + IL_0006: ldsfld int32 ''.$Tailcall_last_expression_parens$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, - uint64) - IL_0008: ret + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret } } @@ -282,12 +343,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Tailcall_last_expression_parens::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.bsl index 7f08989cd53..8044a1868b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.il.netcore.bsl @@ -40,12 +40,11 @@ extends [runtime]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 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@21-3' + .class auto ansi serializable sealed nested assembly beforefieldinit impl@6 extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - .field static assembly initonly class Tailcall_last_expression_parens/'impl@21-3' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .field static assembly initonly class Tailcall_last_expression_parens/impl@6 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -63,31 +62,39 @@ .maxstack 8 IL_0000: ldarg.1 - IL_0001: ldarg.2 - IL_0002: tail. - IL_0004: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, - uint64) - IL_0009: ret + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.1 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.1 + IL_000a: ldarg.2 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 - IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@21-3'::.ctor() - IL_0005: stsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_0000: newobj instance void Tailcall_last_expression_parens/impl@6::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/impl@6 Tailcall_last_expression_parens/impl@6::@_instance IL_000a: ret } } - .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@29-5' + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@14-1' extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - .field static assembly initonly class Tailcall_last_expression_parens/'impl@29-5' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .field static assembly initonly class Tailcall_last_expression_parens/'impl@14-1' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -105,173 +112,227 @@ .maxstack 8 IL_0000: ldarg.1 - IL_0001: ldarg.2 - IL_0002: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, - uint64) - IL_0007: ret + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.1 + IL_0006: ldc.i4.1 + IL_0007: conv.i8 + IL_0008: sub + IL_0009: ldarg.1 + IL_000a: ldarg.2 + IL_000b: mul + IL_000c: starg.s acc + IL_000e: starg.s x + IL_0010: br.s IL_0000 } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 - IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@29-5'::.ctor() - IL_0005: stsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@14-1'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@14-1' Tailcall_last_expression_parens/'impl@14-1'::@_instance IL_000a: ret } } - .method assembly static uint64 impl@5(uint64 x, - uint64 acc) cil managed + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@22-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brtrue.s IL_0005 - - IL_0003: ldarg.1 - IL_0004: ret - - IL_0005: ldarg.0 - IL_0006: ldc.i4.1 - IL_0007: conv.i8 - IL_0008: sub - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: mul - IL_000c: starg.s acc - IL_000e: starg.s x - IL_0010: br.s IL_0000 - } + .field static assembly initonly class Tailcall_last_expression_parens/'impl@22-2' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldarg.1 + IL_0007: ldc.i4.1 + IL_0008: conv.i8 + IL_0009: sub + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_000f: ldarg.1 + IL_0010: ldarg.2 + IL_0011: mul + IL_0012: tail. + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@22-2'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@22-2' Tailcall_last_expression_parens/'impl@22-2'::@_instance + IL_000a: ret + } - .method public static uint64 factorialOk1(uint64 x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::impl@5(uint64, - uint64) - IL_0008: ret } - .method assembly static uint64 'impl@13-1'(uint64 x, - uint64 acc) cil managed + .class auto ansi serializable sealed nested assembly beforefieldinit 'impl@30-3' + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: brtrue.s IL_0005 - - IL_0003: ldarg.1 - IL_0004: ret - - IL_0005: ldarg.0 - IL_0006: ldc.i4.1 - IL_0007: conv.i8 - IL_0008: sub - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: mul - IL_000c: starg.s acc - IL_000e: starg.s x - IL_0010: br.s IL_0000 + .field static assembly initonly class Tailcall_last_expression_parens/'impl@30-3' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance uint64 + Invoke(uint64 x, + uint64 acc) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_0005 + + IL_0003: ldarg.2 + IL_0004: ret + + IL_0005: ldarg.0 + IL_0006: ldarg.1 + IL_0007: ldc.i4.1 + IL_0008: conv.i8 + IL_0009: sub + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) + IL_000f: ldarg.1 + IL_0010: ldarg.2 + IL_0011: mul + IL_0012: tail. + IL_0014: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0019: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Tailcall_last_expression_parens/'impl@30-3'::.ctor() + IL_0005: stsfld class Tailcall_last_expression_parens/'impl@30-3' Tailcall_last_expression_parens/'impl@30-3'::@_instance + IL_000a: ret + } + } - .method public static uint64 factorialOk2(uint64 x) cil managed + .method public static uint64 factorialOk1(uint64 x) cil managed { - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::'impl@13-1'(uint64, - uint64) - IL_0008: ret + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/impl@6 Tailcall_last_expression_parens/impl@6::@_instance + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } - .method assembly static uint64 'impl@21-2'(uint64 x, - uint64 acc) cil managed + .method public static uint64 factorialOk2(uint64 x) cil managed { .maxstack 5 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) - IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@21-3' Tailcall_last_expression_parens/'impl@21-3'::@_instance + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@14-1' Tailcall_last_expression_parens/'impl@14-1'::@_instance IL_0005: stloc.0 - IL_0006: ldarg.0 - IL_0007: brtrue.s IL_000b - - IL_0009: ldarg.1 - IL_000a: ret - - IL_000b: ldloc.0 - IL_000c: ldarg.0 - IL_000d: ldc.i4.1 - IL_000e: conv.i8 - IL_000f: sub - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) - IL_0015: ldarg.0 - IL_0016: ldarg.1 - IL_0017: mul - IL_0018: tail. - IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001f: ret + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } .method public static uint64 factorialNotOk1(uint64 x) cil managed { - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: tail. - IL_0005: call uint64 Tailcall_last_expression_parens::'impl@21-2'(uint64, - uint64) - IL_000a: ret + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@22-2' Tailcall_last_expression_parens/'impl@22-2'::@_instance + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } - .method assembly static uint64 'impl@29-4'(uint64 x, - uint64 acc) cil managed + .method public static uint64 factorialNotOk2(uint64 x) cil managed { .maxstack 5 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_0) - IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@29-5' Tailcall_last_expression_parens/'impl@29-5'::@_instance + IL_0000: ldsfld class Tailcall_last_expression_parens/'impl@30-3' Tailcall_last_expression_parens/'impl@30-3'::@_instance IL_0005: stloc.0 - IL_0006: ldarg.0 - IL_0007: brtrue.s IL_000b - - IL_0009: ldarg.1 - IL_000a: ret - - IL_000b: ldloc.0 - IL_000c: ldarg.0 - IL_000d: ldc.i4.1 - IL_000e: conv.i8 - IL_000f: sub - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::Invoke(!0) - IL_0015: ldarg.0 - IL_0016: ldarg.1 - IL_0017: mul - IL_0018: tail. - IL_001a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001f: ret + IL_0006: ldloc.0 + IL_0007: ldarg.0 + IL_0008: ldc.i4.1 + IL_0009: conv.i8 + IL_000a: tail. + IL_000c: call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !0, + !1) + IL_0011: ret } - .method public static uint64 factorialNotOk2(uint64 x) cil managed + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Tailcall_last_expression_parens$fsx::init@ + IL_0006: ldsfld int32 ''.$Tailcall_last_expression_parens$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: conv.i8 - IL_0003: call uint64 Tailcall_last_expression_parens::'impl@29-4'(uint64, - uint64) - IL_0008: ret + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret } } @@ -283,12 +344,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Tailcall_last_expression_parens::staticInitialization@() IL_0005: ret } @@ -298,3 +358,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl index 2b118a7f177..1dc2c80435a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.net472.bsl @@ -48,8 +48,7 @@ extends [runtime]System.Object { .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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -60,8 +59,7 @@ IL_0008: ret } - .method public hidebysig instance void - M() cil managed + .method public hidebysig instance void M() cil managed { .maxstack 3 @@ -85,6 +83,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Typedefof$fsx::init@ + IL_0006: ldsfld int32 ''.$Typedefof$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Typedefof$fsx @@ -94,12 +111,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Typedefof::staticInitialization@() IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.bsl index 8bd78c1214d..330c6ce43be 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.il.netcore.bsl @@ -5,6 +5,7 @@ .assembly extern runtime { } .assembly extern FSharp.Core { } +.assembly extern runtime { } .assembly extern System.Collections { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) @@ -15,7 +16,6 @@ .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 2:1:0:0 } -.assembly extern runtime { } .assembly assembly { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, @@ -54,8 +54,7 @@ extends [runtime]System.Object { .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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -66,8 +65,7 @@ IL_0008: ret } - .method public hidebysig instance void - M() cil managed + .method public hidebysig instance void M() cil managed { .maxstack 3 @@ -91,6 +89,25 @@ } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Typedefof$fsx::init@ + IL_0006: ldsfld int32 ''.$Typedefof$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void [runtime]System.Console::WriteLine() + IL_0005: ret + } + } .class private abstract auto ansi sealed ''.$Typedefof$fsx @@ -100,12 +117,11 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call void [runtime]System.Console::WriteLine() + IL_0000: call void Typedefof::staticInitialization@() IL_0005: ret } @@ -115,3 +131,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl index fda509152f7..ba53cca0d36 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl @@ -48,8 +48,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -79,8 +78,7 @@ IL_001c: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -91,7 +89,7 @@ } - .field static assembly valuetype ''/T71036_24Bytes@ field71037@ at I_00003917 + .field static assembly valuetype ''/T71284_24Bytes@ field71285@ at I_00003947 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -247,7 +245,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T71036_24Bytes@ Use_binding_on_struct_enumerator::field71037@ + IL_0007: ldtoken field valuetype ''/T71284_24Bytes@ Use_binding_on_struct_enumerator::field71285@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -287,8 +285,7 @@ IL_004e: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -299,6 +296,15 @@ IL_000c: ret } + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + } .class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx @@ -308,14 +314,12 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() - IL_0005: call void [runtime]System.Console::WriteLine(string) - IL_000a: ret + IL_0000: call void Use_binding_on_struct_enumerator::staticInitialization@() + IL_0005: ret } } @@ -323,7 +327,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T71036_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T71284_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -335,7 +339,7 @@ -.data cil I_00003917 = bytearray ( +.data cil I_00003947 = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl index db0bab7c51c..9a9584f87b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl @@ -10,12 +10,12 @@ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 8:0:0:0 } +.assembly extern runtime { } .assembly extern netstandard { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 2:1:0:0 } -.assembly extern runtime { } .assembly assembly { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, @@ -54,8 +54,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -85,8 +84,7 @@ IL_001c: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -97,7 +95,7 @@ } - .field static assembly valuetype ''/T71036_24Bytes@ field71037@ at I_0000395F + .field static assembly valuetype ''/T71284_24Bytes@ field71285@ at I_0000398B .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -253,7 +251,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T71036_24Bytes@ Use_binding_on_struct_enumerator::field71037@ + IL_0007: ldtoken field valuetype ''/T71284_24Bytes@ Use_binding_on_struct_enumerator::field71285@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -293,8 +291,7 @@ IL_004e: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -305,6 +302,15 @@ IL_000c: ret } + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + } .class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx @@ -314,14 +320,12 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() - IL_0005: call void [runtime]System.Console::WriteLine(string) - IL_000a: ret + IL_0000: call void Use_binding_on_struct_enumerator::staticInitialization@() + IL_0005: ret } } @@ -329,7 +333,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T71036_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T71284_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -341,7 +345,7 @@ -.data cil I_0000395F = bytearray ( +.data cil I_0000398B = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) From 4f86dcf113a69ec14aee74927f9e4caeba84a63a Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Wed, 27 Mar 2024 01:22:19 +0100 Subject: [PATCH 07/13] some more split of baselines against debug/release --- .../array_of_function_no_alloc.fsx.err.bsl | 0 .../du_for_same_expression.fsx.err.bsl | 0 ...r_same_expression.fsx.il.net472.debug.bsl} | 0 ..._same_expression.fsx.il.net472.release.bsl | 188 ++++++++++++++++++ ...same_expression.fsx.il.netcore.release.bsl | 45 +++-- .../samples/for_loop_custom_step.fsx.err.bsl | 0 .../samples/for_loop_non_int.fsx.err.bsl | 0 ... for_loop_non_int.fsx.il.net472.debug.bsl} | 0 ...for_loop_non_int.fsx.il.net472.release.bsl | 161 +++++++++++++++ ...or_loop_non_int.fsx.il.netcore.release.bsl | 81 +++++--- .../if_then_else_bool_expression.fsx.err.bsl | 0 .../samples/inplace_array_update.fsx.err.bsl | 0 .../samples/lambda_inlining.fsx.err.bsl | 0 ...on_elision_non_constant_result.fsx.err.bsl | 0 .../samples/spurious_tail.fsx.err.bsl | 0 .../samples/static_init_field.fsx.err.bsl | 0 ...ailcall_last_expression_parens.fsx.err.bsl | 0 .../samples/typedefof.fsx.err.bsl | 0 ...e_binding_on_struct_enumerator.fsx.err.bsl | 0 ...truct_enumerator.fsx.il.net472.release.bsl | 77 ++++--- ...ruct_enumerator.fsx.il.netcore.release.bsl | 37 ++-- 21 files changed, 488 insertions(+), 101 deletions(-) delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.err.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{du_for_same_expression.fsx.il.bsl => du_for_same_expression.fsx.il.net472.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.net472.release.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.err.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/{for_loop_non_int.fsx.il.net472.bsl => for_loop_non_int.fsx.il.net472.debug.bsl} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.err.bsl delete mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.err.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/array_of_function_no_alloc.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.net472.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.net472.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.net472.release.bsl new file mode 100644 index 00000000000..c944b4946c9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.net472.release.bsl @@ -0,0 +1,188 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Du_for_same_expression + extends [runtime]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 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + map(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 mapping, + valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 result) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (!!c V_0, + !!a V_1) + IL_0000: ldarga.s result + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_001b + + IL_000c: ldarga.s result + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_001a: ret + + IL_001b: ldarga.s result + IL_001d: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0022: stloc.1 + IL_0023: ldarg.0 + IL_0024: ldloc.1 + IL_0025: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_002a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_002f: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1) + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: constrained. !!a + IL_002b: callvirt instance string [runtime]System.Object::ToString() + IL_0030: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0035: ret + } + + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + { + + .maxstack 8 + IL_0000: ldarga.s x + IL_0002: call instance int32 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_Tag() + IL_0007: ldc.i4.0 + IL_0008: bne.un.s IL_000c + + IL_000a: br.s IL_0019 + + IL_000c: ldarga.s x + IL_000e: call instance !1 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ErrorValue() + IL_0013: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0018: ret + + IL_0019: ldarga.s x + IL_001b: call instance !0 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::get_ResultValue() + IL_0020: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0025: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_0006: ldsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 3 + IL_0000: ldstr "" + IL_0005: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_000a: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_000f: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0014: call void [runtime]System.Console::WriteLine(object) + IL_0019: ldstr "" + IL_001e: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewOk(!0) + IL_0023: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0028: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_002d: call void [runtime]System.Console::WriteLine(object) + IL_0032: ldstr "" + IL_0037: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_003c: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_0041: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_0046: call void [runtime]System.Console::WriteLine(object) + IL_004b: ldstr "" + IL_0050: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2::NewError(!1) + IL_0055: call valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 Du_for_same_expression::ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2) + IL_005a: box valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 + IL_005f: call void [runtime]System.Console::WriteLine(object) + IL_0064: ret + } + +} + +.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void Du_for_same_expression::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl index 855944f3085..2ae246db384 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/du_for_same_expression.fsx.il.netcore.release.bsl @@ -73,8 +73,7 @@ IL_002f: ret } - .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 - ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ff(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed { .maxstack 3 @@ -104,8 +103,7 @@ IL_0035: ret } - .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 - ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed + .method public static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ffs(valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 x) cil managed { .maxstack 8 @@ -127,17 +125,18 @@ IL_0025: ret } -} + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_0006: ldsfld int32 ''.$Du_for_same_expression$fsx::init@ + IL_000b: pop + IL_000c: ret + } -.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 3 @@ -166,6 +165,24 @@ } +.class private abstract auto ansi sealed ''.$Du_for_same_expression$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void Du_for_same_expression::staticInitialization@() + IL_0005: ret + } + +} + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_custom_step.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.debug.bsl similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.debug.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl new file mode 100644 index 00000000000..013cc35284e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl @@ -0,0 +1,161 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .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 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed For_loop_non_int + extends [runtime]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 ) + .field static assembly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 get_inputSequence@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 + IL_0005: ret + } + + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 get_enumerator@4() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 + IL_0005: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_0006: ldsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 5 + .locals init (int64 V_0, + class [runtime]System.IDisposable V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 100 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 + IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + IL_0016: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() + IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 + .try + { + IL_0020: br.s IL_003d + + IL_0022: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0027: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() + IL_002c: stloc.0 + IL_002d: ldstr "hello" + IL_0032: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_0037: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_003c: pop + IL_003d: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0042: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_0047: brtrue.s IL_0022 + + IL_0049: leave.s IL_0061 + + } + finally + { + IL_004b: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0050: isinst [runtime]System.IDisposable + IL_0055: stloc.1 + IL_0056: ldloc.1 + IL_0057: brfalse.s IL_0060 + + IL_0059: ldloc.1 + IL_005a: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_005f: endfinally + IL_0060: endfinally + } + IL_0061: ret + } + + .property class [runtime]System.Collections.Generic.IEnumerable`1 + inputSequence@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + } + .property class [runtime]System.Collections.Generic.IEnumerator`1 + enumerator@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + } +} + +.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_non_int::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl index 95b1ecd4a27..4e86c17fd04 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.netcore.release.bsl @@ -44,51 +44,38 @@ extends [runtime]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 assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 - get_inputSequence@4() cil managed + .field static assembly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerable`1 get_inputSequence@4() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 IL_0005: ret } - .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 - get_enumerator@4() cil managed + .method assembly specialname static class [runtime]System.Collections.Generic.IEnumerator`1 get_enumerator@4() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_0000: ldsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 IL_0005: ret } - .property class [runtime]System.Collections.Generic.IEnumerable`1 - inputSequence@4() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() - } - .property class [runtime]System.Collections.Generic.IEnumerator`1 - enumerator@4() + .method private specialname rtspecialname static void .cctor() cil managed { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_0006: ldsfld int32 ''.$For_loop_non_int$fsx::init@ + IL_000b: pop + IL_000c: ret } -} -.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx - extends [runtime]System.Object -{ - .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerable`1 inputSequence@4 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly initonly class [runtime]System.Collections.Generic.IEnumerator`1 enumerator@4 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method assembly specialname static void staticInitialization@() cil managed { .maxstack 5 @@ -104,10 +91,10 @@ IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, int64, int64) - IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$For_loop_non_int$fsx::inputSequence@4 + IL_000c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::inputSequence@4 IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() IL_0016: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 ''.$For_loop_non_int$fsx::enumerator@4 + IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 .try { IL_0020: br.s IL_0044 @@ -146,9 +133,39 @@ IL_0068: ret } + .property class [runtime]System.Collections.Generic.IEnumerable`1 + inputSequence@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerable`1 For_loop_non_int::get_inputSequence@4() + } + .property class [runtime]System.Collections.Generic.IEnumerator`1 + enumerator@4() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + } +} + +.class private abstract auto ansi sealed ''.$For_loop_non_int$fsx + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void For_loop_non_int::staticInitialization@() + IL_0005: ret + } + } + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/if_then_else_bool_expression.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/inplace_array_update.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/lambda_inlining.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/option_elision_non_constant_result.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/spurious_tail.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/static_init_field.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/tailcall_last_expression_parens.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/typedefof.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.err.bsl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl index c8b5bf4f29c..eaa6d4f7e36 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl @@ -5,17 +5,11 @@ .assembly extern runtime { } .assembly extern FSharp.Core { } -.assembly extern System.Collections -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) - .ver 8:0:0:0 -} .assembly extern netstandard { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) - .ver 2:1:0:0 + .ver 2:0:0:0 } -.assembly extern runtime { } .assembly assembly { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, @@ -54,8 +48,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -81,12 +74,11 @@ IL_0012: callvirt instance string [netstandard]System.IFormattable::ToString(string, class [netstandard]System.IFormatProvider) IL_0017: call string [runtime]System.String::Concat(string, - string) + string) IL_001c: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -97,11 +89,11 @@ } - .field static assembly valuetype ''/T75332_24Bytes@ field75333@ at I_0000399B + .field static assembly valuetype ''/T75433_24Bytes@ field75434@ at I_00003949 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, - !!State state, - !!TEnumerator enumerator) cil managed + !!State state, + !!TEnumerator enumerator) 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 ) @@ -141,8 +133,8 @@ } .method public static !!State Fold) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, - !!State state, - !!TSeq source) cil managed + !!State state, + !!TSeq source) 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 ) @@ -195,9 +187,9 @@ } .method public static !!State Fold$W) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 getEnumerator, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, - !!State state, - !!TSeq source) cil managed + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, + !!State state, + !!TSeq source) 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 ) @@ -245,32 +237,32 @@ { .maxstack 5 - .locals init (class [System.Collections]System.Collections.Generic.List`1 V_0, + .locals init (class [runtime]System.Collections.Generic.List`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_1, - valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator V_2, + valuetype [runtime]System.Collections.Generic.List`1/Enumerator V_2, string V_3, class [runtime]System.IDisposable V_4) IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T75332_24Bytes@ Use_binding_on_struct_enumerator::field75333@ + IL_0007: ldtoken field valuetype ''/T75433_24Bytes@ Use_binding_on_struct_enumerator::field75434@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, - valuetype [runtime]System.RuntimeFieldHandle) - IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) + valuetype [runtime]System.RuntimeFieldHandle) + IL_0011: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) IL_0016: stloc.0 IL_0017: ldsfld class Use_binding_on_struct_enumerator/testFoldOnListT@32 Use_binding_on_struct_enumerator/testFoldOnListT@32::@_instance IL_001c: stloc.1 IL_001d: ldloc.0 - IL_001e: callvirt instance valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator class [System.Collections]System.Collections.Generic.List`1::GetEnumerator() + IL_001e: callvirt instance valuetype [runtime]System.Collections.Generic.List`1/Enumerator class [runtime]System.Collections.Generic.List`1::GetEnumerator() IL_0023: stloc.2 .try { IL_0024: ldloc.1 IL_0025: ldstr "" IL_002a: ldloc.2 - IL_002b: call !!0 Use_binding_on_struct_enumerator::FoldStrong>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, - !!0, - !!2) + IL_002b: call !!0 Use_binding_on_struct_enumerator::FoldStrong>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!0, + !!2) IL_0030: stloc.3 IL_0031: leave.s IL_004d @@ -278,7 +270,7 @@ finally { IL_0033: ldloc.2 - IL_0034: box valuetype [System.Collections]System.Collections.Generic.List`1/Enumerator + IL_0034: box valuetype [runtime]System.Collections.Generic.List`1/Enumerator IL_0039: isinst [runtime]System.IDisposable IL_003e: stloc.s V_4 IL_0040: ldloc.s V_4 @@ -293,8 +285,7 @@ IL_004e: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -305,6 +296,15 @@ IL_000c: ret } + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + } .class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx @@ -314,14 +314,12 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() - IL_0005: call void [runtime]System.Console::WriteLine(string) - IL_000a: ret + IL_0000: call void Use_binding_on_struct_enumerator::staticInitialization@() + IL_0005: ret } } @@ -329,7 +327,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T75332_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T75433_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -341,7 +339,8 @@ -.data cil I_0000399B = bytearray ( +.data cil I_00003949 = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl index c8b5bf4f29c..a78c474bf39 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl @@ -10,12 +10,12 @@ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) .ver 8:0:0:0 } +.assembly extern runtime { } .assembly extern netstandard { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 2:1:0:0 } -.assembly extern runtime { } .assembly assembly { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, @@ -54,8 +54,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 { .field static assembly initonly class Use_binding_on_struct_enumerator/testFoldOnListT@32 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -85,8 +84,7 @@ IL_001c: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -97,7 +95,7 @@ } - .field static assembly valuetype ''/T75332_24Bytes@ field75333@ at I_0000399B + .field static assembly valuetype ''/T75706_24Bytes@ field75707@ at I_0000398D .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -253,7 +251,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T75332_24Bytes@ Use_binding_on_struct_enumerator::field75333@ + IL_0007: ldtoken field valuetype ''/T75706_24Bytes@ Use_binding_on_struct_enumerator::field75707@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -293,8 +291,7 @@ IL_004e: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 @@ -305,6 +302,15 @@ IL_000c: ret } + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ret + } + } .class private abstract auto ansi sealed ''.$Use_binding_on_struct_enumerator$fsx @@ -314,14 +320,12 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: call string Use_binding_on_struct_enumerator::testFoldOnListT() - IL_0005: call void [runtime]System.Console::WriteLine(string) - IL_000a: ret + IL_0000: call void Use_binding_on_struct_enumerator::staticInitialization@() + IL_0005: ret } } @@ -329,7 +333,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T75332_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T75706_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -341,7 +345,8 @@ -.data cil I_0000399B = bytearray ( +.data cil I_0000398D = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) + From 7c56f1a02fa6bf23036d91ad5234598fb07f9812 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 30 Mar 2024 10:42:57 +0100 Subject: [PATCH 08/13] trying to figure the first difference on CI runs --- tests/FSharp.Test.Utilities/Compiler.fs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 1cbf3a3aade..d8aaa0af4f6 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -1099,16 +1099,34 @@ module rec Compiler = let convenienceBaselineInstructions baseline expected actual = + + let getLines (text: string) = + [| + let reader = StringReader text + let mutable line = reader.ReadLine() + while not(isNull line) do + line + line <- reader.ReadLine() + |] + let expectedLines = getLines expected |> Array.indexed + let actualLines = getLines actual |> Array.indexed + let firstDiff = + Seq.zip expectedLines actualLines + |> Seq.skipWhile (fun (a,b) -> a = b) + |> Seq.tryHead + |> function | None -> "" + | Some((line, expected), (_,actual)) -> $"diff at line {line}:\nexpected:\n{expected}\nactual:\n{actual}\n" $"""to update baseline: $ cp {baseline.FilePath} {baseline.BslSource} to compare baseline: $ code --diff {baseline.FilePath} {baseline.BslSource} +{firstDiff} Expected: {expected} Actual: {actual}""" let updateBaseline () = - snd (Int32.TryParse(Environment.GetEnvironmentVariable("TEST_UPDATE_BSL"))) <> 0 + true //snd (Int32.TryParse(Environment.GetEnvironmentVariable("TEST_UPDATE_BSL"))) <> 0 let updateBaseLineIfEnvironmentSaysSo baseline = if updateBaseline () then if FileSystem.FileExistsShim baseline.FilePath then @@ -1148,6 +1166,7 @@ Actual: ).Replace("\r\n","\n") if errorsExpectedBaseLine <> errorsActual then + fs.CreateOutputDirectory() createBaselineErrors bsl.FSBaseline errorsActual updateBaseLineIfEnvironmentSaysSo bsl.FSBaseline From 7c37cc72c2c6da8f28f00b85f7cf987ee29d51ef Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 30 Mar 2024 10:45:53 +0100 Subject: [PATCH 09/13] don't want update baseline to run on CI... --- tests/FSharp.Test.Utilities/Compiler.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index d8aaa0af4f6..3cf57f959f0 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -1126,7 +1126,7 @@ Expected: Actual: {actual}""" let updateBaseline () = - true //snd (Int32.TryParse(Environment.GetEnvironmentVariable("TEST_UPDATE_BSL"))) <> 0 + snd (Int32.TryParse(Environment.GetEnvironmentVariable("TEST_UPDATE_BSL"))) <> 0 let updateBaseLineIfEnvironmentSaysSo baseline = if updateBaseline () then if FileSystem.FileExistsShim baseline.FilePath then From ac5c9ff90c4fb14d9f8a7c1be1f8e48a920a065c Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 30 Mar 2024 11:42:07 +0100 Subject: [PATCH 10/13] compile & baseline fix --- ...for_loop_non_int.fsx.il.net472.release.bsl | 50 +++++++++++-------- tests/FSharp.Test.Utilities/Compiler.fs | 4 +- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl index 013cc35284e..be756f243a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/for_loop_non_int.fsx.il.net472.release.bsl @@ -5,6 +5,11 @@ .assembly extern runtime { } .assembly extern FSharp.Core { } +.assembly extern netstandard +{ + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:0:0:0 +} .assembly assembly { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, @@ -75,7 +80,8 @@ .maxstack 5 .locals init (int64 V_0, - class [runtime]System.IDisposable V_1) + class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 V_1, + class [runtime]System.IDisposable V_2) IL_0000: ldc.i4.0 IL_0001: conv.i8 IL_0002: ldc.i4.1 @@ -91,36 +97,40 @@ IL_001b: stsfld class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::enumerator@4 .try { - IL_0020: br.s IL_003d + IL_0020: br.s IL_0044 IL_0022: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() IL_0027: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() IL_002c: stloc.0 IL_002d: ldstr "hello" IL_0032: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) - IL_0037: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_003c: pop - IL_003d: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() - IL_0042: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_0047: brtrue.s IL_0022 - - IL_0049: leave.s IL_0061 + IL_0037: stloc.1 + IL_0038: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() + IL_003d: ldloc.1 + IL_003e: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter(class [runtime]System.IO.TextWriter, + class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_0043: pop + IL_0044: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0049: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() + IL_004e: brtrue.s IL_0022 + + IL_0050: leave.s IL_0068 } finally { - IL_004b: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() - IL_0050: isinst [runtime]System.IDisposable - IL_0055: stloc.1 - IL_0056: ldloc.1 - IL_0057: brfalse.s IL_0060 - - IL_0059: ldloc.1 - IL_005a: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_005f: endfinally - IL_0060: endfinally + IL_0052: call class [runtime]System.Collections.Generic.IEnumerator`1 For_loop_non_int::get_enumerator@4() + IL_0057: isinst [runtime]System.IDisposable + IL_005c: stloc.2 + IL_005d: ldloc.2 + IL_005e: brfalse.s IL_0067 + + IL_0060: ldloc.2 + IL_0061: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_0066: endfinally + IL_0067: endfinally } - IL_0061: ret + IL_0068: ret } .property class [runtime]System.Collections.Generic.IEnumerable`1 diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 3cf57f959f0..2c6864bc014 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -1102,7 +1102,7 @@ module rec Compiler = let getLines (text: string) = [| - let reader = StringReader text + let reader = new StringReader(text) let mutable line = reader.ReadLine() while not(isNull line) do line @@ -1115,7 +1115,7 @@ module rec Compiler = |> Seq.skipWhile (fun (a,b) -> a = b) |> Seq.tryHead |> function | None -> "" - | Some((line, expected), (_,actual)) -> $"diff at line {line}:\nexpected:\n{expected}\nactual:\n{actual}\n" + | Some((line, expected), (_,actual)) -> $"diff at line {line+1}:\nexpected:\n{expected}\nactual:\n{actual}\n" $"""to update baseline: $ cp {baseline.FilePath} {baseline.BslSource} to compare baseline: From 4462722f851e3708bc61edcf62f5bcce3a2d88d6 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 30 Mar 2024 15:52:51 +0100 Subject: [PATCH 11/13] .field static assembly valuetype ''/ field identifier seems to differ when running all tests versus single one --- ...binding_on_struct_enumerator.fsx.il.net472.release.bsl | 6 +++--- ...inding_on_struct_enumerator.fsx.il.netcore.release.bsl | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl index eaa6d4f7e36..ae21ba36ce6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl @@ -89,7 +89,7 @@ } - .field static assembly valuetype ''/T75433_24Bytes@ field75434@ at I_00003949 + .field static assembly valuetype ''/T72031_24Bytes@ field72032@ at I_00003949 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -245,7 +245,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T75433_24Bytes@ Use_binding_on_struct_enumerator::field75434@ + IL_0007: ldtoken field valuetype ''/T72031_24Bytes@ Use_binding_on_struct_enumerator::field72032@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -327,7 +327,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T75433_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T72031_24Bytes@ extends [runtime]System.ValueType { .pack 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl index a78c474bf39..ee4c2e5c287 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl @@ -95,7 +95,7 @@ } - .field static assembly valuetype ''/T75706_24Bytes@ field75707@ at I_0000398D + .field static assembly valuetype ''/T8725966_24Bytes@ field8725967@ at I_00003991 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -251,7 +251,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T75706_24Bytes@ Use_binding_on_struct_enumerator::field75707@ + IL_0007: ldtoken field valuetype ''/T8725966_24Bytes@ Use_binding_on_struct_enumerator::field8725967@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -333,7 +333,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T75706_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T8725966_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -345,7 +345,7 @@ -.data cil I_0000398D = bytearray ( +.data cil I_00003991 = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) From b4e4adffc6c08bde5719099c0901aec2e4755542 Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 30 Mar 2024 21:35:44 +0100 Subject: [PATCH 12/13] reset the unique and stamp variables in CompilerGlobalState through "internal visible to" test-only API. --- src/Compiler/TypedTree/CompilerGlobalState.fs | 4 ++++ src/Compiler/TypedTree/CompilerGlobalState.fsi | 4 ++++ ...e_binding_on_struct_enumerator.fsx.il.net472.debug.bsl | 8 ++++---- ...binding_on_struct_enumerator.fsx.il.net472.release.bsl | 8 ++++---- ..._binding_on_struct_enumerator.fsx.il.netcore.debug.bsl | 6 +++--- ...inding_on_struct_enumerator.fsx.il.netcore.release.bsl | 8 ++++---- tests/FSharp.Test.Utilities/CompilerAssert.fs | 1 + 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fs b/src/Compiler/TypedTree/CompilerGlobalState.fs index 7047fc3cf35..bde704da3fb 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fs +++ b/src/Compiler/TypedTree/CompilerGlobalState.fs @@ -71,3 +71,7 @@ let newUnique() = System.Threading.Interlocked.Increment &uniqueCount //++GLOBAL MUTABLE STATE (concurrency-safe) let mutable private stampCount = 0L let newStamp() = System.Threading.Interlocked.Increment &stampCount + +let resetUniqueAndStamp() = + System.Threading.Interlocked.Exchange(&uniqueCount, 0) |> ignore + System.Threading.Interlocked.Exchange(&stampCount, 0) |> ignore \ No newline at end of file diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fsi b/src/Compiler/TypedTree/CompilerGlobalState.fsi index 6f0dba79ddf..a95f6ea0200 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fsi +++ b/src/Compiler/TypedTree/CompilerGlobalState.fsi @@ -50,3 +50,7 @@ val newUnique: (unit -> int64) /// Unique name generator for stamps attached to to val_specs, tycon_specs etc. /// Concurrency-safe val newStamp: (unit -> int64) + + +/// used for test only, to make newUnique and newStamp robust between compilation calls +val internal resetUniqueAndStamp: (unit -> unit) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl index ba53cca0d36..b435eb5a868 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.debug.bsl @@ -89,7 +89,7 @@ } - .field static assembly valuetype ''/T71284_24Bytes@ field71285@ at I_00003947 + .field static assembly valuetype ''/T3339_24Bytes@ field3340@ at I_00003943 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -245,7 +245,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T71284_24Bytes@ Use_binding_on_struct_enumerator::field71285@ + IL_0007: ldtoken field valuetype ''/T3339_24Bytes@ Use_binding_on_struct_enumerator::field3340@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -327,7 +327,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T71284_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T3339_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -339,7 +339,7 @@ -.data cil I_00003947 = bytearray ( +.data cil I_00003943 = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl index ae21ba36ce6..923c0ee025c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.net472.release.bsl @@ -89,7 +89,7 @@ } - .field static assembly valuetype ''/T72031_24Bytes@ field72032@ at I_00003949 + .field static assembly valuetype ''/T3534_24Bytes@ field3535@ at I_00003945 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -245,7 +245,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T72031_24Bytes@ Use_binding_on_struct_enumerator::field72032@ + IL_0007: ldtoken field valuetype ''/T3534_24Bytes@ Use_binding_on_struct_enumerator::field3535@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -327,7 +327,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T72031_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T3534_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -339,7 +339,7 @@ -.data cil I_00003949 = bytearray ( +.data cil I_00003945 = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl index 9a9584f87b5..66bb0434fd9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.debug.bsl @@ -95,7 +95,7 @@ } - .field static assembly valuetype ''/T71284_24Bytes@ field71285@ at I_0000398B + .field static assembly valuetype ''/T3352_24Bytes@ field3353@ at I_0000398B .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -251,7 +251,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T71284_24Bytes@ Use_binding_on_struct_enumerator::field71285@ + IL_0007: ldtoken field valuetype ''/T3352_24Bytes@ Use_binding_on_struct_enumerator::field3353@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -333,7 +333,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T71284_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T3352_24Bytes@ extends [runtime]System.ValueType { .pack 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl index ee4c2e5c287..42931bf4692 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Optimization/samples/use_binding_on_struct_enumerator.fsx.il.netcore.release.bsl @@ -95,7 +95,7 @@ } - .field static assembly valuetype ''/T8725966_24Bytes@ field8725967@ at I_00003991 + .field static assembly valuetype ''/T3547_24Bytes@ field3548@ at I_0000398D .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public static !!State FoldStrong) TEnumerator>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> folder, !!State state, @@ -251,7 +251,7 @@ IL_0000: ldc.i4.6 IL_0001: newarr [runtime]System.Int32 IL_0006: dup - IL_0007: ldtoken field valuetype ''/T8725966_24Bytes@ Use_binding_on_struct_enumerator::field8725967@ + IL_0007: ldtoken field valuetype ''/T3547_24Bytes@ Use_binding_on_struct_enumerator::field3548@ IL_000c: call void [runtime]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [runtime]System.Array, valuetype [runtime]System.RuntimeFieldHandle) IL_0011: newobj instance void class [System.Collections]System.Collections.Generic.List`1::.ctor(class [runtime]System.Collections.Generic.IEnumerable`1) @@ -333,7 +333,7 @@ .class private abstract auto ansi sealed beforefieldinit '' extends [runtime]System.Object { - .class explicit ansi sealed nested assembly beforefieldinit T8725966_24Bytes@ + .class explicit ansi sealed nested assembly beforefieldinit T3547_24Bytes@ extends [runtime]System.ValueType { .pack 0 @@ -345,7 +345,7 @@ -.data cil I_00003991 = bytearray ( +.data cil I_0000398D = bytearray ( 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 05 00 00 00 08 00 00 00) diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index dce93956c4a..0156c2a5c5f 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -410,6 +410,7 @@ module rec CompilerAssertHelpers = // Generate a response file, purely for diagnostic reasons. File.WriteAllLines(Path.ChangeExtension(outputFilePath, ".rsp"), args) + FSharp.Compiler.CompilerGlobalState.resetUniqueAndStamp() let errors, rc = checker.Compile args |> Async.RunImmediate errors, rc, outputFilePath From 869a71620493bc61b121c3cb3e2667b6aa2414cb Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 30 Mar 2024 22:02:58 +0100 Subject: [PATCH 13/13] dotnet fantomas . --- src/Compiler/TypedTree/CompilerGlobalState.fsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fsi b/src/Compiler/TypedTree/CompilerGlobalState.fsi index a95f6ea0200..ee68bd25d90 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fsi +++ b/src/Compiler/TypedTree/CompilerGlobalState.fsi @@ -51,6 +51,5 @@ val newUnique: (unit -> int64) /// Concurrency-safe val newStamp: (unit -> int64) - /// used for test only, to make newUnique and newStamp robust between compilation calls -val internal resetUniqueAndStamp: (unit -> unit) \ No newline at end of file +val internal resetUniqueAndStamp: (unit -> unit)