diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md index 455e5a788d3..55a758037ca 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md @@ -20,3 +20,4 @@ * Reduce allocations in compiler checking via `ValueOption` usage ([PR #16323](https://github.com/dotnet/fsharp/pull/16323), [PR #16567](https://github.com/dotnet/fsharp/pull/16567)) * Reverted [#16348](https://github.com/dotnet/fsharp/pull/16348) `ThreadStatic` `CancellationToken` changes to improve test stability and prevent potential unwanted cancellations. ([PR #16536](https://github.com/dotnet/fsharp/pull/16536)) * Refactored parenthesization API. ([PR #16461])(https://github.com/dotnet/fsharp/pull/16461)) +* Improved lowering of `[start..finish]` and `[|start..finish|]`. ([PR #16577](https://github.com/dotnet/fsharp/pull/16577)) diff --git a/src/Compiler/Optimize/LowerComputedCollections.fs b/src/Compiler/Optimize/LowerComputedCollections.fs index 2de57119ff3..0d3fb3d70a7 100644 --- a/src/Compiler/Optimize/LowerComputedCollections.fs +++ b/src/Compiler/Optimize/LowerComputedCollections.fs @@ -2,7 +2,7 @@ module internal FSharp.Compiler.LowerComputedCollectionExpressions -open Internal.Utilities.Library +open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AccessibilityLogic open FSharp.Compiler.DiagnosticsLogger open FSharp.Compiler.InfoReader @@ -255,18 +255,161 @@ let (|SeqToArray|_|) g expr = | ValApp g g.seq_to_array_vref (_, [seqExpr], m) -> ValueSome (seqExpr, m) | _ -> ValueNone +/// start..finish +[] +let (|Int32Range|_|) g expr = + match expr with + | ValApp g g.range_int32_op_vref ([], [start; Expr.Const (value = Const.Int32 1); finish], _) -> ValueSome (start, finish) + | _ -> ValueNone + let LowerComputedListOrArrayExpr tcVal (g: TcGlobals) amap overallExpr = // If ListCollector is in FSharp.Core then this optimization kicks in if g.ListCollector_tcr.CanDeref then + /// Make an expression holding the count/length + /// to initialize the collection with. + let mkCount start finish = + let diff = mkAsmExpr ([AI_sub], [], [finish; start], [g.int32_ty], Text.Range.range0) + mkAsmExpr ([AI_add], [], [diff; mkOne g Text.Range.range0], [g.int32_ty], Text.Range.range0) + + /// Make a lambda expression to pass into + /// the Array.init/List.init call. + let mkInitializer start = + let v, e = mkCompGenLocal Text.Range.range0 "i" g.int32_ty + let body = mkAsmExpr ([AI_add], [], [start; e], [g.int32_ty], Text.Range.range0) + mkLambda Text.Range.range0 v (body, g.int32_ty) + + /// Make an expression that initializes a list + /// with the values from start through finish. + let mkListInit m start finish = + mkCond + DebugPointAtBinding.NoneAtInvisible + m + (mkListTy g g.int32_ty) + (mkILAsmClt g Text.Range.range0 finish start) + (mkNil g Text.Range.range0 g.int32_ty) + (mkCallListInit g Text.Range.range0 g.int32_ty (mkCount start finish) (mkInitializer start)) + + /// Make an expression that initializes an array + /// with the values from start through finish. + let mkArrayInit m start finish = + mkCond + DebugPointAtBinding.NoneAtInvisible + m + (mkArrayType g g.int32_ty) + (mkILAsmClt g Text.Range.range0 finish start) + (mkArray (g.int32_ty, [], Text.Range.range0)) + (mkCallArrayInit g Text.Range.range0 g.int32_ty (mkCount start finish) (mkInitializer start)) match overallExpr with + // […] | SeqToList g (OptionalCoerce (OptionalSeq g amap (overallSeqExpr, overallElemTy)), m) -> - let collectorTy = g.mk_ListCollector_ty overallElemTy - LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr + match overallSeqExpr with + // [5..1] → [] + | Int32Range g (Expr.Const (value = Const.Int32 start), Expr.Const (value = Const.Int32 finish)) when + finish < start + -> + Some (mkUnionCaseExpr (g.nil_ucref, [g.int32_ty], [], m)) + + // [1..5] → List.init 5 ((+) 5) + | Int32Range g (start & Expr.Const (value = Const.Int32 startVal), Expr.Const (value = Const.Int32 finishVal)) + -> + Some (mkCallListInit g Text.Range.range0 g.int32_ty (Expr.Const (Const.Int32 (finishVal - startVal + 1), Text.Range.range0, g.int32_ty)) (mkInitializer start)) + + // [start..finish] → if finish < start then [] else List.init (finish - start + 1) ((+) start) + | Int32Range g (start & (Expr.Const _ | Expr.Val _), finish & (Expr.Const _ | Expr.Val _)) -> + Some (mkListInit m start finish) + + // [start..finishExpr] → + // let finish = finishExpr + // if finish < start then [] else List.init (finish - start + 1) ((+) start) + | Int32Range g (start & (Expr.Const _ | Expr.Val _), finish) -> + let expr = + mkCompGenLetIn Text.Range.range0 (nameof finish) g.int32_ty finish (fun (_, finish) -> + mkListInit m start finish) + + Some expr + + // [startExpr..finish] → + // let start = startExpr + // if finish < start then [] else List.init (finish - start + 1) ((+) start) + | Int32Range g (start, finish & (Expr.Const _ | Expr.Val _)) -> + let expr = + mkCompGenLetIn Text.Range.range0 (nameof start) g.int32_ty start (fun (_, start) -> + mkListInit m start finish) + + Some expr + + // [startExpr..finishExpr] → + // let start = startExpr + // let finish = finishExpr + // if finish < start then [] else List.init (finish - start + 1) ((+) start) + | Int32Range g (start, finish) -> + let expr = + mkCompGenLetIn Text.Range.range0 (nameof start) g.int32_ty start (fun (_, start) -> + mkCompGenLetIn Text.Range.range0 (nameof finish) g.int32_ty finish (fun (_, finish) -> + mkListInit m start finish)) + + Some expr + + // [(* Anything more complex. *)] + | _ -> + let collectorTy = g.mk_ListCollector_ty overallElemTy + LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr + // [|…|] | SeqToArray g (OptionalCoerce (OptionalSeq g amap (overallSeqExpr, overallElemTy)), m) -> - let collectorTy = g.mk_ArrayCollector_ty overallElemTy - LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr + match overallSeqExpr with + // [|5..1|] → [||] + | Int32Range g (Expr.Const (value = Const.Int32 start), Expr.Const (value = Const.Int32 finish)) when + finish < start + -> + Some (mkArray (g.int32_ty, [], m)) + + // [|1..5|] → Array.init 5 ((+) 5) + | Int32Range g (start & Expr.Const (value = Const.Int32 startVal), Expr.Const (value = Const.Int32 finishVal)) + -> + Some (mkCallArrayInit g Text.Range.range0 g.int32_ty (Expr.Const (Const.Int32 (finishVal - startVal + 1), Text.Range.range0, g.int32_ty)) (mkInitializer start)) + + // [|start..finish|] → if finish < start then [||] else Array.init (finish - start + 1) ((+) start) + | Int32Range g (start & (Expr.Const _ | Expr.Val _), finish & (Expr.Const _ | Expr.Val _)) -> + Some (mkArrayInit m start finish) + + // [|start..finishExpr|] → + // let finish = finishExpr + // if finish < start then [||] else Array.init (finish - start + 1) ((+) start) + | Int32Range g (start & (Expr.Const _ | Expr.Val _), finish) -> + let expr = + mkCompGenLetIn Text.Range.range0 (nameof finish) g.int32_ty finish (fun (_, finish) -> + mkArrayInit m start finish) + + Some expr + + // [|startExpr..finish|] → + // let start = startExpr + // if finish < start then [||] else Array.init (finish - start + 1) ((+) start) + | Int32Range g (start, finish & (Expr.Const _ | Expr.Val _)) -> + let expr = + mkCompGenLetIn Text.Range.range0 (nameof start) g.int32_ty start (fun (_, start) -> + mkArrayInit m start finish) + + Some expr + + // [|startExpr..finishExpr|] → + // let start = startExpr + // let finish = finishExpr + // if finish < start then [||] else Array.init (finish - start + 1) ((+) start) + | Int32Range g (start, finish) -> + let expr = + mkCompGenLetIn Text.Range.range0 (nameof start) g.int32_ty start (fun (_, start) -> + mkCompGenLetIn Text.Range.range0 (nameof finish) g.int32_ty finish (fun (_, finish) -> + mkArrayInit m start finish)) + + Some expr + + // [|(* Anything more complex. *)|] + | _ -> + let collectorTy = g.mk_ArrayCollector_ty overallElemTy + LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr | _ -> None else diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 3830dd008e5..bf6661ddce6 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -811,6 +811,7 @@ type TcGlobals( let v_range_int32_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt32" , None , None , [], ([[v_int_ty];[v_int_ty];[v_int_ty]], mkSeqTy v_int_ty)) let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty)) + let v_array_init_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "init" , None , Some "Initialize", [vara], ([[v_int32_ty]; [v_int32_ty --> varaTy]], mkArrayType 1 varaTy)) let v_array_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]], varaTy)) let v_array2D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray2D" , None , None , [vara], ([[mkArrayType 2 varaTy];[v_int_ty]; [v_int_ty]], varaTy)) let v_array3D_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]], varaTy)) @@ -820,6 +821,8 @@ type TcGlobals( let v_array3D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray3D" , None , None , [vara], ([[mkArrayType 3 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) let v_array4D_set_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "SetArray4D" , None , None , [vara], ([[mkArrayType 4 varaTy];[v_int_ty]; [v_int_ty]; [v_int_ty]; [v_int_ty]; [varaTy]], v_unit_ty)) + let v_list_init_info = makeIntrinsicValRef(fslib_MFListModule_nleref, "init" , None , Some "Initialize", [vara], ([[v_int32_ty]; [v_int32_ty --> varaTy]], mkListTy varaTy)) + let v_option_toNullable_info = makeIntrinsicValRef(fslib_MFOptionModule_nleref, "toNullable" , None , Some "ToNullable" , [vara], ([[mkOptionTy varaTy]], mkNullableTy varaTy)) let v_option_defaultValue_info = makeIntrinsicValRef(fslib_MFOptionModule_nleref, "defaultValue" , None , Some "DefaultValue" , [vara], ([[varaTy]; [mkOptionTy varaTy]], varaTy)) @@ -1751,6 +1754,7 @@ type TcGlobals( member _.seq_to_array_info = v_seq_to_array_info member _.array_length_info = v_array_length_info + member _.array_init_info = v_array_init_info member _.array_get_info = v_array_get_info member _.array2D_get_info = v_array2D_get_info member _.array3D_get_info = v_array3D_get_info @@ -1760,6 +1764,8 @@ type TcGlobals( member _.array3D_set_info = v_array3D_set_info member _.array4D_set_info = v_array4D_set_info + member _.list_init_info = v_list_init_info + member val option_toNullable_info = v_option_toNullable_info member val option_defaultValue_info = v_option_defaultValue_info diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 7beb639a2ee..2e4f986efbc 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -7737,6 +7737,8 @@ let mkCallToEnumOperator (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsi let mkCallArrayLength (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.array_length_info, [[ty]], [e1], m) +let mkCallArrayInit (g: TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.array_init_info, [[ty]], [e1; e2], m) + let mkCallArrayGet (g: TcGlobals) m ty e1 idx1 = mkApps g (typedExprForIntrinsic g m g.array_get_info, [[ty]], [ e1 ; idx1 ], m) let mkCallArray2DGet (g: TcGlobals) m ty e1 idx1 idx2 = mkApps g (typedExprForIntrinsic g m g.array2D_get_info, [[ty]], [ e1 ; idx1; idx2 ], m) @@ -7753,6 +7755,8 @@ let mkCallArray3DSet (g: TcGlobals) m ty e1 idx1 idx2 idx3 v = mkApps g (typedEx let mkCallArray4DSet (g: TcGlobals) m ty e1 idx1 idx2 idx3 idx4 v = mkApps g (typedExprForIntrinsic g m g.array4D_set_info, [[ty]], [ e1 ; idx1; idx2; idx3; idx4; v ], m) +let mkCallListInit (g: TcGlobals) m ty e1 e2 = mkApps g (typedExprForIntrinsic g m g.list_init_info, [[ty]], [e1; e2], m) + let mkCallHash (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.hash_info, [[ty]], [ e1 ], m) let mkCallBox (g: TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.box_info, [[ty]], [ e1 ], m) diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 2345ac5eb40..fd74ebf4b17 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -2015,6 +2015,8 @@ val mkCallCreateEvent: TcGlobals -> range -> TType -> TType -> Expr -> Expr -> E val mkCallArrayLength: TcGlobals -> range -> TType -> Expr -> Expr +val mkCallArrayInit: TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallArrayGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallArray2DGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr @@ -2031,6 +2033,8 @@ val mkCallArray3DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Exp val mkCallArray4DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr +val mkCallListInit: TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallHash: TcGlobals -> range -> TType -> Expr -> Expr val mkCallBox: TcGlobals -> range -> TType -> Expr -> Expr diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.il.bsl index 6b0f84999c2..12d6e3e4f1e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.il.bsl @@ -47,7 +47,46 @@ 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 'res7@10-1' + .class auto ansi serializable sealed nested assembly beforefieldinit 'res7@1-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class Program/'res7@1-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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Program/'res7@1-1'::.ctor() + IL_0005: stsfld class Program/'res7@1-1' Program/'res7@1-1'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'res7@10-2' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field public class [ComputationExprLibrary]Library.EventuallyBuilder builder@ @@ -67,10 +106,10 @@ 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 [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@10-1'::builder@ + IL_0008: stfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@10-2'::builder@ IL_000d: ldarg.0 IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@10-1'::x + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@10-2'::x IL_0014: ret } @@ -83,15 +122,15 @@ IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 - IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@10-1'::x + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@10-2'::x IL_0008: ldarg.0 - IL_0009: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@10-1'::x + IL_0009: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@10-2'::x IL_000e: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() IL_0013: ldloc.0 IL_0014: sub IL_0015: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_contents(!0) IL_001a: ldarg.0 - IL_001b: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@10-1'::builder@ + IL_001b: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@10-2'::builder@ IL_0020: tail. IL_0022: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Zero() IL_0027: ret @@ -99,7 +138,7 @@ } - .class auto ansi serializable sealed nested assembly beforefieldinit 'res7@12-2' + .class auto ansi serializable sealed nested assembly beforefieldinit 'res7@12-3' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { .field public class [ComputationExprLibrary]Library.EventuallyBuilder builder@ @@ -119,10 +158,10 @@ 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 [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@12-2'::builder@ + IL_0008: stfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@12-3'::builder@ IL_000d: ldarg.0 IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@12-2'::x + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@12-3'::x IL_0014: ret } @@ -132,9 +171,9 @@ .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@12-2'::builder@ + IL_0001: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/'res7@12-3'::builder@ IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@12-2'::x + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 Program/'res7@12-3'::x IL_000c: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_contents() IL_0011: tail. IL_0013: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Return(!!0) @@ -178,33 +217,29 @@ IL_0008: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ IL_000d: ldarg.0 IL_000e: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_0013: ldc.i4.0 - IL_0014: ldc.i4.1 - IL_0015: ldc.i4.3 - IL_0016: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_001b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0020: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0025: ldarg.0 - IL_0026: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_002b: ldloc.0 - IL_002c: newobj instance void Program/'res7@10-1'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, + IL_0013: ldc.i4.4 + IL_0014: ldsfld class Program/'res7@1-1' Program/'res7@1-1'::@_instance + IL_0019: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_001e: ldarg.0 + IL_001f: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_0024: ldloc.0 + IL_0025: newobj instance void Program/'res7@10-2'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0031: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_002a: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0036: ldarg.0 - IL_0037: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_003c: ldarg.0 - IL_003d: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_0042: ldloc.0 - IL_0043: newobj instance void Program/'res7@12-2'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, + IL_002f: ldarg.0 + IL_0030: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_0035: ldarg.0 + IL_0036: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_003b: ldloc.0 + IL_003c: newobj instance void Program/'res7@12-3'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0048: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_004d: tail. - IL_004f: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Combine(class [ComputationExprLibrary]Library.Eventually`1, + IL_0041: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0046: tail. + IL_0048: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Combine(class [ComputationExprLibrary]Library.Eventually`1, class [ComputationExprLibrary]Library.Eventually`1) - IL_0054: ret + IL_004d: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.il.bsl index f4f037c9936..501642202d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.il.bsl @@ -43,6 +43,45 @@ 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 clo@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/clo@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/clo@1::.ctor() + IL_0005: stsfld class assembly/clo@1 assembly/clo@1::@_instance + IL_000a: ret + } + + } + .method public specialname static int32[] get_r() cil managed { @@ -188,77 +227,88 @@ IL_000e: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, !!0) IL_0013: stsfld int32[] ''.$assembly::w@7 - IL_0018: ldc.i4.0 - IL_0019: ldc.i4.1 - IL_001a: call int32[] assembly::get_r() - IL_001f: ldlen - IL_0020: conv.i4 - IL_0021: stsfld int32 ''.$assembly::e1@1 - IL_0026: call int32[] assembly::get_w() - IL_002b: ldlen - IL_002c: conv.i4 - IL_002d: stsfld int32 ''.$assembly::e2@1 - IL_0032: call int32 assembly::get_e1@1() - IL_0037: call int32 assembly::get_e2@1() - IL_003c: bge.s IL_0046 - - IL_003e: call int32 assembly::get_e1@1() - IL_0043: nop - IL_0044: br.s IL_004c - - IL_0046: call int32 assembly::get_e2@1() - IL_004b: nop - IL_004c: ldc.i4.1 - IL_004d: sub - IL_004e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0053: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0058: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_005d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0067: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_006c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::next@9 - IL_0071: br.s IL_00b9 - - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_007d: stloc.0 - IL_007e: call int32[] assembly::get_r() - IL_0083: ldloc.0 - IL_0084: call int32[] assembly::get_r() - IL_0089: ldloc.0 - IL_008a: ldelem [runtime]System.Int32 - IL_008f: call int32[] assembly::get_w() - IL_0094: ldloc.0 - IL_0095: ldelem [runtime]System.Int32 - IL_009a: add - IL_009b: stelem [runtime]System.Int32 - IL_00a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00a5: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00aa: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_00af: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_00b4: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00be: brtrue.s IL_0073 - - IL_00c0: nop - IL_00c1: nop - IL_00c2: call int32[] assembly::get_r() - IL_00c7: ldc.i4.0 - IL_00c8: ldelem [runtime]System.Int32 - IL_00cd: ldc.i4.3 - IL_00ce: bne.un.s IL_00d4 - - IL_00d0: ldc.i4.0 - IL_00d1: nop - IL_00d2: br.s IL_00d6 - - IL_00d4: ldc.i4.1 - IL_00d5: nop - IL_00d6: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_00db: pop - IL_00dc: ret + IL_0018: call int32[] assembly::get_r() + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: stsfld int32 ''.$assembly::e1@1 + IL_0024: call int32[] assembly::get_w() + IL_0029: ldlen + IL_002a: conv.i4 + IL_002b: stsfld int32 ''.$assembly::e2@1 + IL_0030: call int32 assembly::get_e1@1() + IL_0035: call int32 assembly::get_e2@1() + IL_003a: bge.s IL_0044 + + IL_003c: call int32 assembly::get_e1@1() + IL_0041: nop + IL_0042: br.s IL_004a + + IL_0044: call int32 assembly::get_e2@1() + IL_0049: nop + IL_004a: ldc.i4.1 + IL_004b: sub + IL_004c: stloc.0 + IL_004d: ldloc.0 + IL_004e: ldc.i4.0 + IL_004f: bge.s IL_0059 + + IL_0051: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0056: nop + IL_0057: br.s IL_0069 + + IL_0059: ldloc.0 + IL_005a: ldc.i4.0 + IL_005b: sub + IL_005c: ldc.i4.1 + IL_005d: add + IL_005e: ldsfld class assembly/clo@1 assembly/clo@1::@_instance + IL_0063: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0068: nop + IL_0069: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 + IL_006e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0073: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0078: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::next@9 + IL_007d: br.s IL_00c5 + + IL_007f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0084: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0089: stloc.0 + IL_008a: call int32[] assembly::get_r() + IL_008f: ldloc.0 + IL_0090: call int32[] assembly::get_r() + IL_0095: ldloc.0 + IL_0096: ldelem [runtime]System.Int32 + IL_009b: call int32[] assembly::get_w() + IL_00a0: ldloc.0 + IL_00a1: ldelem [runtime]System.Int32 + IL_00a6: add + IL_00a7: stelem [runtime]System.Int32 + IL_00ac: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00b1: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00b6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00bb: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_00c0: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00c5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00ca: brtrue.s IL_007f + + IL_00cc: nop + IL_00cd: nop + IL_00ce: call int32[] assembly::get_r() + IL_00d3: ldc.i4.0 + IL_00d4: ldelem [runtime]System.Int32 + IL_00d9: ldc.i4.3 + IL_00da: bne.un.s IL_00e0 + + IL_00dc: ldc.i4.0 + IL_00dd: nop + IL_00de: br.s IL_00e2 + + IL_00e0: ldc.i4.1 + IL_00e1: nop + IL_00e2: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_00e7: pop + IL_00e8: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl index f4f037c9936..501642202d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl @@ -43,6 +43,45 @@ 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 clo@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/clo@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/clo@1::.ctor() + IL_0005: stsfld class assembly/clo@1 assembly/clo@1::@_instance + IL_000a: ret + } + + } + .method public specialname static int32[] get_r() cil managed { @@ -188,77 +227,88 @@ IL_000e: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, !!0) IL_0013: stsfld int32[] ''.$assembly::w@7 - IL_0018: ldc.i4.0 - IL_0019: ldc.i4.1 - IL_001a: call int32[] assembly::get_r() - IL_001f: ldlen - IL_0020: conv.i4 - IL_0021: stsfld int32 ''.$assembly::e1@1 - IL_0026: call int32[] assembly::get_w() - IL_002b: ldlen - IL_002c: conv.i4 - IL_002d: stsfld int32 ''.$assembly::e2@1 - IL_0032: call int32 assembly::get_e1@1() - IL_0037: call int32 assembly::get_e2@1() - IL_003c: bge.s IL_0046 - - IL_003e: call int32 assembly::get_e1@1() - IL_0043: nop - IL_0044: br.s IL_004c - - IL_0046: call int32 assembly::get_e2@1() - IL_004b: nop - IL_004c: ldc.i4.1 - IL_004d: sub - IL_004e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0053: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0058: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_005d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0067: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_006c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::next@9 - IL_0071: br.s IL_00b9 - - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_007d: stloc.0 - IL_007e: call int32[] assembly::get_r() - IL_0083: ldloc.0 - IL_0084: call int32[] assembly::get_r() - IL_0089: ldloc.0 - IL_008a: ldelem [runtime]System.Int32 - IL_008f: call int32[] assembly::get_w() - IL_0094: ldloc.0 - IL_0095: ldelem [runtime]System.Int32 - IL_009a: add - IL_009b: stelem [runtime]System.Int32 - IL_00a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00a5: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00aa: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_00af: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_00b4: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00be: brtrue.s IL_0073 - - IL_00c0: nop - IL_00c1: nop - IL_00c2: call int32[] assembly::get_r() - IL_00c7: ldc.i4.0 - IL_00c8: ldelem [runtime]System.Int32 - IL_00cd: ldc.i4.3 - IL_00ce: bne.un.s IL_00d4 - - IL_00d0: ldc.i4.0 - IL_00d1: nop - IL_00d2: br.s IL_00d6 - - IL_00d4: ldc.i4.1 - IL_00d5: nop - IL_00d6: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_00db: pop - IL_00dc: ret + IL_0018: call int32[] assembly::get_r() + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: stsfld int32 ''.$assembly::e1@1 + IL_0024: call int32[] assembly::get_w() + IL_0029: ldlen + IL_002a: conv.i4 + IL_002b: stsfld int32 ''.$assembly::e2@1 + IL_0030: call int32 assembly::get_e1@1() + IL_0035: call int32 assembly::get_e2@1() + IL_003a: bge.s IL_0044 + + IL_003c: call int32 assembly::get_e1@1() + IL_0041: nop + IL_0042: br.s IL_004a + + IL_0044: call int32 assembly::get_e2@1() + IL_0049: nop + IL_004a: ldc.i4.1 + IL_004b: sub + IL_004c: stloc.0 + IL_004d: ldloc.0 + IL_004e: ldc.i4.0 + IL_004f: bge.s IL_0059 + + IL_0051: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0056: nop + IL_0057: br.s IL_0069 + + IL_0059: ldloc.0 + IL_005a: ldc.i4.0 + IL_005b: sub + IL_005c: ldc.i4.1 + IL_005d: add + IL_005e: ldsfld class assembly/clo@1 assembly/clo@1::@_instance + IL_0063: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0068: nop + IL_0069: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 + IL_006e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0073: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0078: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::next@9 + IL_007d: br.s IL_00c5 + + IL_007f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0084: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0089: stloc.0 + IL_008a: call int32[] assembly::get_r() + IL_008f: ldloc.0 + IL_0090: call int32[] assembly::get_r() + IL_0095: ldloc.0 + IL_0096: ldelem [runtime]System.Int32 + IL_009b: call int32[] assembly::get_w() + IL_00a0: ldloc.0 + IL_00a1: ldelem [runtime]System.Int32 + IL_00a6: add + IL_00a7: stelem [runtime]System.Int32 + IL_00ac: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00b1: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00b6: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00bb: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_00c0: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00c5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00ca: brtrue.s IL_007f + + IL_00cc: nop + IL_00cd: nop + IL_00ce: call int32[] assembly::get_r() + IL_00d3: ldc.i4.0 + IL_00d4: ldelem [runtime]System.Int32 + IL_00d9: ldc.i4.3 + IL_00da: bne.un.s IL_00e0 + + IL_00dc: ldc.i4.0 + IL_00dd: nop + IL_00de: br.s IL_00e2 + + IL_00e0: ldc.i4.1 + IL_00e1: nop + IL_00e2: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_00e7: pop + IL_00e8: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl index b734a546b40..f0da69869d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl @@ -47,53 +47,123 @@ 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 t1@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/CompareMicroPerfAndCodeGenerationTests/t1@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/CompareMicroPerfAndCodeGenerationTests/t1@1::.ctor() + IL_0005: stsfld class assembly/CompareMicroPerfAndCodeGenerationTests/t1@1 assembly/CompareMicroPerfAndCodeGenerationTests/t1@1::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit t2@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/CompareMicroPerfAndCodeGenerationTests/t2@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/CompareMicroPerfAndCodeGenerationTests/t2@1::.ctor() + IL_0005: stsfld class assembly/CompareMicroPerfAndCodeGenerationTests/t2@1 assembly/CompareMicroPerfAndCodeGenerationTests/t2@1::@_instance + IL_000a: ret + } + + } + .method public static int32 f8() cil managed { - .maxstack 5 + .maxstack 4 .locals init (int32 V_0, int32[] V_1, int32[] V_2, int32 V_3) IL_0000: ldc.i4.1 IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: ldc.i4.1 - IL_0004: ldc.i4.s 100 - IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0010: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: ldc.i4.1 - IL_0018: ldc.i4.s 100 - IL_001a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_001f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0024: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0029: stloc.2 - IL_002a: ldc.i4.0 + IL_0002: ldc.i4.s 101 + IL_0004: ldsfld class assembly/CompareMicroPerfAndCodeGenerationTests/t1@1 assembly/CompareMicroPerfAndCodeGenerationTests/t1@1::@_instance + IL_0009: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000e: stloc.1 + IL_000f: ldc.i4.s 101 + IL_0011: ldsfld class assembly/CompareMicroPerfAndCodeGenerationTests/t2@1 assembly/CompareMicroPerfAndCodeGenerationTests/t2@1::@_instance + IL_0016: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_001b: stloc.2 + IL_001c: ldc.i4.0 + IL_001d: stloc.3 + IL_001e: br.s IL_002c + + IL_0020: ldloc.1 + IL_0021: ldloc.2 + IL_0022: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonIntrinsic(!!0, + !!0) + IL_0027: stloc.0 + IL_0028: ldloc.3 + IL_0029: ldc.i4.1 + IL_002a: add IL_002b: stloc.3 - IL_002c: br.s IL_003a + IL_002c: ldloc.3 + IL_002d: ldc.i4 0x186a1 + IL_0032: blt.s IL_0020 - IL_002e: ldloc.1 - IL_002f: ldloc.2 - IL_0030: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonIntrinsic(!!0, - !!0) - IL_0035: stloc.0 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: ldc.i4 0x186a1 - IL_0040: blt.s IL_002e - - IL_0042: ldloc.0 - IL_0043: ret + IL_0034: ldloc.0 + IL_0035: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl index 6125092813b..a227168732a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl @@ -47,53 +47,123 @@ 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 t1@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/EqualsMicroPerfAndCodeGenerationTests/t1@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/EqualsMicroPerfAndCodeGenerationTests/t1@1::.ctor() + IL_0005: stsfld class assembly/EqualsMicroPerfAndCodeGenerationTests/t1@1 assembly/EqualsMicroPerfAndCodeGenerationTests/t1@1::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit t2@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/EqualsMicroPerfAndCodeGenerationTests/t2@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/EqualsMicroPerfAndCodeGenerationTests/t2@1::.ctor() + IL_0005: stsfld class assembly/EqualsMicroPerfAndCodeGenerationTests/t2@1 assembly/EqualsMicroPerfAndCodeGenerationTests/t2@1::@_instance + IL_000a: ret + } + + } + .method public static bool f8() cil managed { - .maxstack 5 + .maxstack 4 .locals init (bool V_0, int32[] V_1, int32[] V_2, int32 V_3) IL_0000: ldc.i4.0 IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: ldc.i4.1 - IL_0004: ldc.i4.s 100 - IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0010: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: ldc.i4.1 - IL_0018: ldc.i4.s 100 - IL_001a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_001f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0024: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0029: stloc.2 - IL_002a: ldc.i4.0 + IL_0002: ldc.i4.s 101 + IL_0004: ldsfld class assembly/EqualsMicroPerfAndCodeGenerationTests/t1@1 assembly/EqualsMicroPerfAndCodeGenerationTests/t1@1::@_instance + IL_0009: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000e: stloc.1 + IL_000f: ldc.i4.s 101 + IL_0011: ldsfld class assembly/EqualsMicroPerfAndCodeGenerationTests/t2@1 assembly/EqualsMicroPerfAndCodeGenerationTests/t2@1::@_instance + IL_0016: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_001b: stloc.2 + IL_001c: ldc.i4.0 + IL_001d: stloc.3 + IL_001e: br.s IL_002c + + IL_0020: ldloc.1 + IL_0021: ldloc.2 + IL_0022: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, + !!0) + IL_0027: stloc.0 + IL_0028: ldloc.3 + IL_0029: ldc.i4.1 + IL_002a: add IL_002b: stloc.3 - IL_002c: br.s IL_003a + IL_002c: ldloc.3 + IL_002d: ldc.i4 0x989681 + IL_0032: blt.s IL_0020 - IL_002e: ldloc.1 - IL_002f: ldloc.2 - IL_0030: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, - !!0) - IL_0035: stloc.0 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: ldc.i4 0x989681 - IL_0040: blt.s IL_002e - - IL_0042: ldloc.0 - IL_0043: ret + IL_0034: ldloc.0 + IL_0035: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl index ba62710f013..506853af82b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl @@ -47,39 +47,74 @@ 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 arr@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/HashMicroPerfAndCodeGenerationTests/arr@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/HashMicroPerfAndCodeGenerationTests/arr@1::.ctor() + IL_0005: stsfld class assembly/HashMicroPerfAndCodeGenerationTests/arr@1 assembly/HashMicroPerfAndCodeGenerationTests/arr@1::@_instance + IL_000a: ret + } + + } + .method public static void f8() cil managed { - .maxstack 5 + .maxstack 4 .locals init (int32[] V_0, int32 V_1, int32 V_2) IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: ldc.i4.1 - IL_0003: ldc.i4.s 100 - IL_0005: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000f: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0014: stloc.0 - IL_0015: ldc.i4.0 - IL_0016: stloc.1 - IL_0017: br.s IL_0024 - - IL_0019: ldloc.0 - IL_001a: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashIntrinsic(!!0) - IL_001f: stloc.2 - IL_0020: ldloc.1 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: stloc.1 - IL_0024: ldloc.1 - IL_0025: ldc.i4 0x989681 - IL_002a: blt.s IL_0019 - - IL_002c: ret + IL_0001: ldc.i4.s 101 + IL_0003: ldsfld class assembly/HashMicroPerfAndCodeGenerationTests/arr@1 assembly/HashMicroPerfAndCodeGenerationTests/arr@1::@_instance + IL_0008: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000d: stloc.0 + IL_000e: ldc.i4.0 + IL_000f: stloc.1 + IL_0010: br.s IL_001d + + IL_0012: ldloc.0 + IL_0013: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashIntrinsic(!!0) + IL_0018: stloc.2 + IL_0019: ldloc.1 + IL_001a: ldc.i4.1 + IL_001b: add + IL_001c: stloc.1 + IL_001d: ldloc.1 + IL_001e: ldc.i4 0x989681 + IL_0023: blt.s IL_0012 + + IL_0025: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.il.bsl index a8e6ce9949c..d7c700d32da 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.il.bsl @@ -47,6 +47,45 @@ 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 'Pipe #1 input #2 at line 16@1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 input #2 at line 16@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 input #2 at line 16@1'::.ctor() + IL_0005: stsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 input #2 at line 16@1' ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 input #2 at line 16@1'::@_instance + IL_000a: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit 'Pipe #1 stage #2 at line 18@18' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { @@ -147,6 +186,84 @@ } + .class auto ansi serializable sealed nested assembly beforefieldinit 'Pipe #2 input #2 at line 22@1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #2 at line 22@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #2 at line 22@1'::.ctor() + IL_0005: stsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #2 at line 22@1' ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #2 at line 22@1'::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'Pipe #2 input #3 at line 22@1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #3 at line 22@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #3 at line 22@1'::.ctor() + IL_0005: stsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #3 at line 22@1' ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #3 at line 22@1'::@_instance + IL_000a: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit 'Pipe #2 stage #2 at line 24@24' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`3> { @@ -314,81 +431,69 @@ IL_0012: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0017: stloc.1 - IL_0018: ldc.i4.0 - IL_0019: ldc.i4.1 - IL_001a: ldc.i4.2 - IL_001b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0020: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0025: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_002a: stloc.2 - IL_002b: ldloc.1 - IL_002c: ldloc.2 - IL_002d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + IL_0018: ldc.i4.3 + IL_0019: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 input #2 at line 16@1' ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 input #2 at line 16@1'::@_instance + IL_001e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldloc.2 + IL_0026: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0032: stloc.3 - IL_0033: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18'::@_instance - IL_0038: ldloc.3 - IL_0039: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + IL_002b: stloc.3 + IL_002c: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18'::@_instance + IL_0031: ldloc.3 + IL_0032: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_003e: stloc.s V_4 - IL_0040: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19::@_instance - IL_0045: ldloc.s V_4 - IL_0047: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + IL_0037: stloc.s V_4 + IL_0039: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19::@_instance + IL_003e: ldloc.s V_4 + IL_0040: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_004c: stloc.0 - IL_004d: ldarg.0 - IL_004e: ldarg.0 - IL_004f: ldarg.0 - IL_0050: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0055: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0045: stloc.0 + IL_0046: ldarg.0 + IL_0047: ldarg.0 + IL_0048: ldarg.0 + IL_0049: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_004e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_005a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0053: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_005f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0058: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0064: stloc.s V_6 - IL_0066: ldc.i4.0 - IL_0067: ldc.i4.1 - IL_0068: ldc.i4.2 - IL_0069: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_006e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0078: stloc.s V_7 - IL_007a: ldc.i4.0 - IL_007b: ldc.i4.1 - IL_007c: ldc.i4.2 - IL_007d: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0082: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0087: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_008c: stloc.s V_8 - IL_008e: ldloc.s V_6 - IL_0090: ldloc.s V_7 - IL_0092: ldloc.s V_8 - IL_0094: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip3(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + IL_005d: stloc.s V_6 + IL_005f: ldc.i4.3 + IL_0060: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #2 at line 22@1' ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #2 at line 22@1'::@_instance + IL_0065: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_006a: stloc.s V_7 + IL_006c: ldc.i4.3 + IL_006d: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #3 at line 22@1' ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 input #3 at line 22@1'::@_instance + IL_0072: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0077: stloc.s V_8 + IL_0079: ldloc.s V_6 + IL_007b: ldloc.s V_7 + IL_007d: ldloc.s V_8 + IL_007f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip3(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0099: stloc.s V_9 - IL_009b: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24'::@_instance - IL_00a0: ldloc.s V_9 - IL_00a2: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + IL_0084: stloc.s V_9 + IL_0086: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24'::@_instance + IL_008b: ldloc.s V_9 + IL_008d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00a7: stloc.s V_10 - IL_00a9: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25::@_instance - IL_00ae: ldloc.s V_10 - IL_00b0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + IL_0092: stloc.s V_10 + IL_0094: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25::@_instance + IL_0099: ldloc.s V_10 + IL_009b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b5: stloc.s V_5 - IL_00b7: ldloc.0 - IL_00b8: ldloc.s V_5 - IL_00ba: newobj instance void class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::.ctor(!0, + IL_00a0: stloc.s V_5 + IL_00a2: ldloc.0 + IL_00a3: ldloc.s V_5 + IL_00a5: newobj instance void class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::.ctor(!0, !1) - IL_00bf: ret + IL_00aa: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.il.bsl index 2e77dc87b3d..50ad7127fe0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.il.bsl @@ -43,6 +43,45 @@ 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 alist@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/alist@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/alist@1::.ctor() + IL_0005: stsfld class assembly/alist@1 assembly/alist@1::@_instance + IL_000a: ret + } + + } + .class auto autochar serializable sealed nested assembly beforefieldinit specialname seq1@9 extends class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1> { @@ -423,259 +462,255 @@ class [runtime]System.Tuple`4 V_18, class [runtime]System.Tuple`4 V_19, int32 V_20) - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4.s 10 - IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0013: dup - IL_0014: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::alist@5 - IL_0019: stloc.0 - IL_001a: ldc.i4.3 - IL_001b: newarr [runtime]System.Int32 - IL_0020: dup - IL_0021: ldc.i4.0 + IL_0000: ldc.i4.s 10 + IL_0002: ldsfld class assembly/alist@1 assembly/alist@1::@_instance + IL_0007: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000c: dup + IL_000d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::alist@5 + IL_0012: stloc.0 + IL_0013: ldc.i4.3 + IL_0014: newarr [runtime]System.Int32 + IL_0019: dup + IL_001a: ldc.i4.0 + IL_001b: ldc.i4.1 + IL_001c: stelem [runtime]System.Int32 + IL_0021: dup IL_0022: ldc.i4.1 - IL_0023: stelem [runtime]System.Int32 - IL_0028: dup - IL_0029: ldc.i4.1 + IL_0023: ldc.i4.2 + IL_0024: stelem [runtime]System.Int32 + IL_0029: dup IL_002a: ldc.i4.2 - IL_002b: stelem [runtime]System.Int32 - IL_0030: dup - IL_0031: ldc.i4.2 - IL_0032: ldc.i4.3 - IL_0033: stelem [runtime]System.Int32 - IL_0038: dup - IL_0039: stsfld int32[] ''.$assembly::array@6 - IL_003e: stloc.1 - IL_003f: ldc.i4.1 - IL_0040: ldc.i4.1 - IL_0041: ldc.i4.s 10 - IL_0043: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + IL_002b: ldc.i4.3 + IL_002c: stelem [runtime]System.Int32 + IL_0031: dup + IL_0032: stsfld int32[] ''.$assembly::array@6 + IL_0037: stloc.1 + IL_0038: ldc.i4.1 + IL_0039: ldc.i4.1 + IL_003a: ldc.i4.s 10 + IL_003c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, int32, int32) - IL_0048: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_004d: dup - IL_004e: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$assembly::aseq@7 - IL_0053: stloc.2 - IL_0054: ldc.i4.1 - IL_0055: ldc.i4.1 - IL_0056: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + IL_0041: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0046: dup + IL_0047: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 ''.$assembly::aseq@7 + IL_004c: stloc.2 + IL_004d: ldc.i4.1 + IL_004e: ldc.i4.1 + IL_004f: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, !1) - IL_005b: ldc.i4.2 - IL_005c: ldc.i4.2 - IL_005d: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + IL_0054: ldc.i4.2 + IL_0055: ldc.i4.2 + IL_0056: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, !1) - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::get_Empty() - IL_0067: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, + IL_005b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::get_Empty() + IL_0060: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_006c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, + IL_0065: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0071: dup - IL_0072: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> ''.$assembly::list1@8 - IL_0077: stloc.3 - IL_0078: ldc.i4.0 - IL_0079: ldnull - IL_007a: newobj instance void assembly/seq1@9::.ctor(int32, + IL_006a: dup + IL_006b: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> ''.$assembly::list1@8 + IL_0070: stloc.3 + IL_0071: ldc.i4.0 + IL_0072: ldnull + IL_0073: newobj instance void assembly/seq1@9::.ctor(int32, class [runtime]System.Tuple`2) - IL_007f: dup - IL_0080: stsfld class [runtime]System.Collections.Generic.IEnumerable`1> ''.$assembly::seq1@9 - IL_0085: stloc.s V_4 - IL_0087: ldc.i4.2 - IL_0088: newarr class [runtime]System.Tuple`2 - IL_008d: dup - IL_008e: ldc.i4.0 - IL_008f: ldc.i4.1 - IL_0090: ldc.i4.1 - IL_0091: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + IL_0078: dup + IL_0079: stsfld class [runtime]System.Collections.Generic.IEnumerable`1> ''.$assembly::seq1@9 + IL_007e: stloc.s V_4 + IL_0080: ldc.i4.2 + IL_0081: newarr class [runtime]System.Tuple`2 + IL_0086: dup + IL_0087: ldc.i4.0 + IL_0088: ldc.i4.1 + IL_0089: ldc.i4.1 + IL_008a: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, !1) - IL_0096: stelem class [runtime]System.Tuple`2 - IL_009b: dup - IL_009c: ldc.i4.1 - IL_009d: ldc.i4.2 - IL_009e: ldc.i4.2 - IL_009f: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + IL_008f: stelem class [runtime]System.Tuple`2 + IL_0094: dup + IL_0095: ldc.i4.1 + IL_0096: ldc.i4.2 + IL_0097: ldc.i4.2 + IL_0098: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, !1) - IL_00a4: stelem class [runtime]System.Tuple`2 - IL_00a9: dup - IL_00aa: stsfld class [runtime]System.Tuple`2[] ''.$assembly::array1@10 - IL_00af: stloc.s V_5 - IL_00b1: ldc.i4.2 - IL_00b2: ldc.i4.2 - IL_00b3: ldc.i4.0 - IL_00b4: call !!0[0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Create(int32, + IL_009d: stelem class [runtime]System.Tuple`2 + IL_00a2: dup + IL_00a3: stsfld class [runtime]System.Tuple`2[] ''.$assembly::array1@10 + IL_00a8: stloc.s V_5 + IL_00aa: ldc.i4.2 + IL_00ab: ldc.i4.2 + IL_00ac: ldc.i4.0 + IL_00ad: call !!0[0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Create(int32, int32, !!0) - IL_00b9: dup - IL_00ba: stsfld int32[0...,0...] ''.$assembly::a3@11 - IL_00bf: stloc.s V_6 - IL_00c1: ldc.i4.3 - IL_00c2: ldc.i4.3 - IL_00c3: ldc.i4.3 - IL_00c4: ldc.i4.0 - IL_00c5: call !!0[0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Create(int32, + IL_00b2: dup + IL_00b3: stsfld int32[0...,0...] ''.$assembly::a3@11 + IL_00b8: stloc.s V_6 + IL_00ba: ldc.i4.3 + IL_00bb: ldc.i4.3 + IL_00bc: ldc.i4.3 + IL_00bd: ldc.i4.0 + IL_00be: call !!0[0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Create(int32, int32, int32, !!0) - IL_00ca: dup - IL_00cb: stsfld int32[0...,0...,0...] ''.$assembly::array3D@12 - IL_00d0: stloc.s V_7 - IL_00d2: ldc.i4.4 - IL_00d3: ldc.i4.4 - IL_00d4: ldc.i4.4 - IL_00d5: ldc.i4.4 - IL_00d6: ldc.i4.0 - IL_00d7: call !!0[0...,0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Create(int32, + IL_00c3: dup + IL_00c4: stsfld int32[0...,0...,0...] ''.$assembly::array3D@12 + IL_00c9: stloc.s V_7 + IL_00cb: ldc.i4.4 + IL_00cc: ldc.i4.4 + IL_00cd: ldc.i4.4 + IL_00ce: ldc.i4.4 + IL_00cf: ldc.i4.0 + IL_00d0: call !!0[0...,0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Create(int32, int32, int32, int32, !!0) - IL_00dc: dup - IL_00dd: stsfld int32[0...,0...,0...,0...] ''.$assembly::array4D@13 - IL_00e2: stloc.s V_8 - IL_00e4: call int32[] assembly::get_array() - IL_00e9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfArray(!!0[]) - IL_00ee: pop - IL_00ef: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() - IL_00f4: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_00f9: pop - IL_00fa: call class [runtime]System.Tuple`2[] assembly::get_array1() - IL_00ff: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfArray(class [runtime]System.Tuple`2[]) - IL_0104: pop - IL_0105: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::get_list1() - IL_010a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>) - IL_010f: pop - IL_0110: call class [runtime]System.Collections.Generic.IEnumerable`1> assembly::get_seq1() - IL_0115: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1>) - IL_011a: pop - IL_011b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_alist() - IL_0120: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0125: dup - IL_0126: stsfld int32[] ''.$assembly::a1@25 - IL_012b: stloc.s V_9 - IL_012d: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() - IL_0132: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0137: dup - IL_0138: stsfld int32[] ''.$assembly::a2@26 - IL_013d: stloc.s V_10 - IL_013f: call int32[] assembly::get_a1() - IL_0144: ldc.i4.0 - IL_0145: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Get(!!0[], + IL_00d5: dup + IL_00d6: stsfld int32[0...,0...,0...,0...] ''.$assembly::array4D@13 + IL_00db: stloc.s V_8 + IL_00dd: call int32[] assembly::get_array() + IL_00e2: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfArray(!!0[]) + IL_00e7: pop + IL_00e8: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() + IL_00ed: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_00f2: pop + IL_00f3: call class [runtime]System.Tuple`2[] assembly::get_array1() + IL_00f8: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfArray(class [runtime]System.Tuple`2[]) + IL_00fd: pop + IL_00fe: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::get_list1() + IL_0103: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>) + IL_0108: pop + IL_0109: call class [runtime]System.Collections.Generic.IEnumerable`1> assembly::get_seq1() + IL_010e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1>) + IL_0113: pop + IL_0114: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_alist() + IL_0119: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_011e: dup + IL_011f: stsfld int32[] ''.$assembly::a1@25 + IL_0124: stloc.s V_9 + IL_0126: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() + IL_012b: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0130: dup + IL_0131: stsfld int32[] ''.$assembly::a2@26 + IL_0136: stloc.s V_10 + IL_0138: call int32[] assembly::get_a1() + IL_013d: ldc.i4.0 + IL_013e: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Get(!!0[], int32) - IL_014a: stloc.s V_11 - IL_014c: call int32[] assembly::get_a2() - IL_0151: ldc.i4.0 - IL_0152: ldloc.s V_11 - IL_0154: call void [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Set(!!0[], + IL_0143: stloc.s V_11 + IL_0145: call int32[] assembly::get_a2() + IL_014a: ldc.i4.0 + IL_014b: ldloc.s V_11 + IL_014d: call void [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Set(!!0[], int32, !!0) - IL_0159: nop - IL_015a: call int32[0...,0...] assembly::get_a3() - IL_015f: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length1(!!0[0...,0...]) - IL_0164: call int32[0...,0...] assembly::get_a3() - IL_0169: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length2(!!0[0...,0...]) - IL_016e: call int32[0...,0...] assembly::get_a3() - IL_0173: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base1(!!0[0...,0...]) - IL_0178: call int32[0...,0...] assembly::get_a3() - IL_017d: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base2(!!0[0...,0...]) - IL_0182: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, + IL_0152: nop + IL_0153: call int32[0...,0...] assembly::get_a3() + IL_0158: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length1(!!0[0...,0...]) + IL_015d: call int32[0...,0...] assembly::get_a3() + IL_0162: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length2(!!0[0...,0...]) + IL_0167: call int32[0...,0...] assembly::get_a3() + IL_016c: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base1(!!0[0...,0...]) + IL_0171: call int32[0...,0...] assembly::get_a3() + IL_0176: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base2(!!0[0...,0...]) + IL_017b: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, !1, !2, !3) - IL_0187: stloc.s V_12 - IL_0189: ldloc.s V_12 - IL_018b: stloc.s V_13 - IL_018d: call int32[0...,0...] assembly::get_a3() - IL_0192: ldc.i4.0 - IL_0193: ldc.i4.0 - IL_0194: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Get(!!0[0...,0...], + IL_0180: stloc.s V_12 + IL_0182: ldloc.s V_12 + IL_0184: stloc.s V_13 + IL_0186: call int32[0...,0...] assembly::get_a3() + IL_018b: ldc.i4.0 + IL_018c: ldc.i4.0 + IL_018d: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Get(!!0[0...,0...], int32, int32) - IL_0199: stloc.s V_14 - IL_019b: call int32[0...,0...] assembly::get_a3() - IL_01a0: ldc.i4.0 - IL_01a1: ldc.i4.0 - IL_01a2: ldloc.s V_14 - IL_01a4: call void [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Set(!!0[0...,0...], + IL_0192: stloc.s V_14 + IL_0194: call int32[0...,0...] assembly::get_a3() + IL_0199: ldc.i4.0 + IL_019a: ldc.i4.0 + IL_019b: ldloc.s V_14 + IL_019d: call void [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Set(!!0[0...,0...], int32, int32, !!0) - IL_01a9: nop - IL_01aa: call int32[0...,0...,0...] assembly::get_array3D() - IL_01af: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length1(!!0[0...,0...,0...]) - IL_01b4: call int32[0...,0...,0...] assembly::get_array3D() - IL_01b9: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length2(!!0[0...,0...,0...]) - IL_01be: call int32[0...,0...,0...] assembly::get_array3D() - IL_01c3: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length3(!!0[0...,0...,0...]) - IL_01c8: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, + IL_01a2: nop + IL_01a3: call int32[0...,0...,0...] assembly::get_array3D() + IL_01a8: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length1(!!0[0...,0...,0...]) + IL_01ad: call int32[0...,0...,0...] assembly::get_array3D() + IL_01b2: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length2(!!0[0...,0...,0...]) + IL_01b7: call int32[0...,0...,0...] assembly::get_array3D() + IL_01bc: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length3(!!0[0...,0...,0...]) + IL_01c1: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, !1, !2) - IL_01cd: stloc.s V_15 - IL_01cf: ldloc.s V_15 - IL_01d1: stloc.s V_16 - IL_01d3: call int32[0...,0...,0...] assembly::get_array3D() - IL_01d8: ldc.i4.0 - IL_01d9: ldc.i4.0 - IL_01da: ldc.i4.0 - IL_01db: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Get(!!0[0...,0...,0...], + IL_01c6: stloc.s V_15 + IL_01c8: ldloc.s V_15 + IL_01ca: stloc.s V_16 + IL_01cc: call int32[0...,0...,0...] assembly::get_array3D() + IL_01d1: ldc.i4.0 + IL_01d2: ldc.i4.0 + IL_01d3: ldc.i4.0 + IL_01d4: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Get(!!0[0...,0...,0...], int32, int32, int32) - IL_01e0: stloc.s V_17 - IL_01e2: call int32[0...,0...,0...] assembly::get_array3D() - IL_01e7: ldc.i4.0 - IL_01e8: ldc.i4.0 - IL_01e9: ldc.i4.0 - IL_01ea: ldloc.s V_17 - IL_01ec: call void [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Set(!!0[0...,0...,0...], + IL_01d9: stloc.s V_17 + IL_01db: call int32[0...,0...,0...] assembly::get_array3D() + IL_01e0: ldc.i4.0 + IL_01e1: ldc.i4.0 + IL_01e2: ldc.i4.0 + IL_01e3: ldloc.s V_17 + IL_01e5: call void [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Set(!!0[0...,0...,0...], int32, int32, int32, !!0) - IL_01f1: nop - IL_01f2: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_01f7: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length1(!!0[0...,0...,0...,0...]) - IL_01fc: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_0201: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length2(!!0[0...,0...,0...,0...]) - IL_0206: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_020b: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length3(!!0[0...,0...,0...,0...]) - IL_0210: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_0215: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length4(!!0[0...,0...,0...,0...]) - IL_021a: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, + IL_01ea: nop + IL_01eb: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_01f0: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length1(!!0[0...,0...,0...,0...]) + IL_01f5: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_01fa: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length2(!!0[0...,0...,0...,0...]) + IL_01ff: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0204: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length3(!!0[0...,0...,0...,0...]) + IL_0209: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_020e: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length4(!!0[0...,0...,0...,0...]) + IL_0213: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, !1, !2, !3) - IL_021f: stloc.s V_18 - IL_0221: ldloc.s V_18 - IL_0223: stloc.s V_19 - IL_0225: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_022a: ldc.i4.0 - IL_022b: ldc.i4.0 - IL_022c: ldc.i4.0 - IL_022d: ldc.i4.0 - IL_022e: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Get(!!0[0...,0...,0...,0...], + IL_0218: stloc.s V_18 + IL_021a: ldloc.s V_18 + IL_021c: stloc.s V_19 + IL_021e: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0223: ldc.i4.0 + IL_0224: ldc.i4.0 + IL_0225: ldc.i4.0 + IL_0226: ldc.i4.0 + IL_0227: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Get(!!0[0...,0...,0...,0...], int32, int32, int32, int32) - IL_0233: stloc.s V_20 - IL_0235: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_023a: ldc.i4.0 - IL_023b: ldc.i4.0 - IL_023c: ldc.i4.0 - IL_023d: ldc.i4.0 - IL_023e: ldloc.s V_20 - IL_0240: call void [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Set(!!0[0...,0...,0...,0...], + IL_022c: stloc.s V_20 + IL_022e: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0233: ldc.i4.0 + IL_0234: ldc.i4.0 + IL_0235: ldc.i4.0 + IL_0236: ldc.i4.0 + IL_0237: ldloc.s V_20 + IL_0239: call void [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Set(!!0[0...,0...,0...,0...], int32, int32, int32, int32, !!0) - IL_0245: nop - IL_0246: ret + IL_023e: nop + IL_023f: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.il.bsl index 7d0d3f2f625..04cb7bed5c4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.il.bsl @@ -43,6 +43,45 @@ 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 clo@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/clo@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/clo@1::.ctor() + IL_0005: stsfld class assembly/clo@1 assembly/clo@1::@_instance + IL_000a: ret + } + + } + } .class private abstract auto ansi sealed ''.$assembly @@ -56,42 +95,38 @@ { .entrypoint - .maxstack 5 + .maxstack 4 .locals init (class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, int32 V_2) - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4.3 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0012: stloc.0 - IL_0013: ldloc.0 - IL_0014: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0019: stloc.1 - IL_001a: br.s IL_0042 - - IL_001c: ldloc.0 - IL_001d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_0022: stloc.2 - IL_0023: ldstr "%A" - IL_0028: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_002d: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_0032: ldloc.2 - IL_0033: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0038: pop - IL_0039: ldloc.1 - IL_003a: stloc.0 - IL_003b: ldloc.0 - IL_003c: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0041: stloc.1 - IL_0042: ldloc.1 - IL_0043: brtrue.s IL_001c - - IL_0045: ret + IL_0000: ldc.i4.3 + IL_0001: ldsfld class assembly/clo@1 assembly/clo@1::@_instance + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000b: stloc.0 + IL_000c: ldloc.0 + IL_000d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0012: stloc.1 + IL_0013: br.s IL_003b + + IL_0015: ldloc.0 + IL_0016: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_001b: stloc.2 + IL_001c: ldstr "%A" + IL_0021: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) + IL_0026: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_002b: ldloc.2 + IL_002c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0031: pop + IL_0032: ldloc.1 + IL_0033: stloc.0 + IL_0034: ldloc.0 + IL_0035: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_003a: stloc.1 + IL_003b: ldloc.1 + IL_003c: brtrue.s IL_0015 + + IL_003e: ret } } diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index 8164f876a52..e1c98765798 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -129,9 +129,19 @@ module ILChecker = errorMsgOpt <- Some(msg + "\nExpected:\n" + ilCode + "\n") else for i = 0 to expectedLines.Length - 1 do + let ignorePrivateImplDeets (s: string) = + // .field static assembly valuetype ''/T3169_40Bytes@ field3170@ at I_000028A7 + let s = match s.IndexOf "PrivateImplementationDetails" with -1 -> s | i -> s[..i] + // .class explicit ansi sealed nested assembly beforefieldinit T3169_40Bytes@ + let s = match s.IndexOf ".class explicit ansi sealed nested assembly beforefieldinit" with -1 -> s | i -> s[..i] + // .data cil I_000028A7 = bytearray ( + let s = match s.IndexOf ".data cil" with -1 -> s | i -> s[..i] + s + let expected = expectedLines[i].Trim() let actual = actualLines[i].Trim() - if expected <> actual then + + if ignorePrivateImplDeets expected <> ignorePrivateImplDeets actual then errors.Add $"\n==\nName: '%s{actualLines[0]}'\n\nExpected:\t %s{expected}\nActual:\t\t %s{actual}\n==" if errors.Count > 0 then diff --git a/tests/fsharp/Compiler/Language/ComputedCollectionLoweringTests.fs b/tests/fsharp/Compiler/Language/ComputedCollectionLoweringTests.fs new file mode 100644 index 00000000000..0aa0d2639df --- /dev/null +++ b/tests/fsharp/Compiler/Language/ComputedCollectionLoweringTests.fs @@ -0,0 +1,888 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Test + +[] +module ComputedCollectionLoweringTests = + module Array = + [] + let ``Lone RangeInt32 with const args when start > finish lowers to empty array`` () = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let test () = [|10..1|] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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 int32[] test() cil managed + { + + .maxstack 8 + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) + + [] + let ``Lone RangeInt32 with const args lowers to call to init`` () = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let test () = [|1..257|] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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 test@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class Test/test@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Test/test@1::.ctor() + IL_0005: stsfld class Test/test@1 Test/test@1::@_instance + IL_000a: ret + } + + } + + .method public static int32[] test() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4 0x101 + IL_0005: ldsfld class Test/test@1 Test/test@1::@_instance + IL_000a: tail. + IL_000c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0011: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) + + [] + let ``Lone RangeInt32 with dynamic args lowers to call to init`` () = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let test start finish = [|start..finish|] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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 test@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public int32 start + .method assembly specialname rtspecialname + instance void .ctor(int32 start) 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 int32 Test/test@1::start + IL_000d: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Test/test@1::start + IL_0006: ldarg.1 + IL_0007: add + IL_0008: ret + } + + } + + .method public static int32[] test(int32 start, + int32 finish) 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.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_000a + + IL_0004: call !!0[] [runtime]System.Array::Empty() + IL_0009: ret + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: ldarg.0 + IL_0010: newobj instance void Test/test@1::.ctor(int32) + IL_0015: tail. + IL_0017: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_001c: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) + + [] + let ``Lone RangeInt32 with dynamic args that are complex exprs stores those in vars before calling init`` () = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let a () = (Array.zeroCreate 10).Length + let b () = (Array.zeroCreate 20).Length + + let test start finish = [|a ()..b ()|] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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 test@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public int32 start + .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 start) 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 int32 Test/test@1::start + IL_000d: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Test/test@1::start + IL_0006: ldarg.1 + IL_0007: add + IL_0008: ret + } + + } + + .method public static int32 a() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.s 10 + IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: ret + } + + .method public static int32 b() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.s 20 + IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: ret + } + + .method public static int32[] test(!!a start, + !!b finish) 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 (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.s 10 + IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: stloc.0 + IL_000a: ldc.i4.s 20 + IL_000c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: stloc.1 + IL_0014: ldloc.1 + IL_0015: ldloc.0 + IL_0016: bge.s IL_001e + + IL_0018: call !!0[] [runtime]System.Array::Empty() + IL_001d: ret + + IL_001e: ldloc.1 + IL_001f: ldloc.0 + IL_0020: sub + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: ldloc.0 + IL_0024: newobj instance void Test/test@1::.ctor(int32) + IL_0029: tail. + IL_002b: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0030: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) + + module List = + [] + let ``Lone RangeInt32 with const args when start > finish lowers to empty list`` () = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let test () = [10..1] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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.Collections.FSharpList`1 + test() cil managed + { + + .maxstack 8 + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0005: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) + + [] + let ``Lone RangeInt32 with const args lowers to call to init`` () = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let test () = [1..101] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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 test@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class Test/test@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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Test/test@1::.ctor() + IL_0005: stsfld class Test/test@1 Test/test@1::@_instance + IL_000a: ret + } + + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + test() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.s 101 + IL_0002: ldsfld class Test/test@1 Test/test@1::@_instance + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_000e: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) + + [] + let ``Lone RangeInt32 with dynamic args lowers to call to init``() = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let test start finish = [start..finish] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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 test@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public int32 start + .method assembly specialname rtspecialname + instance void .ctor(int32 start) 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 int32 Test/test@1::start + IL_000d: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Test/test@1::start + IL_0006: ldarg.1 + IL_0007: add + IL_0008: ret + } + + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + test(int32 start, + int32 finish) 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.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_000a + + IL_0004: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0009: ret + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: ldarg.0 + IL_0010: newobj instance void Test/test@1::.ctor(int32) + IL_0015: tail. + IL_0017: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_001c: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) + + [] + let ``Lone RangeInt32 with dynamic args that are complex exprs stores those in vars before calling init`` () = + CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"--optimize+"|], + """ + module Test + + let a () = (Array.zeroCreate 10).Length + let b () = (Array.zeroCreate 20).Length + + let test start finish = [a ()..b ()] + """, + (fun verifier -> verifier.VerifyIL [ + """ + .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 Test + 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 test@1 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public int32 start + .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 start) 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 int32 Test/test@1::start + IL_000d: ret + } + + .method public strict virtual instance int32 + Invoke(int32 i) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Test/test@1::start + IL_0006: ldarg.1 + IL_0007: add + IL_0008: ret + } + + } + + .method public static int32 a() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.s 10 + IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: ret + } + + .method public static int32 b() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.s 20 + IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + test(!!a start, + !!b finish) 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 (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.s 10 + IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0007: ldlen + IL_0008: conv.i4 + IL_0009: stloc.0 + IL_000a: ldc.i4.s 20 + IL_000c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::ZeroCreate(int32) + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: stloc.1 + IL_0014: ldloc.1 + IL_0015: ldloc.0 + IL_0016: bge.s IL_001e + + IL_0018: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_001d: ret + + IL_001e: ldloc.1 + IL_001f: ldloc.0 + IL_0020: sub + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: ldloc.0 + IL_0024: newobj instance void Test/test@1::.ctor(int32) + IL_0029: tail. + IL_002b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Initialize(int32, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0030: ret + } + + } + + .class private abstract auto ansi sealed ''.$Test + extends [runtime]System.Object + { + } + """ + ])) diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index b6d69d8ae1a..c7cd7c6e1f5 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -72,6 +72,7 @@ + @@ -109,7 +110,7 @@ false - +