From 83cc0e4f5a958da008706f2448fe3ee3036df145 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 16 Jun 2023 20:49:47 +0200 Subject: [PATCH 01/12] internalerror with MakeValueAssign fixed? --- .../Language/RegressionTests.fs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs index 81e55158788..68b710f85ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs @@ -19,3 +19,13 @@ type TestItemSeq = |> compile |> withErrorCodes [39] |> ignore + + + [] + let ``Member val regression - not allowed without primary constructor`` () = + Fs """module Test + type Bad3 = + member val X = 1 + 1 """ + |> typecheck + |> shouldFail + |> withDiagnostics [] From 59d1b41dc42e83b12468399047b2c523f451dee5 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 25 Jul 2023 16:34:21 +0200 Subject: [PATCH 02/12] Adding cancellation suppot for lexing and parsing --- src/Compiler/Service/FSharpCheckerResults.fs | 35 ++++++++++++++----- src/Compiler/Service/FSharpCheckerResults.fsi | 6 ++-- src/Compiler/Service/service.fs | 16 ++++++--- src/Compiler/SyntaxTree/LexHelpers.fs | 4 ++- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 3fbfe27bed8..f797ca89e3c 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -2329,7 +2329,7 @@ module internal ParseAndCheckFile = IndentationAwareSyntaxStatus(indentationSyntaxStatus, true) - let createLexerFunction fileName options lexbuf (errHandler: DiagnosticsHandler) = + let createLexerFunction fileName options lexbuf (errHandler: DiagnosticsHandler) (ct: CancellationToken) = let indentationSyntaxStatus = getLightSyntaxStatus fileName options // If we're editing a script then we define INTERACTIVE otherwise COMPILED. @@ -2357,12 +2357,25 @@ module internal ParseAndCheckFile = let tokenizer = LexFilter.LexFilter(indentationSyntaxStatus, options.CompilingFSharpCore, Lexer.token lexargs true, lexbuf, false) - (fun _ -> tokenizer.GetToken()) + if ct.CanBeCanceled then + (fun _ -> + ct.ThrowIfCancellationRequested() + tokenizer.GetToken()) + else + (fun _ -> tokenizer.GetToken()) let createLexbuf langVersion strictIndentation sourceText = UnicodeLexing.SourceTextAsLexbuf(true, LanguageVersion(langVersion), strictIndentation, sourceText) - let matchBraces (sourceText: ISourceText, fileName, options: FSharpParsingOptions, userOpName: string, suggestNamesForErrors: bool) = + let matchBraces + ( + sourceText: ISourceText, + fileName, + options: FSharpParsingOptions, + userOpName: string, + suggestNamesForErrors: bool, + ct: CancellationToken + ) = // Make sure there is an DiagnosticsLogger installed whenever we do stuff that might record errors, even if we ultimately ignore the errors let delayedLogger = CapturingDiagnosticsLogger("matchBraces") use _ = UseDiagnosticsLogger delayedLogger @@ -2376,7 +2389,7 @@ module internal ParseAndCheckFile = let errHandler = DiagnosticsHandler(false, fileName, options.DiagnosticOptions, sourceText, suggestNamesForErrors, false) - let lexfun = createLexerFunction fileName options lexbuf errHandler + let lexfun = createLexerFunction fileName options lexbuf errHandler ct let parenTokensBalance t1 t2 = match t1, t2 with @@ -2469,7 +2482,8 @@ module internal ParseAndCheckFile = userOpName: string, suggestNamesForErrors: bool, flatErrors: bool, - identCapture: bool + identCapture: bool, + ct: CancellationToken ) = Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "parseFile", fileName) @@ -2486,7 +2500,7 @@ module internal ParseAndCheckFile = let parseResult = usingLexbufForParsing (createLexbuf options.LangVersionText options.StrictIndentation sourceText, fileName) (fun lexbuf -> - let lexfun = createLexerFunction fileName options lexbuf errHandler + let lexfun = createLexerFunction fileName options lexbuf errHandler ct let isLastCompiland = fileName.Equals(options.LastFileName, StringComparison.CurrentCultureIgnoreCase) @@ -2506,7 +2520,9 @@ module internal ParseAndCheckFile = identCapture, Some userOpName ) - with e -> + with + | :? OperationCanceledException -> reraise () + | e -> errHandler.DiagnosticsLogger.StopProcessingRecovery e range0 // don't re-raise any exceptions, we must return None. EmptyParsedInput(fileName, (isLastCompiland, isExe))) @@ -3322,6 +3338,8 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal let parsingOptions = FSharpParsingOptions.FromTcConfig(tcConfig, [| fileName |], true) + let! ct = Cancellable.token () + let parseErrors, parsedInput, anyErrors = ParseAndCheckFile.parseFile ( sourceText, @@ -3330,7 +3348,8 @@ type FsiInteractiveChecker(legacyReferenceResolver, tcConfig: TcConfig, tcGlobal userOpName, suggestNamesForErrors, tcConfig.flatErrors, - tcConfig.captureIdentifiersWhenParsing + tcConfig.captureIdentifiersWhenParsing, + ct ) let dependencyFiles = [||] // interactions have no dependencies diff --git a/src/Compiler/Service/FSharpCheckerResults.fsi b/src/Compiler/Service/FSharpCheckerResults.fsi index a301f3697d8..c4ba903faf1 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fsi +++ b/src/Compiler/Service/FSharpCheckerResults.fsi @@ -544,7 +544,8 @@ module internal ParseAndCheckFile = userOpName: string * suggestNamesForErrors: bool * flatErrors: bool * - identCapture: bool -> + identCapture: bool * + ct: CancellationToken -> FSharpDiagnostic[] * ParsedInput * bool val matchBraces: @@ -552,7 +553,8 @@ module internal ParseAndCheckFile = fileName: string * options: FSharpParsingOptions * userOpName: string * - suggestNamesForErrors: bool -> + suggestNamesForErrors: bool * + ct: CancellationToken -> (range * range)[] // An object to typecheck source in a given typechecking environment. diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index a079864c1a9..6727c11af63 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -506,6 +506,7 @@ type BackgroundCompiler | Some res -> return res | None -> Interlocked.Increment(&actualParseFileCount) |> ignore + let! ct = Async.CancellationToken let parseDiagnostics, parseTree, anyErrors = ParseAndCheckFile.parseFile ( @@ -515,15 +516,18 @@ type BackgroundCompiler userOpName, suggestNamesForErrors, flatErrors, - captureIdentifiersWhenParsing + captureIdentifiersWhenParsing, + ct ) let res = FSharpParseFileResults(parseDiagnostics, parseTree, anyErrors, options.SourceFiles) parseCacheLock.AcquireLock(fun ltok -> parseFileCache.Set(ltok, (fileName, hash, options), res)) return res else + let! ct = Async.CancellationToken + let parseDiagnostics, parseTree, anyErrors = - ParseAndCheckFile.parseFile (sourceText, fileName, options, userOpName, false, flatErrors, captureIdentifiersWhenParsing) + ParseAndCheckFile.parseFile (sourceText, fileName, options, userOpName, false, flatErrors, captureIdentifiersWhenParsing, ct) return FSharpParseFileResults(parseDiagnostics, parseTree, anyErrors, options.SourceFiles) } @@ -775,6 +779,7 @@ type BackgroundCompiler FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules) GraphNode.SetPreferredUILang tcPrior.TcConfig.preferredUiLang + let! ct = NodeCode.CancellationToken let parseDiagnostics, parseTree, anyErrors = ParseAndCheckFile.parseFile ( @@ -784,7 +789,8 @@ type BackgroundCompiler userOpName, suggestNamesForErrors, builder.TcConfig.flatErrors, - captureIdentifiersWhenParsing + captureIdentifiersWhenParsing, + ct ) let parseResults = @@ -1433,8 +1439,10 @@ type FSharpChecker match braceMatchCache.TryGet(AnyCallerThread, (fileName, hash, options)) with | Some res -> return res | None -> + let! ct = Async.CancellationToken + let res = - ParseAndCheckFile.matchBraces (sourceText, fileName, options, userOpName, suggestNamesForErrors) + ParseAndCheckFile.matchBraces (sourceText, fileName, options, userOpName, suggestNamesForErrors, ct) braceMatchCache.Set(AnyCallerThread, (fileName, hash, options), res) return res diff --git a/src/Compiler/SyntaxTree/LexHelpers.fs b/src/Compiler/SyntaxTree/LexHelpers.fs index eb204fc18b1..02d4da364d4 100644 --- a/src/Compiler/SyntaxTree/LexHelpers.fs +++ b/src/Compiler/SyntaxTree/LexHelpers.fs @@ -105,7 +105,9 @@ let reusingLexbufForParsing lexbuf f = try f () - with e -> + with + | :? OperationCanceledException -> reraise () + | e -> raise ( WrappedError( e, From 151e108f1c5feb649369bb7fc48d7001de2f811e Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 25 Jul 2023 16:40:41 +0200 Subject: [PATCH 03/12] x --- .../Language/RegressionTests.fs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs index 5298fa87f2c..b29311ba33b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs @@ -19,13 +19,3 @@ type TestItemSeq = |> compile |> withErrorCodes [39] |> ignore - - - [] - let ``Member val regression - not allowed without primary constructor`` () = - Fs """module Test - type Bad3 = - member val X = 1 + 1 """ - |> typecheck - |> shouldFail - |> withDiagnostics [] From 38d7f366a2355fc1a5f8d11566316aef4201488b Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 27 Jul 2023 13:18:55 +0200 Subject: [PATCH 04/12] tests covering non working case, fallback fix (still kind of hack) --- src/Compiler/CodeGen/EraseUnions.fs | 15 ++- .../Types/UnionTypes/UnionStructTypes.fs | 121 +++++++++++------- 2 files changed, 89 insertions(+), 47 deletions(-) diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index 5dcd60c9a14..7d9f5e814cc 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -334,6 +334,8 @@ let mkTagDiscriminate ilg cuspec _baseTy cidx = let mkTagDiscriminateThen ilg cuspec cidx after = [ mkGetTag ilg cuspec; mkLdcInt32 cidx ] @ mkCeqThen after +let basicTypes (ilg:ILGlobals) = [|ilg.typ_Bool;ilg.typ_Byte;ilg.typ_SByte;ilg.typ_Char;ilg.typ_Int16;ilg.typ_Int32;ilg.typ_UInt16;ilg.typ_UInt32 |] + /// The compilation for struct unions relies on generating a set of constructors. /// If necessary some fake types are added to the constructor parameters to distinguish the signature. let rec extraTysAndInstrsForStructCtor (ilg: ILGlobals) cidx = @@ -345,9 +347,15 @@ let rec extraTysAndInstrsForStructCtor (ilg: ILGlobals) cidx = | 4 -> [ ilg.typ_Int16 ], [ mkLdcInt32 0 ] | 5 -> [ ilg.typ_Int32 ], [ mkLdcInt32 0 ] | 6 -> [ ilg.typ_UInt16 ], [ mkLdcInt32 0 ] + | 7 -> [ ilg.typ_UInt32 ], [ mkLdcInt32 0 ] | _ -> - let tys, instrs = extraTysAndInstrsForStructCtor ilg (cidx - 7) - (ilg.typ_UInt32 :: tys, mkLdcInt32 0 :: instrs) + let mod8 = cidx % 8 + let div8 = cidx / 8 + + let matchingType = (basicTypes ilg)[mod8] + + let tys, instrs = extraTysAndInstrsForStructCtor ilg (div8) + (matchingType :: tys, mkLdcInt32 0 :: instrs) let takesExtraParams (alts: IlxUnionCase[]) = alts.Length > 1 @@ -389,6 +397,9 @@ let convNewDataInstrInternal ilg cuspec cidx = let ctorFieldTys = alt.FieldTypes |> Array.toList + let justTomasTestingThings = + [] + let extraTys, extraInstrs = if takesExtraParams cuspec.AlternativesArray then extraTysAndInstrsForStructCtor ilg cidx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index b22653ee742..f515f77ca7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -14,7 +14,7 @@ type StructUnion = | A | B of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -26,7 +26,7 @@ type StructUnion = | A | B of b: string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -39,7 +39,7 @@ type StructUnion = | B of string | C """ - |> compile + |> typecheck |> shouldSucceed [] @@ -52,7 +52,7 @@ type StructUnion = | B of b: string | C """ - |> compile + |> typecheck |> shouldSucceed [] @@ -65,7 +65,7 @@ type StructUnion = | B of b: string | C of bool """ - |> compile + |> typecheck |> shouldSucceed [] @@ -78,7 +78,7 @@ type StructUnion = | B | C of bool """ - |> compile + |> typecheck |> shouldSucceed [] @@ -90,7 +90,7 @@ type NotATree = | Empty | Children of struct (int * string) """ - |> compile + |> typecheck |> shouldSucceed [] @@ -102,7 +102,7 @@ type NotATree = | Empty | Children of struct (int * string) """ - |> compile + |> typecheck |> shouldSucceed [] @@ -114,7 +114,7 @@ type NotATree = | Empty | Children of a: struct (int * string) """ - |> compile + |> typecheck |> shouldSucceed [] @@ -127,7 +127,7 @@ type StructUnion = | B of string | C of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 15, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -144,7 +144,7 @@ type StructUnion = | B of string | C of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 13, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -161,7 +161,7 @@ type StructUnion = | B of b: string | C of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 15, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -178,7 +178,7 @@ type StructUnion = | B of b: string | C of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -191,7 +191,7 @@ type StructUnion = | B of b: string | C of c: string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -203,7 +203,7 @@ type StructUnion = | A of Item: int | B of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -218,7 +218,7 @@ type StructUnion = | A of Item: int | B of Item: string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -233,7 +233,7 @@ type StructUnion = | A of Item: int | B of item : string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -245,7 +245,7 @@ type StructUnion = | A of item: int | B of item: string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -260,7 +260,7 @@ type StructUnion = | A of Item: int * string | B of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -276,7 +276,7 @@ type StructUnion = | A of Item: int * item: string | B of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -292,7 +292,7 @@ type StructUnion = | A of Item: int * item: string | B of item: string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 16, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -308,7 +308,7 @@ type StructUnion = | A of Item: int * string | B of item: string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -320,7 +320,7 @@ type StructUnion = | A of item: string * int | B of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -332,7 +332,7 @@ type StructUnion = | A of item: string * item: int | B of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3176, Line 5, Col 27, Line 5, Col 31, "Named field 'item' is used more than once.") @@ -347,7 +347,7 @@ type StructUnion = | A of Item: string * Item: int | B of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3176, Line 5, Col 27, Line 5, Col 31, "Named field 'Item' is used more than once.") @@ -360,7 +360,7 @@ namespace Foo [] type StructUnion = A of a: int | B of b:string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -372,7 +372,7 @@ type StructUnion = | A of a: int | B of b: string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -384,7 +384,7 @@ type StructUnion = | A of a: int * a1: string | B of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -396,7 +396,7 @@ type StructUnion = | A of int * string | B of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -408,7 +408,7 @@ type StructUnion = | A of a: int * string | B of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -420,7 +420,7 @@ type StructUnion = | A of int * a1: string | B of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -432,7 +432,7 @@ type StructUnion = | A of int | B of b: string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -444,7 +444,7 @@ type StructUnion = | A of a: int * a1: string | B of b: string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -454,7 +454,7 @@ namespace Foo [] type StructUnion = A of int | B of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 4, Col 25, Line 4, Col 28, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -469,7 +469,7 @@ type StructUnion = | A of a: int | B of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -482,7 +482,7 @@ type StructUnion = | B of string | C of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 15, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -500,7 +500,7 @@ type StructUnion = | B of string | C of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 13, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -518,7 +518,7 @@ type StructUnion = | B of string | C of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 15, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -536,7 +536,7 @@ type StructUnion = | B of string | C of string """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 13, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -554,7 +554,7 @@ type StructUnion = | B of b: string | C of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -567,7 +567,7 @@ type StructUnion = | B of string | C of c: string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -580,7 +580,7 @@ type StructUnion = | B of b: string | C of string """ - |> compile + |> typecheck |> shouldSucceed [] @@ -593,7 +593,7 @@ type StructUnion = | B of string * b: string | C of c: string * string * c3: int """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 3204, Line 5, Col 12, Line 5, Col 13, "If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'.") @@ -614,7 +614,7 @@ type StructUnion = | B of b1: string * b: string | C of c: string * c1: string * c3: int """ - |> compile + |> typecheck |> shouldSucceed [] @@ -624,8 +624,39 @@ namespace Foo [] type StructUnion = A of X:int | B of Y:StructUnion """ - |> compile + |> typecheck |> shouldFail |> withDiagnostics [ (Error 954, Line 4, Col 6, Line 4, Col 17, "This type definition involves an immediate cyclic reference through a struct field or inheritance relation") ] + + [] + [] + [] + [] + [] + [] + [] + let ``Struct DU compilation does not embarassingly fail when having many data-less cases`` (countOfCases:int) = + let codeSb = + System.Text.StringBuilder(""" +module Foo +[] +type StructUnion = +""" ) + + for i=1 to countOfCases do + codeSb.AppendLine($" | Case{i}") |> ignore + + codeSb.AppendLine($""" +[] +let main _argv = + printf "%%A" Case{countOfCases} + 0""") |> ignore + + Fs (codeSb.ToString()) + |> asExe + |> compile + |> run + |> shouldSucceed + |> verifyOutput $"Case{countOfCases}" \ No newline at end of file From ed17a331237aad0019ddf246e67f91c00fff0cea Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 27 Jul 2023 16:35:42 +0200 Subject: [PATCH 05/12] Change construction methods for [] unions to enable creating > 49 of cases, simplify IL --- src/Compiler/CodeGen/EraseUnions.fs | 198 ++++++++---------- .../Types/UnionTypes/UnionStructTypes.fs | 101 +++++++-- 2 files changed, 179 insertions(+), 120 deletions(-) diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index 7d9f5e814cc..700df5bc68c 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -278,6 +278,9 @@ let mkRuntimeTypeDiscriminateThen ilg avoidHelpers cuspec alt altName altTy afte let mkGetTagFromField ilg cuspec baseTy = mkNormalLdfld (refToFieldInTy baseTy (mkTagFieldId ilg cuspec)) +let mkSetTagToField ilg cuspec baseTy = + mkNormalStfld (refToFieldInTy baseTy (mkTagFieldId ilg cuspec)) + let adjustFieldName hasHelpers nm = match hasHelpers, nm with | SpecialFSharpListHelpers, "Head" -> "HeadOrDefault" @@ -334,37 +337,6 @@ let mkTagDiscriminate ilg cuspec _baseTy cidx = let mkTagDiscriminateThen ilg cuspec cidx after = [ mkGetTag ilg cuspec; mkLdcInt32 cidx ] @ mkCeqThen after -let basicTypes (ilg:ILGlobals) = [|ilg.typ_Bool;ilg.typ_Byte;ilg.typ_SByte;ilg.typ_Char;ilg.typ_Int16;ilg.typ_Int32;ilg.typ_UInt16;ilg.typ_UInt32 |] - -/// The compilation for struct unions relies on generating a set of constructors. -/// If necessary some fake types are added to the constructor parameters to distinguish the signature. -let rec extraTysAndInstrsForStructCtor (ilg: ILGlobals) cidx = - match cidx with - | 0 -> [ ilg.typ_Bool ], [ mkLdcInt32 0 ] - | 1 -> [ ilg.typ_Byte ], [ mkLdcInt32 0 ] - | 2 -> [ ilg.typ_SByte ], [ mkLdcInt32 0 ] - | 3 -> [ ilg.typ_Char ], [ mkLdcInt32 0 ] - | 4 -> [ ilg.typ_Int16 ], [ mkLdcInt32 0 ] - | 5 -> [ ilg.typ_Int32 ], [ mkLdcInt32 0 ] - | 6 -> [ ilg.typ_UInt16 ], [ mkLdcInt32 0 ] - | 7 -> [ ilg.typ_UInt32 ], [ mkLdcInt32 0 ] - | _ -> - let mod8 = cidx % 8 - let div8 = cidx / 8 - - let matchingType = (basicTypes ilg)[mod8] - - let tys, instrs = extraTysAndInstrsForStructCtor ilg (div8) - (matchingType :: tys, mkLdcInt32 0 :: instrs) - -let takesExtraParams (alts: IlxUnionCase[]) = - alts.Length > 1 - && (alts |> Array.exists (fun d -> d.FieldDefs.Length > 0) - || - // Check if not all lengths are distinct - alts |> Array.countBy (fun d -> d.FieldDefs.Length) |> Array.length - <> alts.Length) - let convNewDataInstrInternal ilg cuspec cidx = let alt = altOfUnionSpec cuspec cidx let altTy = tyForAlt cuspec alt @@ -388,29 +360,11 @@ let convNewDataInstrInternal ilg cuspec cidx = instrs @ [ mkNormalNewobj (mkILCtorMethSpecForTy (baseTy, (ctorFieldTys @ tagfields))) ] elif cuspecRepr.RepresentAlternativeAsStructValue cuspec then + // Structs with fields should be created using maker methods (mkMakerName), only field-less cases are created this way + assert (alt.IsNullary) let baseTy = baseTyOfUnionSpec cuspec - - let instrs, tagfields = - match cuspecRepr.DiscriminationTechnique cuspec with - | IntegerTag -> [ mkLdcInt32 cidx ], [ mkTagFieldType ilg cuspec ] - | _ -> [], [] - - let ctorFieldTys = alt.FieldTypes |> Array.toList - - let justTomasTestingThings = - [] - - let extraTys, extraInstrs = - if takesExtraParams cuspec.AlternativesArray then - extraTysAndInstrsForStructCtor ilg cidx - else - [], [] - - instrs - @ extraInstrs - @ [ - mkNormalNewobj (mkILCtorMethSpecForTy (baseTy, (ctorFieldTys @ tagfields @ extraTys))) - ] + let tagField = [ mkTagFieldType ilg cuspec ] + [ mkLdcInt32 cidx; mkNormalNewobj (mkILCtorMethSpecForTy (baseTy, tagField)) ] else [ mkNormalNewobj (mkILCtorMethSpecForTy (altTy, Array.toList alt.FieldTypes)) ] @@ -425,6 +379,24 @@ let mkNewData ilg (cuspec, cidx) = let alt = altOfUnionSpec cuspec cidx let altName = alt.Name let baseTy = baseTyOfUnionSpec cuspec + + let viaMakerCall () = + [ + mkNormalCall ( + mkILNonGenericStaticMethSpecInTy ( + baseTy, + mkMakerName cuspec altName, + Array.toList alt.FieldTypes, + constFormalFieldTy baseTy + ) + ) + ] + + let viaGetAltNameProperty () = + [ + mkNormalCall (mkILNonGenericStaticMethSpecInTy (baseTy, "get_" + altName, [], constFormalFieldTy baseTy)) + ] + // If helpers exist, use them match cuspec.HasHelpers with | AllHelpers @@ -433,30 +405,13 @@ let mkNewData ilg (cuspec, cidx) = if cuspecRepr.RepresentAlternativeAsNull(cuspec, alt) then [ AI_ldnull ] elif alt.IsNullary then - [ - mkNormalCall (mkILNonGenericStaticMethSpecInTy (baseTy, "get_" + altName, [], constFormalFieldTy baseTy)) - ] + viaGetAltNameProperty () else - [ - mkNormalCall ( - mkILNonGenericStaticMethSpecInTy ( - baseTy, - mkMakerName cuspec altName, - Array.toList alt.FieldTypes, - constFormalFieldTy baseTy - ) - ) - ] + viaMakerCall () - | NoHelpers -> - if cuspecRepr.MaintainPossiblyUniqueConstantFieldForAlternative(cuspec, alt) then - // This method is only available if not AllHelpers. It fetches the unique object for the alternative - // without exposing direct access to the underlying field - [ - mkNormalCall (mkILNonGenericStaticMethSpecInTy (baseTy, "get_" + altName, [], constFormalFieldTy baseTy)) - ] - else - convNewDataInstrInternal ilg cuspec cidx + | NoHelpers when (not alt.IsNullary) && cuspecRepr.RepresentAlternativeAsStructValue cuspec -> viaMakerCall () + | NoHelpers when cuspecRepr.MaintainPossiblyUniqueConstantFieldForAlternative(cuspec, alt) -> viaGetAltNameProperty () + | NoHelpers -> convNewDataInstrInternal ilg cuspec cidx let mkIsData ilg (avoidHelpers, cuspec, cidx) = let alt = altOfUnionSpec cuspec cidx @@ -927,13 +882,35 @@ let convAlternativeDef [ nullaryMeth ], [ nullaryProp ] else - let ilInstrs = - [ - for i in 0 .. fields.Length - 1 do - mkLdarg (uint16 i) - yield! convNewDataInstrInternal g.ilg cuspec num - ] - |> nonBranchingInstrsToCode + let locals, ilInstrs = + if repr.RepresentAlternativeAsStructValue info then + let local = mkILLocal baseTy None + let ldloca = I_ldloca(0us) + + let ilInstrs = + [ + ldloca + ILInstr.I_initobj baseTy + ldloca + mkLdcInt32 num + mkSetTagToField g.ilg cuspec baseTy + for i in 0 .. fields.Length - 1 do + ldloca + mkLdarg (uint16 i) + mkNormalStfld (mkILFieldSpecInTy (baseTy, fields[i].LowerName, fields[i].Type)) + mkLdloc 0us + ] + + [ local ], ilInstrs + else + let ilInstrs = + [ + for i in 0 .. fields.Length - 1 do + mkLdarg (uint16 i) + yield! convNewDataInstrInternal g.ilg cuspec num + ] + + [], ilInstrs let mdef = mkILNonGenericStaticMethod ( @@ -943,7 +920,7 @@ let convAlternativeDef |> Array.map (fun fd -> mkILParamNamed (fd.LowerName, fd.Type)) |> Array.toList, mkILReturn baseTy, - mkMethodBody (true, [], fields.Length, ilInstrs, attr, imports) + mkMethodBody (true, locals, fields.Length, nonBranchingInstrsToCode ilInstrs, attr, imports) ) |> addMethodGeneratedAttrs |> addAltAttribs @@ -1230,9 +1207,20 @@ let mkClassUnionDef let isStruct = td.IsStruct + let ctorAccess = + if cuspec.HasHelpers = AllHelpers then + ILMemberAccess.Assembly + else + cud.UnionCasesAccessibility + let selfFields, selfMeths, selfProps = [ + let minNullaryIdx = + cud.UnionCases + |> Array.tryFindIndex (fun t -> t.IsNullary) + |> Option.defaultValue -1 + for cidx, alt in Array.indexed cud.UnionCases do if repr.RepresentAlternativeAsFreshInstancesOfRootClass(info, alt) @@ -1249,31 +1237,25 @@ let mkClassUnionDef | None -> Some g.ilg.typ_Object.TypeSpec | Some ilTy -> Some ilTy.TypeSpec - let extraParamsForCtor = - if isStruct && takesExtraParams cud.UnionCases then - let extraTys, _extraInstrs = extraTysAndInstrsForStructCtor g.ilg cidx - List.map mkILParamAnon extraTys - else - [] - - let ctorAccess = - (if cuspec.HasHelpers = AllHelpers then - ILMemberAccess.Assembly - else - cud.UnionCasesAccessibility) - let ctor = - (mkILSimpleStorageCtor ( - baseInit, - baseTy, - extraParamsForCtor, - (fields @ tagFieldsInObject), - ctorAccess, - cud.DebugPoint, - cud.DebugImports - )) - .With(customAttrs = mkILCustomAttrs [ GetDynamicDependencyAttribute g 0x660 baseTy ]) - |> addMethodGeneratedAttrs + // Structs with fields are created using static makers methods + // Structs without fields can share constructor for the 'tag' value, we just create one + if isStruct && not (cidx = minNullaryIdx) then + [] + else + [ + (mkILSimpleStorageCtor ( + baseInit, + baseTy, + [], + (fields @ tagFieldsInObject), + ctorAccess, + cud.DebugPoint, + cud.DebugImports + )) + .With(customAttrs = mkILCustomAttrs [ GetDynamicDependencyAttribute g 0x660 baseTy ]) + |> addMethodGeneratedAttrs + ] let props, meths = mkMethodsAndPropertiesForFields @@ -1285,7 +1267,7 @@ let mkClassUnionDef baseTy alt.FieldDefs - yield (fields, ([ ctor ] @ meths), props) + yield (fields, (ctor @ meths), props) ] |> List.unzip3 |> (fun (a, b, c) -> List.concat a, List.concat b, List.concat c) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index f515f77ca7e..70fbc633a1b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -630,33 +630,110 @@ type StructUnion = A of X:int | B of Y:StructUnion (Error 954, Line 4, Col 6, Line 4, Col 17, "This type definition involves an immediate cyclic reference through a struct field or inheritance relation") ] - [] - [] - [] - [] - [] - [] - [] - let ``Struct DU compilation does not embarassingly fail when having many data-less cases`` (countOfCases:int) = + + let createMassiveStructDuProgram countOfCases = let codeSb = System.Text.StringBuilder(""" module Foo -[] +[] type StructUnion = """ ) + + let basicTypes = [|"";"";"int";"string";"byte";"System.Uri";"int[]";"option";"voption";"System.Uri[]"|] for i=1 to countOfCases do - codeSb.AppendLine($" | Case{i}") |> ignore + let t = basicTypes[i%basicTypes.Length] + if t = "" then + codeSb.AppendLine($" | Case{i}") |> ignore + else + codeSb.AppendLine($" | Case{i} of field1_{i}:{t} * field2_{i}:{t}") |> ignore codeSb.AppendLine($""" [] let main _argv = - printf "%%A" Case{countOfCases} + printf "%%A" (Case{countOfCases} (Unchecked.defaultof<_>,Unchecked.defaultof<_>)) 0""") |> ignore Fs (codeSb.ToString()) + + + [] + [] + [] + [] + let ``Struct DU compilation does not embarassingly fail when having many data-less cases`` (countOfCases:int) = + createMassiveStructDuProgram countOfCases |> asExe |> compile |> run |> shouldSucceed - |> verifyOutput $"Case{countOfCases}" \ No newline at end of file + |> verifyOutput $"Case{countOfCases} (null, null)" + + + [] + let ``Struct DU compilation - have a look at IL for massive cases`` () = + createMassiveStructDuProgram 15 + |> asExe + |> compile + |> verifyIL [(*This is case-agnostic constructor used for data-less cases, just fills in the _tag property*)""" + instance void .ctor(int32 _tag) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 46 6F 6F 2B 53 74 72 75 63 + 74 55 6E 69 6F 6E 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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 Foo/StructUnion::_tag + IL_0007: ret + } """;(*This is getter for a data-less case, just calling into the constructor above*)""" + get_Case11() cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 0A 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldc.i4.s 10 + IL_0002: newobj instance void Foo/StructUnion::.ctor(int32) + IL_0007: ret + }""";(*This is a 'maker method' New{CaseName} used for cases which do have fields associated with them, + the _tag gets initialized*)""" + NewCase3(string _field1_3, + string _field2_3) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) + + .maxstack 2 + .locals init (valuetype Foo/StructUnion V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj Foo/StructUnion + IL_0008: ldloca.s V_0 + IL_000a: ldc.i4.2 + IL_000b: stfld int32 Foo/StructUnion::_tag + IL_0010: ldloca.s V_0 + IL_0012: ldarg.0 + IL_0013: stfld string Foo/StructUnion::_field1_3 + IL_0018: ldloca.s V_0 + IL_001a: ldarg.1 + IL_001b: stfld string Foo/StructUnion::_field2_3 + IL_0020: ldloc.0 + IL_0021: ret + } + + .method public hidebysig instance bool + get_IsCase3() 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 int32 Foo/StructUnion::get_Tag() + IL_0006: ldc.i4.2 + IL_0007: ceq + IL_0009: ret + } +"""] From 8a9aa381a0dfcebeae6b90327f7625400f626621 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 28 Jul 2023 10:50:11 +0200 Subject: [PATCH 06/12] add failing cases --- .../Types/UnionTypes/UnionStructTypes.fs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 70fbc633a1b..485aa5ac087 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -670,6 +670,20 @@ let main _argv = |> verifyOutput $"Case{countOfCases} (null, null)" + [] + let ``Single case DU keeps working`` () = + Fsx """ +namespace Foo +[] +type TagOnlyDu = SingleCaseDuCase + +[] +type DuWithData = SingleCase of field:int + """ + |> compile + |> shouldSucceed + + [] let ``Struct DU compilation - have a look at IL for massive cases`` () = createMassiveStructDuProgram 15 From 1471810bfcf30ce82e5fc7847c74b87cecccbc5d Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 28 Jul 2023 11:01:20 +0200 Subject: [PATCH 07/12] Fix single case DU wrapper and marker "types" --- src/Compiler/CodeGen/EraseUnions.fs | 12 ++++++++---- .../Types/UnionTypes/UnionStructTypes.fs | 14 +++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index 700df5bc68c..eabe7fddd95 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -359,7 +359,10 @@ let convNewDataInstrInternal ilg cuspec cidx = instrs @ [ mkNormalNewobj (mkILCtorMethSpecForTy (baseTy, (ctorFieldTys @ tagfields))) ] - elif cuspecRepr.RepresentAlternativeAsStructValue cuspec then + elif + cuspecRepr.RepresentAlternativeAsStructValue cuspec + && cuspecRepr.DiscriminationTechnique cuspec = IntegerTag + then // Structs with fields should be created using maker methods (mkMakerName), only field-less cases are created this way assert (alt.IsNullary) let baseTy = baseTyOfUnionSpec cuspec @@ -891,9 +894,10 @@ let convAlternativeDef [ ldloca ILInstr.I_initobj baseTy - ldloca - mkLdcInt32 num - mkSetTagToField g.ilg cuspec baseTy + if (repr.DiscriminationTechnique info) = IntegerTag then + ldloca + mkLdcInt32 num + mkSetTagToField g.ilg cuspec baseTy for i in 0 .. fields.Length - 1 do ldloca mkLdarg (uint16 i) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 485aa5ac087..85764d5682f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -671,11 +671,9 @@ let main _argv = [] - let ``Single case DU keeps working`` () = + let ``Single case DU wrapper works`` () = Fsx """ namespace Foo -[] -type TagOnlyDu = SingleCaseDuCase [] type DuWithData = SingleCase of field:int @@ -683,6 +681,16 @@ type DuWithData = SingleCase of field:int |> compile |> shouldSucceed + [] + let ``Single case DU marker works`` () = + Fsx """ +namespace Foo +[] +type TagOnlyDu = SingleCaseDuCase + """ + |> compile + |> shouldSucceed + [] let ``Struct DU compilation - have a look at IL for massive cases`` () = From 6fda6a698d8b7a0bc6b21ba426b6f53c6f119bba Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 28 Jul 2023 12:32:09 +0200 Subject: [PATCH 08/12] failing test for custom ValueOption --- src/Compiler/CodeGen/EraseUnions.fs | 2 +- .../Types/UnionTypes/UnionStructTypes.fs | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index eabe7fddd95..d4d66503c2f 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -894,7 +894,7 @@ let convAlternativeDef [ ldloca ILInstr.I_initobj baseTy - if (repr.DiscriminationTechnique info) = IntegerTag then + if (repr.DiscriminationTechnique info) = IntegerTag && num <> 0 then ldloca mkLdcInt32 num mkSetTagToField g.ilg cuspec baseTy diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 85764d5682f..00f5e5fca30 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -691,6 +691,71 @@ type TagOnlyDu = SingleCaseDuCase |> compile |> shouldSucceed + [] + let ``Generic struct DU works`` () = + Fsx """ +namespace Foo +[] +type GenericStructDu<'T> = EmptyFirst | SingleVal of f:'T | DoubleVal of f2:'T * int + """ + |> compile + |> shouldSucceed + + [] + let ``Struct DU ValueOption keeps working`` () = + Fsx """ +module VOTests + +let nothing = ValueNone +let someInt = ValueSome 42 +let someSomeInt = ValueSome (ValueSome 2112) + +let matchOnVO arg = + match arg with + | ValueNone -> 333 + | ValueSome 42 -> 666 + | ValueSome anyOther -> 999 + +let result1 = matchOnVO nothing +let result2 = matchOnVO someInt + +printf $"{result1};{result2}" + + """ + |> asExe + |> compile + |> shouldSucceed + |> run + |> verifyOutput "333;666" + + [] + let ``Custom ValueOption keeps working`` () = + Fsx """ +module XX +open System + +[] +[] +type ThisIsMyValueOptionType<'T> = + | MyValueNone + | MyValueSome of Item:'T + + static member None = MyValueNone + static member Some (value) = MyValueSome(value) + + + +let x = ThisIsMyValueOptionType.Some(42) +[] +let main args = + printf "%A" x + 0 """ + |> asExe + |> compile + |> verifyIL ["abc"] + //|> shouldSucceed + //|> run + //|> verifyOutput "MyValueSome 42" [] let ``Struct DU compilation - have a look at IL for massive cases`` () = From 2d90917a4c69a102d91a705206cc8d98f28692aa Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 28 Jul 2023 14:06:44 +0200 Subject: [PATCH 09/12] adjusting .maxstack --- src/Compiler/CodeGen/EraseUnions.fs | 2 +- .../Types/UnionTypes/UnionStructTypes.fs | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index d4d66503c2f..d00c45f2df7 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -924,7 +924,7 @@ let convAlternativeDef |> Array.map (fun fd -> mkILParamNamed (fd.LowerName, fd.Type)) |> Array.toList, mkILReturn baseTy, - mkMethodBody (true, locals, fields.Length, nonBranchingInstrsToCode ilInstrs, attr, imports) + mkMethodBody (true, locals, fields.Length + locals.Length, nonBranchingInstrsToCode ilInstrs, attr, imports) ) |> addMethodGeneratedAttrs |> addAltAttribs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 00f5e5fca30..46ebe97f112 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -752,10 +752,17 @@ let main args = 0 """ |> asExe |> compile - |> verifyIL ["abc"] - //|> shouldSucceed - //|> run - //|> verifyOutput "MyValueSome 42" + |> shouldSucceed + |> run + |> verifyOutput "MyValueSome 42" + + [] + let sysDiagnostics = + #if NETCOREAPP + "[runtime]System.Diagnostics" + #else + "System.Diagnostics" + #endif [] let ``Struct DU compilation - have a look at IL for massive cases`` () = @@ -765,7 +772,7 @@ let main args = |> verifyIL [(*This is case-agnostic constructor used for data-less cases, just fills in the _tag property*)""" instance void .ctor(int32 _tag) cil managed { - .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + .custom instance void """+sysDiagnostics+""".CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype """+sysDiagnostics+""".CodeAnalysis.DynamicallyAccessedMemberTypes, class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 46 6F 6F 2B 53 74 72 75 63 74 55 6E 69 6F 6E 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -793,7 +800,7 @@ let main args = .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) - .maxstack 2 + .maxstack 3 .locals init (valuetype Foo/StructUnion V_0) IL_0000: ldloca.s V_0 IL_0002: initobj Foo/StructUnion From 26994d002ba14826cc6f6f9873926d13f68ee2cd Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 28 Jul 2023 16:04:44 +0200 Subject: [PATCH 10/12] IL baselines updated --- .../Inlining/Match01.fs.il.net472.debug.bsl | 72 ++--- .../Inlining/Match01.fs.il.net472.release.bsl | 72 ++--- .../Inlining/Match01.fs.il.netcore.debug.bsl | 72 ++--- .../Match01.fs.il.netcore.release.bsl | 72 ++--- .../Inlining/StructUnion01.fs.il.net472.bsl | 131 +------- .../Inlining/StructUnion01.fs.il.netcore.bsl | 286 +++++++++--------- .../TestFunctions/Verify13043.fs.il.debug.bsl | 152 +++++----- .../Verify13043.fs.il.release.bsl | 152 +++++----- 8 files changed, 447 insertions(+), 562 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl index 06514590ac1..45ba3be6216 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl @@ -1125,6 +1125,42 @@ } } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1386,42 +1422,6 @@ IL_00ef: ret } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl index 6b5629b9317..13e4c61843e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl @@ -1120,6 +1120,42 @@ } } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1389,42 +1425,6 @@ IL_00fc: ret } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl index a26af5e534a..9f7c89bc0ad 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl @@ -1125,6 +1125,42 @@ } } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1386,42 +1422,6 @@ IL_00ef: ret } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl index c6444083260..986841f2ee8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl @@ -1120,6 +1120,42 @@ } } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1389,42 +1425,6 @@ IL_00fc: ret } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl index c6d02a9df1f..6733894d53f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl @@ -70,32 +70,18 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: newobj instance void assembly/U::.ctor(int32, - int32) - IL_0007: ret - } - - .method assembly specialname rtspecialname - instance void .ctor(int32 item1, - int32 item2) cil managed - { - .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, - class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 53 74 72 75 63 74 55 6E 69 - 6F 6E 30 31 2B 55 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 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stfld int32 assembly/U::item1 - IL_0007: ldarg.0 - IL_0008: ldarg.2 - IL_0009: stfld int32 assembly/U::item2 - IL_000e: ret + .maxstack 3 + .locals init (valuetype assembly/U V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj assembly/U + IL_0008: ldloca.s V_0 + IL_000a: ldarg.0 + IL_000b: stfld int32 assembly/U::item1 + IL_0010: ldloca.s V_0 + IL_0012: ldarg.1 + IL_0013: stfld int32 assembly/U::item2 + IL_0018: ldloc.0 + IL_0019: ret } .method public hidebysig instance int32 @@ -723,99 +709,6 @@ } -.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes - extends [runtime]System.Enum -{ - .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 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 ) - .field public specialname rtspecialname int32 value__ - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) -} - -.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute - extends [runtime]System.Attribute -{ - .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ - .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 ) - .field private class [runtime]System.Type Type@ - .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 public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) 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 [runtime]System.Attribute::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ - IL_0014: ret - } - - .method public hidebysig specialname instance class [runtime]System.Type - get_Type() 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: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ - IL_0006: ret - } - - .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes - get_MemberType() 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: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ - IL_0006: ret - } - - .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes - MemberType() - { - .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 ) - .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() - } - .property instance class [runtime]System.Type - Type() - { - .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 ) - .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() - } -} - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl index bd99fcd158f..f9e8a68c5d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl @@ -9,31 +9,31 @@ { .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 ) - - + 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.exe .imagebase {value} .file alignment 0x00000200 .stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 +.subsystem 0x0003 +.corflags 0x00000001 @@ -42,7 +42,7 @@ .class public abstract auto ansi sealed assembly 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 ) + .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 sequential autochar serializable sealed nested public beforefieldinit U extends [runtime]System.ValueType implements class [runtime]System.IEquatable`1, @@ -51,96 +51,82 @@ [runtime]System.IComparable, [runtime]System.Collections.IStructuralComparable { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C - 61 79 28 29 2C 6E 71 7D 00 00 ) - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) .field assembly int32 item1 - .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 ) + .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 ) .field assembly int32 item2 - .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 public static valuetype assembly/U + .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 public static valuetype assembly/U NewU(int32 item1, int32 item2) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: newobj instance void assembly/U::.ctor(int32, - int32) - IL_0007: ret - } - - .method assembly specialname rtspecialname - instance void .ctor(int32 item1, - int32 item2) cil managed - { - .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, - class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 53 74 72 75 63 74 55 6E 69 - 6F 6E 30 31 2B 55 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 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stfld int32 assembly/U::item1 - IL_0007: ldarg.0 - IL_0008: ldarg.2 - IL_0009: stfld int32 assembly/U::item2 - IL_000e: ret - } + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 3 + .locals init (valuetype assembly/U V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj assembly/U + IL_0008: ldloca.s V_0 + IL_000a: ldarg.0 + IL_000b: stfld int32 assembly/U::item1 + IL_0010: ldloca.s V_0 + IL_0012: ldarg.1 + IL_0013: stfld int32 assembly/U::item2 + IL_0018: ldloc.0 + IL_0019: ret + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Item1() 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 ) - + .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: ldfld int32 assembly/U::item1 IL_0006: ret - } + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Item2() 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 ) - + .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: ldfld int32 assembly/U::item2 IL_0006: ret - } + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Tag() 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 ) - + .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: pop IL_0002: ldc.i4.0 IL_0003: ret - } + } - .method assembly hidebysig specialname + .method assembly hidebysig specialname instance object __DebugDisplay() 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 ) - + .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: ldstr "%+0.8A" IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) @@ -149,13 +135,13 @@ IL_0010: ldobj assembly/U IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_001a: ret - } + } - .method public strict virtual instance string + .method public strict virtual instance string ToString() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldstr "%+A" IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,valuetype assembly/U>::.ctor(string) @@ -164,13 +150,13 @@ IL_0010: ldobj assembly/U IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_001a: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(valuetype assembly/U obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 5 .locals init (int32 V_0, class [runtime]System.Collections.IComparer V_1, @@ -224,27 +210,27 @@ IL_0048: clt IL_004a: sub IL_004b: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: unbox.any assembly/U IL_0007: call instance int32 assembly/U::CompareTo(valuetype assembly/U) IL_000c: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 5 .locals init (valuetype assembly/U V_0, int32 V_1, @@ -297,13 +283,13 @@ IL_0043: clt IL_0045: sub IL_0046: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 7 .locals init (int32 V_0) IL_0000: ldc.i4.0 @@ -340,26 +326,26 @@ IL_002f: stloc.0 IL_0030: ldloc.0 IL_0031: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() IL_0006: call instance int32 assembly/U::GetHashCode(class [runtime]System.Collections.IEqualityComparer) IL_000b: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 4 .locals init (valuetype assembly/U V_0) IL_0000: ldarg.1 @@ -389,13 +375,13 @@ IL_0032: ldc.i4.0 IL_0033: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(valuetype assembly/U obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: pop @@ -414,13 +400,13 @@ IL_0021: ldc.i4.0 IL_0022: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.1 IL_0001: isinst assembly/U @@ -434,38 +420,38 @@ IL_0015: ldc.i4.0 IL_0016: ret - } + } .property instance int32 Tag() { - .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 ) - .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 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .get instance int32 assembly/U::get_Tag() - } + } .property instance int32 Item1() { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32, - int32) = ( 01 00 04 00 00 00 00 00 00 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 ) + int32) = ( 01 00 04 00 00 00 00 00 00 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 ) .get instance int32 assembly/U::get_Item1() - } + } .property instance int32 Item2() { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 01 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 ) + int32) = ( 01 00 04 00 00 00 00 00 00 00 01 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 ) .get instance int32 assembly/U::get_Item2() - } - } + } + } .method public static int32 g1(valuetype assembly/U _arg1) cil managed { - + .maxstack 8 IL_0000: ldarga.s _arg1 IL_0002: ldfld int32 assembly/U::item1 @@ -473,11 +459,11 @@ IL_0009: ldfld int32 assembly/U::item2 IL_000e: add IL_000f: ret - } + } .method public static int32 g2(valuetype assembly/U u) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarga.s u @@ -486,18 +472,18 @@ IL_000a: ldfld int32 assembly/U::item2 IL_000f: add IL_0010: ret - } + } .method public static int32 g3(valuetype assembly/U x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarga.s x IL_0003: ldfld int32 assembly/U::item1 IL_0008: ldc.i4.3 IL_0009: sub - IL_000a: switch ( + IL_000a: switch ( IL_0015) IL_0013: br.s IL_001d @@ -511,13 +497,13 @@ IL_0026: ldfld int32 assembly/U::item2 IL_002b: add IL_002c: ret - } + } .method public static int32 g4(valuetype assembly/U x, valuetype assembly/U y) 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 ) - + .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 6 .locals init (int32 V_0, int32 V_1, @@ -528,7 +514,7 @@ IL_0003: ldfld int32 assembly/U::item1 IL_0008: ldc.i4.3 IL_0009: sub - IL_000a: switch ( + IL_000a: switch ( IL_0015) IL_0013: br.s IL_0059 @@ -536,7 +522,7 @@ IL_0017: ldfld int32 assembly/U::item1 IL_001c: ldc.i4.5 IL_001d: sub - IL_001e: switch ( + IL_001e: switch ( IL_0049) IL_0027: ldarga.s y IL_0029: ldfld int32 assembly/U::item2 @@ -579,11 +565,11 @@ IL_007e: ldloc.0 IL_007f: add IL_0080: ret - } + } .method public static int32 f1(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 @@ -592,11 +578,11 @@ IL_0008: ldfld int32 assembly/U::item2 IL_000d: add IL_000e: ret - } + } .method public static int32 f2(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 @@ -605,18 +591,18 @@ IL_0008: ldfld int32 assembly/U::item2 IL_000d: add IL_000e: ret - } + } .method public static int32 f3(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 IL_0002: ldfld int32 assembly/U::item1 IL_0007: ldc.i4.3 IL_0008: sub - IL_0009: switch ( + IL_0009: switch ( IL_0014) IL_0012: br.s IL_001b @@ -630,13 +616,13 @@ IL_0022: ldfld int32 assembly/U::item2 IL_0027: add IL_0028: ret - } + } .method public static int32 f4(valuetype assembly/U& x, valuetype assembly/U& y) 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 ) - + .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 6 .locals init (valuetype assembly/U V_0, valuetype assembly/U V_1, @@ -655,7 +641,7 @@ IL_0011: ldfld int32 assembly/U::item1 IL_0016: ldc.i4.3 IL_0017: sub - IL_0018: switch ( + IL_0018: switch ( IL_0023) IL_0021: br.s IL_0069 @@ -663,7 +649,7 @@ IL_0025: ldfld int32 assembly/U::item1 IL_002a: ldc.i4.5 IL_002b: sub - IL_002c: switch ( + IL_002c: switch ( IL_0059) IL_0035: ldloca.s V_1 IL_0037: ldfld int32 assembly/U::item2 @@ -706,9 +692,9 @@ IL_0092: ldloc.2 IL_0093: add IL_0094: ret - } + } -} +} .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object @@ -716,9 +702,15 @@ .method public static void main@() cil managed { .entrypoint - + .maxstack 8 IL_0000: ret - } + } + +} + + + + + -} diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl index db118790e53..a8adc2b9f6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl @@ -43,6 +43,82 @@ 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 matchResult@38 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/matchResult@38 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/matchResult@38::.ctor() + IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/functionResult@43 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/functionResult@43::.ctor() + IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance + IL_000a: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f@8 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> { @@ -177,82 +253,6 @@ } - .class auto ansi serializable sealed nested assembly beforefieldinit matchResult@38 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/matchResult@38 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/matchResult@38::.ctor() - IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance - IL_000a: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/functionResult@43 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/functionResult@43::.ctor() - IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance - IL_000a: ret - } - - } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_list() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl index db118790e53..a8adc2b9f6a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl @@ -43,6 +43,82 @@ 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 matchResult@38 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/matchResult@38 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/matchResult@38::.ctor() + IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/functionResult@43 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/functionResult@43::.ctor() + IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance + IL_000a: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f@8 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> { @@ -177,82 +253,6 @@ } - .class auto ansi serializable sealed nested assembly beforefieldinit matchResult@38 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/matchResult@38 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/matchResult@38::.ctor() - IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance - IL_000a: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/functionResult@43 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/functionResult@43::.ctor() - IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance - IL_000a: ret - } - - } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_list() cil managed { From f0f01088fb06c7332fd3c7da00fe4038b12f58f9 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 28 Jul 2023 17:52:20 +0200 Subject: [PATCH 11/12] Revert "IL baselines updated" This reverts commit 26994d002ba14826cc6f6f9873926d13f68ee2cd. --- .../Inlining/Match01.fs.il.net472.debug.bsl | 72 ++--- .../Inlining/Match01.fs.il.net472.release.bsl | 72 ++--- .../Inlining/Match01.fs.il.netcore.debug.bsl | 72 ++--- .../Match01.fs.il.netcore.release.bsl | 72 ++--- .../Inlining/StructUnion01.fs.il.net472.bsl | 131 +++++++- .../Inlining/StructUnion01.fs.il.netcore.bsl | 286 +++++++++--------- .../TestFunctions/Verify13043.fs.il.debug.bsl | 152 +++++----- .../Verify13043.fs.il.release.bsl | 152 +++++----- 8 files changed, 562 insertions(+), 447 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl index 45ba3be6216..06514590ac1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.debug.bsl @@ -1125,42 +1125,6 @@ } } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1422,6 +1386,42 @@ IL_00ef: ret } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl index 13e4c61843e..6b5629b9317 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.net472.release.bsl @@ -1120,42 +1120,6 @@ } } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1425,6 +1389,42 @@ IL_00fc: ret } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl index 9f7c89bc0ad..a26af5e534a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.debug.bsl @@ -1125,42 +1125,6 @@ } } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1422,6 +1386,42 @@ IL_00ef: ret } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl index 986841f2ee8..c6444083260 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01.fs.il.netcore.release.bsl @@ -1120,42 +1120,6 @@ } } - .method public static int32 select1(class assembly/Test1 x) cil managed - { - - .maxstack 8 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call instance int32 assembly/Test1::get_Tag() - IL_0007: switch ( - IL_001c, - IL_0028, - IL_002a, - IL_002c) - IL_001c: ldarg.0 - IL_001d: castclass assembly/Test1/X11 - IL_0022: ldfld int32 assembly/Test1/X11::item - IL_0027: ret - - IL_0028: ldc.i4.2 - IL_0029: ret - - IL_002a: ldc.i4.3 - IL_002b: ret - - IL_002c: ldc.i4.4 - IL_002d: ret - } - - .method public static int32 fm(class assembly/Test1 y) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call int32 assembly::select1(class assembly/Test1) - IL_0006: ret - } - .method assembly static int32 CompareTo$cont@4(class assembly/Test1 this, class assembly/Test1 obj, class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed @@ -1425,6 +1389,42 @@ IL_00fc: ret } + .method public static int32 select1(class assembly/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 assembly/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass assembly/Test1/X11 + IL_0022: ldfld int32 assembly/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class assembly/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 assembly::select1(class assembly/Test1) + IL_0006: ret + } + } .class private abstract auto ansi sealed ''.$assembly diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl index 6733894d53f..c6d02a9df1f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl @@ -70,18 +70,32 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - .maxstack 3 - .locals init (valuetype assembly/U V_0) - IL_0000: ldloca.s V_0 - IL_0002: initobj assembly/U - IL_0008: ldloca.s V_0 - IL_000a: ldarg.0 - IL_000b: stfld int32 assembly/U::item1 - IL_0010: ldloca.s V_0 - IL_0012: ldarg.1 - IL_0013: stfld int32 assembly/U::item2 - IL_0018: ldloc.0 - IL_0019: ret + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: newobj instance void assembly/U::.ctor(int32, + int32) + IL_0007: ret + } + + .method assembly specialname rtspecialname + instance void .ctor(int32 item1, + int32 item2) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 53 74 72 75 63 74 55 6E 69 + 6F 6E 30 31 2B 55 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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 assembly/U::item1 + IL_0007: ldarg.0 + IL_0008: ldarg.2 + IL_0009: stfld int32 assembly/U::item2 + IL_000e: ret } .method public hidebysig instance int32 @@ -709,6 +723,99 @@ } +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 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 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .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 ) + .field private class [runtime]System.Type Type@ + .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 public specialname rtspecialname + instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, + class [runtime]System.Type Type) 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 [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type + get_Type() 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: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + get_MemberType() 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: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .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 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .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 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl index f9e8a68c5d8..bd99fcd158f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl @@ -9,31 +9,31 @@ { .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 ) + 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.exe .imagebase {value} .file alignment 0x00000200 .stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 +.subsystem 0x0003 +.corflags 0x00000001 @@ -42,7 +42,7 @@ .class public abstract auto ansi sealed assembly 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 ) + .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 sequential autochar serializable sealed nested public beforefieldinit U extends [runtime]System.ValueType implements class [runtime]System.IEquatable`1, @@ -51,82 +51,96 @@ [runtime]System.IComparable, [runtime]System.Collections.IStructuralComparable { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C - 61 79 28 29 2C 6E 71 7D 00 00 ) - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) .field assembly int32 item1 - .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 ) + .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 ) .field assembly int32 item2 - .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 public static valuetype assembly/U + .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 public static valuetype assembly/U NewU(int32 item1, int32 item2) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - - .maxstack 3 - .locals init (valuetype assembly/U V_0) - IL_0000: ldloca.s V_0 - IL_0002: initobj assembly/U - IL_0008: ldloca.s V_0 - IL_000a: ldarg.0 - IL_000b: stfld int32 assembly/U::item1 - IL_0010: ldloca.s V_0 - IL_0012: ldarg.1 - IL_0013: stfld int32 assembly/U::item2 - IL_0018: ldloc.0 - IL_0019: ret - } + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: newobj instance void assembly/U::.ctor(int32, + int32) + IL_0007: ret + } + + .method assembly specialname rtspecialname + instance void .ctor(int32 item1, + int32 item2) cil managed + { + .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 53 74 72 75 63 74 55 6E 69 + 6F 6E 30 31 2B 55 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 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 assembly/U::item1 + IL_0007: ldarg.0 + IL_0008: ldarg.2 + IL_0009: stfld int32 assembly/U::item2 + IL_000e: ret + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Item1() 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 ) - + .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: ldfld int32 assembly/U::item1 IL_0006: ret - } + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Item2() 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 ) - + .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: ldfld int32 assembly/U::item2 IL_0006: ret - } + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Tag() 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 ) - + .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: pop IL_0002: ldc.i4.0 IL_0003: ret - } + } - .method assembly hidebysig specialname + .method assembly hidebysig specialname instance object __DebugDisplay() 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 ) - + .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: ldstr "%+0.8A" IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) @@ -135,13 +149,13 @@ IL_0010: ldobj assembly/U IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_001a: ret - } + } - .method public strict virtual instance string + .method public strict virtual instance string ToString() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldstr "%+A" IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,valuetype assembly/U>::.ctor(string) @@ -150,13 +164,13 @@ IL_0010: ldobj assembly/U IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_001a: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(valuetype assembly/U obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 5 .locals init (int32 V_0, class [runtime]System.Collections.IComparer V_1, @@ -210,27 +224,27 @@ IL_0048: clt IL_004a: sub IL_004b: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: unbox.any assembly/U IL_0007: call instance int32 assembly/U::CompareTo(valuetype assembly/U) IL_000c: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 5 .locals init (valuetype assembly/U V_0, int32 V_1, @@ -283,13 +297,13 @@ IL_0043: clt IL_0045: sub IL_0046: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 7 .locals init (int32 V_0) IL_0000: ldc.i4.0 @@ -326,26 +340,26 @@ IL_002f: stloc.0 IL_0030: ldloc.0 IL_0031: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() IL_0006: call instance int32 assembly/U::GetHashCode(class [runtime]System.Collections.IEqualityComparer) IL_000b: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 4 .locals init (valuetype assembly/U V_0) IL_0000: ldarg.1 @@ -375,13 +389,13 @@ IL_0032: ldc.i4.0 IL_0033: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(valuetype assembly/U obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: pop @@ -400,13 +414,13 @@ IL_0021: ldc.i4.0 IL_0022: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.1 IL_0001: isinst assembly/U @@ -420,38 +434,38 @@ IL_0015: ldc.i4.0 IL_0016: ret - } + } .property instance int32 Tag() { - .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 ) - .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 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .get instance int32 assembly/U::get_Tag() - } + } .property instance int32 Item1() { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32, - int32) = ( 01 00 04 00 00 00 00 00 00 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 ) + int32) = ( 01 00 04 00 00 00 00 00 00 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 ) .get instance int32 assembly/U::get_Item1() - } + } .property instance int32 Item2() { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 01 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 ) + int32) = ( 01 00 04 00 00 00 00 00 00 00 01 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 ) .get instance int32 assembly/U::get_Item2() - } - } + } + } .method public static int32 g1(valuetype assembly/U _arg1) cil managed { - + .maxstack 8 IL_0000: ldarga.s _arg1 IL_0002: ldfld int32 assembly/U::item1 @@ -459,11 +473,11 @@ IL_0009: ldfld int32 assembly/U::item2 IL_000e: add IL_000f: ret - } + } .method public static int32 g2(valuetype assembly/U u) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarga.s u @@ -472,18 +486,18 @@ IL_000a: ldfld int32 assembly/U::item2 IL_000f: add IL_0010: ret - } + } .method public static int32 g3(valuetype assembly/U x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarga.s x IL_0003: ldfld int32 assembly/U::item1 IL_0008: ldc.i4.3 IL_0009: sub - IL_000a: switch ( + IL_000a: switch ( IL_0015) IL_0013: br.s IL_001d @@ -497,13 +511,13 @@ IL_0026: ldfld int32 assembly/U::item2 IL_002b: add IL_002c: ret - } + } .method public static int32 g4(valuetype assembly/U x, valuetype assembly/U y) 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 ) - + .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 6 .locals init (int32 V_0, int32 V_1, @@ -514,7 +528,7 @@ IL_0003: ldfld int32 assembly/U::item1 IL_0008: ldc.i4.3 IL_0009: sub - IL_000a: switch ( + IL_000a: switch ( IL_0015) IL_0013: br.s IL_0059 @@ -522,7 +536,7 @@ IL_0017: ldfld int32 assembly/U::item1 IL_001c: ldc.i4.5 IL_001d: sub - IL_001e: switch ( + IL_001e: switch ( IL_0049) IL_0027: ldarga.s y IL_0029: ldfld int32 assembly/U::item2 @@ -565,11 +579,11 @@ IL_007e: ldloc.0 IL_007f: add IL_0080: ret - } + } .method public static int32 f1(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 @@ -578,11 +592,11 @@ IL_0008: ldfld int32 assembly/U::item2 IL_000d: add IL_000e: ret - } + } .method public static int32 f2(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 @@ -591,18 +605,18 @@ IL_0008: ldfld int32 assembly/U::item2 IL_000d: add IL_000e: ret - } + } .method public static int32 f3(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 IL_0002: ldfld int32 assembly/U::item1 IL_0007: ldc.i4.3 IL_0008: sub - IL_0009: switch ( + IL_0009: switch ( IL_0014) IL_0012: br.s IL_001b @@ -616,13 +630,13 @@ IL_0022: ldfld int32 assembly/U::item2 IL_0027: add IL_0028: ret - } + } .method public static int32 f4(valuetype assembly/U& x, valuetype assembly/U& y) 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 ) - + .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 6 .locals init (valuetype assembly/U V_0, valuetype assembly/U V_1, @@ -641,7 +655,7 @@ IL_0011: ldfld int32 assembly/U::item1 IL_0016: ldc.i4.3 IL_0017: sub - IL_0018: switch ( + IL_0018: switch ( IL_0023) IL_0021: br.s IL_0069 @@ -649,7 +663,7 @@ IL_0025: ldfld int32 assembly/U::item1 IL_002a: ldc.i4.5 IL_002b: sub - IL_002c: switch ( + IL_002c: switch ( IL_0059) IL_0035: ldloca.s V_1 IL_0037: ldfld int32 assembly/U::item2 @@ -692,9 +706,9 @@ IL_0092: ldloc.2 IL_0093: add IL_0094: ret - } + } -} +} .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object @@ -702,15 +716,9 @@ .method public static void main@() cil managed { .entrypoint - + .maxstack 8 IL_0000: ret - } - -} - - - - - + } +} diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl index a8adc2b9f6a..db118790e53 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.debug.bsl @@ -43,82 +43,6 @@ 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 matchResult@38 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/matchResult@38 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/matchResult@38::.ctor() - IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance - IL_000a: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/functionResult@43 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/functionResult@43::.ctor() - IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance - IL_000a: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f@8 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> { @@ -253,6 +177,82 @@ } + .class auto ansi serializable sealed nested assembly beforefieldinit matchResult@38 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/matchResult@38 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/matchResult@38::.ctor() + IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/functionResult@43 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/functionResult@43::.ctor() + IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance + IL_000a: ret + } + + } + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_list() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl index a8adc2b9f6a..db118790e53 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.il.release.bsl @@ -43,82 +43,6 @@ 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 matchResult@38 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/matchResult@38 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/matchResult@38::.ctor() - IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance - IL_000a: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field static assembly initonly class assembly/functionResult@43 @_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 bool - Invoke(int32 n) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: call bool assembly::condition(int32) - IL_0006: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 10 - IL_0000: newobj instance void assembly/functionResult@43::.ctor() - IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance - IL_000a: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f@8 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> { @@ -253,6 +177,82 @@ } + .class auto ansi serializable sealed nested assembly beforefieldinit matchResult@38 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/matchResult@38 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/matchResult@38::.ctor() + IL_0005: stsfld class assembly/matchResult@38 assembly/matchResult@38::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit functionResult@43 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/functionResult@43 @_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 bool + Invoke(int32 n) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: call bool assembly::condition(int32) + IL_0006: ret + } + + .method private specialname rtspecialname static + void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/functionResult@43::.ctor() + IL_0005: stsfld class assembly/functionResult@43 assembly/functionResult@43::@_instance + IL_000a: ret + } + + } + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_list() cil managed { From f54cbb96c9e0111e60d8a501edfbe917b25f382b Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 28 Jul 2023 18:07:26 +0200 Subject: [PATCH 12/12] now the right IL bsl updates --- .../Inlining/StructUnion01.fs.il.net472.bsl | 131 +------- .../Inlining/StructUnion01.fs.il.netcore.bsl | 286 +++++++++--------- 2 files changed, 151 insertions(+), 266 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl index c6d02a9df1f..6733894d53f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.net472.bsl @@ -70,32 +70,18 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: newobj instance void assembly/U::.ctor(int32, - int32) - IL_0007: ret - } - - .method assembly specialname rtspecialname - instance void .ctor(int32 item1, - int32 item2) cil managed - { - .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, - class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 53 74 72 75 63 74 55 6E 69 - 6F 6E 30 31 2B 55 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 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stfld int32 assembly/U::item1 - IL_0007: ldarg.0 - IL_0008: ldarg.2 - IL_0009: stfld int32 assembly/U::item2 - IL_000e: ret + .maxstack 3 + .locals init (valuetype assembly/U V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj assembly/U + IL_0008: ldloca.s V_0 + IL_000a: ldarg.0 + IL_000b: stfld int32 assembly/U::item1 + IL_0010: ldloca.s V_0 + IL_0012: ldarg.1 + IL_0013: stfld int32 assembly/U::item2 + IL_0018: ldloc.0 + IL_0019: ret } .method public hidebysig instance int32 @@ -723,99 +709,6 @@ } -.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes - extends [runtime]System.Enum -{ - .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 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 ) - .field public specialname rtspecialname int32 value__ - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) - .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) -} - -.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute - extends [runtime]System.Attribute -{ - .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ - .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 ) - .field private class [runtime]System.Type Type@ - .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 public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) 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 [runtime]System.Attribute::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ - IL_0014: ret - } - - .method public hidebysig specialname instance class [runtime]System.Type - get_Type() 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: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ - IL_0006: ret - } - - .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes - get_MemberType() 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: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ - IL_0006: ret - } - - .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes - MemberType() - { - .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 ) - .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() - } - .property instance class [runtime]System.Type - Type() - { - .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 ) - .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() - } -} - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl index bd99fcd158f..f9e8a68c5d8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/StructUnion01.fs.il.netcore.bsl @@ -9,31 +9,31 @@ { .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 ) - - + 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.exe .imagebase {value} .file alignment 0x00000200 .stackreserve 0x00100000 -.subsystem 0x0003 -.corflags 0x00000001 +.subsystem 0x0003 +.corflags 0x00000001 @@ -42,7 +42,7 @@ .class public abstract auto ansi sealed assembly 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 ) + .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 sequential autochar serializable sealed nested public beforefieldinit U extends [runtime]System.ValueType implements class [runtime]System.IEquatable`1, @@ -51,96 +51,82 @@ [runtime]System.IComparable, [runtime]System.Collections.IStructuralComparable { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C - 61 79 28 29 2C 6E 71 7D 00 00 ) - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.StructAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) .field assembly int32 item1 - .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 ) + .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 ) .field assembly int32 item2 - .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 public static valuetype assembly/U + .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 public static valuetype assembly/U NewU(int32 item1, int32 item2) cil managed { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: newobj instance void assembly/U::.ctor(int32, - int32) - IL_0007: ret - } - - .method assembly specialname rtspecialname - instance void .ctor(int32 item1, - int32 item2) cil managed - { - .custom instance void [runtime]System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype [runtime]System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, - class [runtime]System.Type) = ( 01 00 60 06 00 00 0F 53 74 72 75 63 74 55 6E 69 - 6F 6E 30 31 2B 55 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 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stfld int32 assembly/U::item1 - IL_0007: ldarg.0 - IL_0008: ldarg.2 - IL_0009: stfld int32 assembly/U::item2 - IL_000e: ret - } + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + + .maxstack 3 + .locals init (valuetype assembly/U V_0) + IL_0000: ldloca.s V_0 + IL_0002: initobj assembly/U + IL_0008: ldloca.s V_0 + IL_000a: ldarg.0 + IL_000b: stfld int32 assembly/U::item1 + IL_0010: ldloca.s V_0 + IL_0012: ldarg.1 + IL_0013: stfld int32 assembly/U::item2 + IL_0018: ldloc.0 + IL_0019: ret + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Item1() 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 ) - + .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: ldfld int32 assembly/U::item1 IL_0006: ret - } + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Item2() 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 ) - + .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: ldfld int32 assembly/U::item2 IL_0006: ret - } + } - .method public hidebysig instance int32 + .method public hidebysig instance int32 get_Tag() 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 ) - + .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: pop IL_0002: ldc.i4.0 IL_0003: ret - } + } - .method assembly hidebysig specialname + .method assembly hidebysig specialname instance object __DebugDisplay() 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 ) - + .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: ldstr "%+0.8A" IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) @@ -149,13 +135,13 @@ IL_0010: ldobj assembly/U IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_001a: ret - } + } - .method public strict virtual instance string + .method public strict virtual instance string ToString() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldstr "%+A" IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,valuetype assembly/U>::.ctor(string) @@ -164,13 +150,13 @@ IL_0010: ldobj assembly/U IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) IL_001a: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(valuetype assembly/U obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 5 .locals init (int32 V_0, class [runtime]System.Collections.IComparer V_1, @@ -224,27 +210,27 @@ IL_0048: clt IL_004a: sub IL_004b: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: unbox.any assembly/U IL_0007: call instance int32 assembly/U::CompareTo(valuetype assembly/U) IL_000c: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 5 .locals init (valuetype assembly/U V_0, int32 V_1, @@ -297,13 +283,13 @@ IL_0043: clt IL_0045: sub IL_0046: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 7 .locals init (int32 V_0) IL_0000: ldc.i4.0 @@ -340,26 +326,26 @@ IL_002f: stloc.0 IL_0030: ldloc.0 IL_0031: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance int32 GetHashCode() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() IL_0006: call instance int32 assembly/U::GetHashCode(class [runtime]System.Collections.IEqualityComparer) IL_000b: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 4 .locals init (valuetype assembly/U V_0) IL_0000: ldarg.1 @@ -389,13 +375,13 @@ IL_0032: ldc.i4.0 IL_0033: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(valuetype assembly/U obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.0 IL_0001: pop @@ -414,13 +400,13 @@ IL_0021: ldc.i4.0 IL_0022: ret - } + } - .method public hidebysig virtual final + .method public hidebysig virtual final instance bool Equals(object obj) cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .maxstack 8 IL_0000: ldarg.1 IL_0001: isinst assembly/U @@ -434,38 +420,38 @@ IL_0015: ldc.i4.0 IL_0016: ret - } + } .property instance int32 Tag() { - .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 ) - .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 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .get instance int32 assembly/U::get_Tag() - } + } .property instance int32 Item1() { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32, - int32) = ( 01 00 04 00 00 00 00 00 00 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 ) + int32) = ( 01 00 04 00 00 00 00 00 00 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 ) .get instance int32 assembly/U::get_Item1() - } + } .property instance int32 Item2() { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 01 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 ) + int32) = ( 01 00 04 00 00 00 00 00 00 00 01 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 ) .get instance int32 assembly/U::get_Item2() - } - } + } + } .method public static int32 g1(valuetype assembly/U _arg1) cil managed { - + .maxstack 8 IL_0000: ldarga.s _arg1 IL_0002: ldfld int32 assembly/U::item1 @@ -473,11 +459,11 @@ IL_0009: ldfld int32 assembly/U::item2 IL_000e: add IL_000f: ret - } + } .method public static int32 g2(valuetype assembly/U u) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarga.s u @@ -486,18 +472,18 @@ IL_000a: ldfld int32 assembly/U::item2 IL_000f: add IL_0010: ret - } + } .method public static int32 g3(valuetype assembly/U x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarga.s x IL_0003: ldfld int32 assembly/U::item1 IL_0008: ldc.i4.3 IL_0009: sub - IL_000a: switch ( + IL_000a: switch ( IL_0015) IL_0013: br.s IL_001d @@ -511,13 +497,13 @@ IL_0026: ldfld int32 assembly/U::item2 IL_002b: add IL_002c: ret - } + } .method public static int32 g4(valuetype assembly/U x, valuetype assembly/U y) 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 ) - + .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 6 .locals init (int32 V_0, int32 V_1, @@ -528,7 +514,7 @@ IL_0003: ldfld int32 assembly/U::item1 IL_0008: ldc.i4.3 IL_0009: sub - IL_000a: switch ( + IL_000a: switch ( IL_0015) IL_0013: br.s IL_0059 @@ -536,7 +522,7 @@ IL_0017: ldfld int32 assembly/U::item1 IL_001c: ldc.i4.5 IL_001d: sub - IL_001e: switch ( + IL_001e: switch ( IL_0049) IL_0027: ldarga.s y IL_0029: ldfld int32 assembly/U::item2 @@ -579,11 +565,11 @@ IL_007e: ldloc.0 IL_007f: add IL_0080: ret - } + } .method public static int32 f1(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 @@ -592,11 +578,11 @@ IL_0008: ldfld int32 assembly/U::item2 IL_000d: add IL_000e: ret - } + } .method public static int32 f2(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 @@ -605,18 +591,18 @@ IL_0008: ldfld int32 assembly/U::item2 IL_000d: add IL_000e: ret - } + } .method public static int32 f3(valuetype assembly/U& x) cil managed { - + .maxstack 8 IL_0000: nop IL_0001: ldarg.0 IL_0002: ldfld int32 assembly/U::item1 IL_0007: ldc.i4.3 IL_0008: sub - IL_0009: switch ( + IL_0009: switch ( IL_0014) IL_0012: br.s IL_001b @@ -630,13 +616,13 @@ IL_0022: ldfld int32 assembly/U::item2 IL_0027: add IL_0028: ret - } + } .method public static int32 f4(valuetype assembly/U& x, valuetype assembly/U& y) 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 ) - + .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 6 .locals init (valuetype assembly/U V_0, valuetype assembly/U V_1, @@ -655,7 +641,7 @@ IL_0011: ldfld int32 assembly/U::item1 IL_0016: ldc.i4.3 IL_0017: sub - IL_0018: switch ( + IL_0018: switch ( IL_0023) IL_0021: br.s IL_0069 @@ -663,7 +649,7 @@ IL_0025: ldfld int32 assembly/U::item1 IL_002a: ldc.i4.5 IL_002b: sub - IL_002c: switch ( + IL_002c: switch ( IL_0059) IL_0035: ldloca.s V_1 IL_0037: ldfld int32 assembly/U::item2 @@ -706,9 +692,9 @@ IL_0092: ldloc.2 IL_0093: add IL_0094: ret - } + } -} +} .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object @@ -716,9 +702,15 @@ .method public static void main@() cil managed { .entrypoint - + .maxstack 8 IL_0000: ret - } + } + +} + + + + + -}