From d3e5e17b3a2a547e9a10e332c4b58f8583c34271 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Wed, 26 Jun 2024 15:31:07 -0400 Subject: [PATCH 01/11] fixes snapshot creating too many fsharpoptions --- src/Compiler/Service/FSharpProjectSnapshot.fs | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index fbff9619b88..cf67ff37d15 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -560,7 +560,7 @@ and [] FSha referencedProjects: FSharpReferencedProjectSnapshot list, isIncompleteTypeCheckEnvironment: bool, useScriptResolutionRules: bool, - loadTime: DateTime, + loadTime: DateTime, unresolvedReferences: FSharpUnresolvedReferencesSet option, originalLoadReferences: (range * string * string) list, stamp: int64 option @@ -676,27 +676,32 @@ and [] FSha |> async.Return FSharpProjectSnapshot.FromOptions(options, getFileSnapshot) + +let internal snapshotTable = ConditionalWeakTable() + +let rec internal snapshotToOptions (projectSnapshot: ProjectSnapshot) = + snapshotTable.GetValue(projectSnapshot, fun projectSnapshot -> + { + ProjectFileName = projectSnapshot.ProjectFileName + ProjectId = projectSnapshot.ProjectId + SourceFiles = projectSnapshot.SourceFiles |> Seq.map (fun x -> x.FileName) |> Seq.toArray + OtherOptions = projectSnapshot.CommandLineOptions |> List.toArray + ReferencedProjects = + projectSnapshot.ReferencedProjects + |> Seq.map (function + | FSharpReference(name, opts) -> FSharpReferencedProject.FSharpReference(name, opts.ProjectSnapshot |> snapshotToOptions) + | PEReference(getStamp, reader) -> FSharpReferencedProject.PEReference(getStamp, reader) + | ILModuleReference(name, getStamp, getReader) -> FSharpReferencedProject.ILModuleReference(name, getStamp, getReader)) + |> Seq.toArray + IsIncompleteTypeCheckEnvironment = projectSnapshot.IsIncompleteTypeCheckEnvironment + UseScriptResolutionRules = projectSnapshot.UseScriptResolutionRules + LoadTime = projectSnapshot.LoadTime + UnresolvedReferences = projectSnapshot.UnresolvedReferences + OriginalLoadReferences = projectSnapshot.OriginalLoadReferences + Stamp = projectSnapshot.Stamp + } + ) -let rec internal snapshotToOptions (projectSnapshot: ProjectSnapshotBase<_>) = - { - ProjectFileName = projectSnapshot.ProjectFileName - ProjectId = projectSnapshot.ProjectId - SourceFiles = projectSnapshot.SourceFiles |> Seq.map (fun x -> x.FileName) |> Seq.toArray - OtherOptions = projectSnapshot.CommandLineOptions |> List.toArray - ReferencedProjects = - projectSnapshot.ReferencedProjects - |> Seq.map (function - | FSharpReference(name, opts) -> FSharpReferencedProject.FSharpReference(name, opts.ProjectSnapshot |> snapshotToOptions) - | PEReference(getStamp, reader) -> FSharpReferencedProject.PEReference(getStamp, reader) - | ILModuleReference(name, getStamp, getReader) -> FSharpReferencedProject.ILModuleReference(name, getStamp, getReader)) - |> Seq.toArray - IsIncompleteTypeCheckEnvironment = projectSnapshot.IsIncompleteTypeCheckEnvironment - UseScriptResolutionRules = projectSnapshot.UseScriptResolutionRules - LoadTime = projectSnapshot.LoadTime - UnresolvedReferences = projectSnapshot.UnresolvedReferences - OriginalLoadReferences = projectSnapshot.OriginalLoadReferences - Stamp = projectSnapshot.Stamp - } [] type internal Extensions = From 41dd131e18e93f9293a20770d31308476f522265 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Wed, 26 Jun 2024 15:32:38 -0400 Subject: [PATCH 02/11] Configurable cache sizes --- src/Compiler/Service/TransparentCompiler.fs | 147 ++++++++++++++----- src/Compiler/Service/TransparentCompiler.fsi | 44 +++++- 2 files changed, 153 insertions(+), 38 deletions(-) diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 5158ac7f25c..ea9f8ea682e 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -258,45 +258,119 @@ module private TypeCheckingGraphProcessing = return finalFileResults, state } - -type internal CompilerCaches(sizeFactor: int) = +type CacheSizes = { + ParseFileKeepStrongly: int + ParseFileKeepWeakly: int + ParseFileWithoutProjectKeepStrongly: int + ParseFileWithoutProjectKeepWeakly: int + ParseAndCheckFileInProjectKeepStrongly: int + ParseAndCheckFileInProjectKeepWeakly: int + ParseAndCheckAllFilesInProjectKeepStrongly: int + ParseAndCheckAllFilesInProjectKeepWeakly: int + ParseAndCheckProjectKeepStrongly: int + ParseAndCheckProjectKeepWeakly: int + FrameworkImportsKeepStrongly: int + FrameworkImportsKeepWeakly: int + BootstrapInfoStaticKeepStrongly: int + BootstrapInfoStaticKeepWeakly: int + BootstrapInfoKeepStrongly: int + BootstrapInfoKeepWeakly: int + TcLastFileKeepStrongly: int + TcLastFileKeepWeakly: int + TcIntermediateKeepStrongly: int + TcIntermediateKeepWeakly: int + DependencyGraphKeepStrongly: int + DependencyGraphKeepWeakly: int + ProjectExtrasKeepStrongly: int + ProjectExtrasKeepWeakly: int + AssemblyDataKeepStrongly: int + AssemblyDataKeepWeakly: int + SemanticClassificationKeepStrongly: int + SemanticClassificationKeepWeakly: int + ItemKeyStoreKeepStrongly: int + ItemKeyStoreKeepWeakly: int + ScriptClosureKeepStrongly: int + ScriptClosureKeepWeakly: int +} +with + static member Create sizeFactor = + + { + ParseFileKeepStrongly = 50 * sizeFactor + ParseFileKeepWeakly = 20 * sizeFactor + ParseFileWithoutProjectKeepStrongly = 5 * sizeFactor + ParseFileWithoutProjectKeepWeakly = 2 * sizeFactor + ParseAndCheckFileInProjectKeepStrongly = sizeFactor + ParseAndCheckFileInProjectKeepWeakly = 2 * sizeFactor + ParseAndCheckAllFilesInProjectKeepStrongly = sizeFactor + ParseAndCheckAllFilesInProjectKeepWeakly = 2 * sizeFactor + ParseAndCheckProjectKeepStrongly = sizeFactor + ParseAndCheckProjectKeepWeakly = 2 * sizeFactor + FrameworkImportsKeepStrongly = sizeFactor + FrameworkImportsKeepWeakly = 2 * sizeFactor + BootstrapInfoStaticKeepStrongly = sizeFactor + BootstrapInfoStaticKeepWeakly = 2 * sizeFactor + BootstrapInfoKeepStrongly = sizeFactor + BootstrapInfoKeepWeakly = 2 * sizeFactor + TcLastFileKeepStrongly = sizeFactor + TcLastFileKeepWeakly = 2 * sizeFactor + TcIntermediateKeepStrongly = 20 * sizeFactor + TcIntermediateKeepWeakly = 20 * sizeFactor + DependencyGraphKeepStrongly = sizeFactor + DependencyGraphKeepWeakly = 2 * sizeFactor + ProjectExtrasKeepStrongly = sizeFactor + ProjectExtrasKeepWeakly = 2 * sizeFactor + AssemblyDataKeepStrongly = sizeFactor + AssemblyDataKeepWeakly = 2 * sizeFactor + SemanticClassificationKeepStrongly = sizeFactor + SemanticClassificationKeepWeakly = 2 * sizeFactor + ItemKeyStoreKeepStrongly = sizeFactor + ItemKeyStoreKeepWeakly = 2 * sizeFactor + ScriptClosureKeepStrongly = sizeFactor + ScriptClosureKeepWeakly = 2 * sizeFactor + } + + static member Default = + let sizeFactor = 100 + CacheSizes.Create sizeFactor +type internal CompilerCaches(sizeFactor: CacheSizes) = let sf = sizeFactor - member _.SizeFactor = sf + member _.CacheSizes = sf - member val ParseFile = AsyncMemoize(keepStrongly = 50 * sf, keepWeakly = 20 * sf, name = "ParseFile") + member val ParseFile = AsyncMemoize(keepStrongly = sf.ParseFileKeepStrongly, keepWeakly = sf.ParseFileKeepWeakly, name = "ParseFile") member val ParseFileWithoutProject = - AsyncMemoize(keepStrongly = 5 * sf, keepWeakly = 2 * sf, name = "ParseFileWithoutProject") + AsyncMemoize(sf.ParseFileWithoutProjectKeepStrongly, keepWeakly = sf.ParseFileWithoutProjectKeepWeakly, name = "ParseFileWithoutProject") - member val ParseAndCheckFileInProject = AsyncMemoize(sf, 2 * sf, name = "ParseAndCheckFileInProject") + member val ParseAndCheckFileInProject = AsyncMemoize(sf.ParseAndCheckFileInProjectKeepStrongly, sf.ParseAndCheckFileInProjectKeepWeakly, name = "ParseAndCheckFileInProject") - member val ParseAndCheckAllFilesInProject = AsyncMemoizeDisabled(sf, 2 * sf, name = "ParseAndCheckFullProject") + member val ParseAndCheckAllFilesInProject = AsyncMemoizeDisabled(sf.ParseAndCheckAllFilesInProjectKeepStrongly, sf.ParseAndCheckAllFilesInProjectKeepWeakly, name = "ParseAndCheckFullProject") - member val ParseAndCheckProject = AsyncMemoize(sf, 2 * sf, name = "ParseAndCheckProject") + member val ParseAndCheckProject = AsyncMemoize(sf.ParseAndCheckProjectKeepStrongly, sf.ParseAndCheckProjectKeepWeakly, name = "ParseAndCheckProject") - member val FrameworkImports = AsyncMemoize(sf, 2 * sf, name = "FrameworkImports") + member val FrameworkImports = AsyncMemoize(sf.FrameworkImportsKeepStrongly, sf.FrameworkImportsKeepWeakly, name = "FrameworkImports") - member val BootstrapInfoStatic = AsyncMemoize(sf, 2 * sf, name = "BootstrapInfoStatic") + member val BootstrapInfoStatic = AsyncMemoize(sf.BootstrapInfoStaticKeepStrongly, sf.BootstrapInfoStaticKeepWeakly, name = "BootstrapInfoStatic") - member val BootstrapInfo = AsyncMemoize(sf, 2 * sf, name = "BootstrapInfo") + member val BootstrapInfo = AsyncMemoize(sf.BootstrapInfoKeepStrongly, sf.BootstrapInfoKeepWeakly, name = "BootstrapInfo") - member val TcLastFile = AsyncMemoizeDisabled(sf, 2 * sf, name = "TcLastFile") + member val TcLastFile = AsyncMemoizeDisabled(sf.TcLastFileKeepStrongly, sf.TcLastFileKeepWeakly, name = "TcLastFile") - member val TcIntermediate = AsyncMemoize(20 * sf, 20 * sf, name = "TcIntermediate") + member val TcIntermediate = AsyncMemoize(sf.TcIntermediateKeepStrongly, sf.TcIntermediateKeepWeakly, name = "TcIntermediate") - member val DependencyGraph = AsyncMemoize(sf, 2 * sf, name = "DependencyGraph") + member val DependencyGraph = AsyncMemoize(sf.DependencyGraphKeepStrongly, sf.DependencyGraphKeepWeakly, name = "DependencyGraph") - member val ProjectExtras = AsyncMemoizeDisabled(sf, 2 * sf, name = "ProjectExtras") + member val ProjectExtras = AsyncMemoizeDisabled(sf.ProjectExtrasKeepStrongly, sf.ProjectExtrasKeepWeakly, name = "ProjectExtras") - member val AssemblyData = AsyncMemoize(sf, 2 * sf, name = "AssemblyData") + member val AssemblyData = AsyncMemoize(sf.AssemblyDataKeepStrongly, sf.AssemblyDataKeepWeakly, name = "AssemblyData") - member val SemanticClassification = AsyncMemoize(sf, 2 * sf, name = "SemanticClassification") + member val SemanticClassification = AsyncMemoize(sf.SemanticClassificationKeepStrongly, sf.SemanticClassificationKeepWeakly, name = "SemanticClassification") - member val ItemKeyStore = AsyncMemoize(sf, 2 * sf, name = "ItemKeyStore") + member val ItemKeyStore = AsyncMemoize(sf.ItemKeyStoreKeepStrongly, sf.ItemKeyStoreKeepWeakly, name = "ItemKeyStore") - member val ScriptClosure = AsyncMemoize(sf, 2 * sf, name = "ScriptClosure") + member val ScriptClosure = AsyncMemoize(sf.ScriptClosureKeepStrongly, sf.ScriptClosureKeepWeakly, name = "ScriptClosure") member this.Clear(projects: Set) = let shouldClear project = projects |> Set.contains project @@ -326,7 +400,9 @@ type internal TransparentCompiler parallelReferenceResolution, captureIdentifiersWhenParsing, getSource: (string -> Async) option, - useChangeNotifications + useChangeNotifications, + useSyntaxTreeCache, + ?cacheSizes ) as self = let documentSource = @@ -336,9 +412,11 @@ type internal TransparentCompiler // Is having just one of these ok? let lexResourceManager = Lexhelp.LexResourceManager() + + let cacheSizes = defaultArg cacheSizes CacheSizes.Default // Mutable so we can easily clear them by creating a new instance - let mutable caches = CompilerCaches(100) + let mutable caches = CompilerCaches(cacheSizes) // TODO: do we need this? //let maxTypeCheckingParallelism = max 1 (Environment.ProcessorCount / 2) @@ -1371,8 +1449,8 @@ type internal TransparentCompiler node, (fun tcInfo -> - if tcInfo.stateContainsNodes |> Set.contains fileNode then - failwith $"Oops!" + // if tcInfo.stateContainsNodes |> Set.contains fileNode then + // failwith $"Oops!" //if // tcInfo.stateContainsNodes @@ -1417,14 +1495,8 @@ type internal TransparentCompiler fileNode, (fun tcInfo -> - if tcInfo.stateContainsNodes |> Set.contains fileNode then - failwith $"Oops!" - - // if - // tcInfo.stateContainsNodes - // |> Set.contains (NodeToTypeCheck.PhysicalFile(index + 1)) - // then - // failwith $"Oops!!!" + // if tcInfo.stateContainsNodes |> Set.contains fileNode then + // failwith $"Oops!" let parsedInput = projectSnapshot.SourceFiles[index].ParsedInput let prefixPathOpt = None @@ -1682,6 +1754,7 @@ type internal TransparentCompiler cacheKey.GetKey(), (fun (_fullVersion, fileContentVersion) -> fileContentVersion = (snd version)) ) + match parseFileResultsAndcheckFileAnswer with | Some(parseFileResults, FSharpCheckFileAnswer.Succeeded checkFileResults) -> Some(parseFileResults, checkFileResults) @@ -2089,9 +2162,13 @@ type internal TransparentCompiler member _.Caches = caches - member _.SetCacheSizeFactor(sizeFactor: int) = - if sizeFactor <> caches.SizeFactor then - caches <- CompilerCaches(sizeFactor) + member _.SetCacheSize(cacheSize : CacheSizes) = + if cacheSize <> caches.CacheSizes then + caches <- CompilerCaches(cacheSize) + + member x.SetCacheSizeFactor(sizeFactor : int) = + let newCacheSize = CacheSizes.Create sizeFactor + x.SetCacheSize newCacheSize interface IBackgroundCompiler with @@ -2153,7 +2230,7 @@ type internal TransparentCompiler member _.ClearCaches() : unit = backgroundCompiler.ClearCaches() - caches <- CompilerCaches(100) // TODO: check + caches <- CompilerCaches(cacheSizes) // TODO: check member _.DownsizeCaches() : unit = backgroundCompiler.DownsizeCaches() diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index 7746445c0af..b7646d7d3dc 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -97,9 +97,44 @@ type internal Extensions = fileSnapshots: #ProjectSnapshot.IFileSnapshot list * ?extraKeyFlag: DependencyGraphType -> ICacheKey<(DependencyGraphType option * byte array), string> +type CacheSizes = { + ParseFileKeepStrongly: int + ParseFileKeepWeakly: int + ParseFileWithoutProjectKeepStrongly: int + ParseFileWithoutProjectKeepWeakly: int + ParseAndCheckFileInProjectKeepStrongly: int + ParseAndCheckFileInProjectKeepWeakly: int + ParseAndCheckAllFilesInProjectKeepStrongly: int + ParseAndCheckAllFilesInProjectKeepWeakly: int + ParseAndCheckProjectKeepStrongly: int + ParseAndCheckProjectKeepWeakly: int + FrameworkImportsKeepStrongly: int + FrameworkImportsKeepWeakly: int + BootstrapInfoStaticKeepStrongly: int + BootstrapInfoStaticKeepWeakly: int + BootstrapInfoKeepStrongly: int + BootstrapInfoKeepWeakly: int + TcLastFileKeepStrongly: int + TcLastFileKeepWeakly: int + TcIntermediateKeepStrongly: int + TcIntermediateKeepWeakly: int + DependencyGraphKeepStrongly: int + DependencyGraphKeepWeakly: int + ProjectExtrasKeepStrongly: int + ProjectExtrasKeepWeakly: int + AssemblyDataKeepStrongly: int + AssemblyDataKeepWeakly: int + SemanticClassificationKeepStrongly: int + SemanticClassificationKeepWeakly: int + ItemKeyStoreKeepStrongly: int + ItemKeyStoreKeepWeakly: int + ScriptClosureKeepStrongly: int + ScriptClosureKeepWeakly: int +} + type internal CompilerCaches = - new: sizeFactor: int -> CompilerCaches + new: sizeFactor: CacheSizes -> CompilerCaches member AssemblyData: AsyncMemoize<(string * string), (string * string), ProjectAssemblyDataResult> @@ -131,7 +166,7 @@ type internal CompilerCaches = member SemanticClassification: AsyncMemoize<(string * (string * string)), string, SemanticClassificationView option> - member SizeFactor: int + member CacheSizes: CacheSizes member TcIntermediate: AsyncMemoize<(string * (string * string)), (string * int), TcIntermediate> @@ -155,7 +190,9 @@ type internal TransparentCompiler = parallelReferenceResolution: ParallelReferenceResolution * captureIdentifiersWhenParsing: bool * getSource: (string -> Async) option * - useChangeNotifications: bool -> + useChangeNotifications: bool * + useSyntaxTreeCache: bool * + ?cacheSizes: CacheSizes -> TransparentCompiler member FindReferencesInFile: @@ -174,6 +211,7 @@ type internal TransparentCompiler = fileName: string * projectSnapshot: ProjectSnapshot.ProjectSnapshot * _userOpName: 'a -> Async + member SetCacheSize: cacheSize: CacheSizes -> unit member SetCacheSizeFactor: sizeFactor: int -> unit member Caches: CompilerCaches From 419216fac4cb91ab178c5d3fcdfa6660c0f0a574 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Wed, 26 Jun 2024 15:32:53 -0400 Subject: [PATCH 03/11] let FSAC get at the internals --- src/Compiler/FSharp.Compiler.Service.fsproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index 419746af6c0..7e892f70ea5 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -100,6 +100,8 @@ + + From 7676fe7b9ff866624e85edc37159d598ab131f43 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Tue, 16 Jul 2024 09:44:25 -0400 Subject: [PATCH 04/11] mm --- .vscode/settings.json | 6 +- src/Compiler/Facilities/DiagnosticsLogger.fs | 26 ++++---- src/Compiler/Optimize/LowerStateMachines.fs | 66 +++++++++++++------ src/Compiler/Service/FSharpProjectSnapshot.fs | 5 +- 4 files changed, 67 insertions(+), 36 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3fa58d2fc5a..eda91bf507e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,7 @@ "FSharp.suggestGitignore": false, "FSharp.enableMSBuildProjectGraph": true, "FSharp.enableAdaptiveLspServer": true, - "FSharp.workspacePath": "FSharp.Compiler.Service.sln", + "FSharp.workspacePath": "./FSharp.Compiler.Service.sln", "FSharp.workspaceModePeekDeepLevel": 1, "FSharp.excludeProjectDirectories": [ ".git", @@ -53,5 +53,7 @@ } }, "editor.inlayHints.enabled": "offUnlessPressed", - "dotnet.defaultSolution": "FSharp.Compiler.Service.sln" + "dotnet.defaultSolution": "FSharp.Compiler.Service.sln", + "FSharp.fsac.netCoreDllPath": "C:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\FsAutoComplete\\src\\FsAutoComplete\\bin\\Release\\", + "FSharp.fcs.transparentCompiler.enabled": true } diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index 69d1f4fc306..ea0c5b37e01 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -875,17 +875,21 @@ type StackGuard(maxDepth: int, name: string) = [] path: string, [] line: int ) = - use _ = - Activity.start - "DiagnosticsLogger.StackGuard.Guard" - [| - Activity.Tags.stackGuardName, name - Activity.Tags.stackGuardCurrentDepth, string depth - Activity.Tags.stackGuardMaxDepth, string maxDepth - Activity.Tags.callerMemberName, memberName - Activity.Tags.callerFilePath, path - Activity.Tags.callerLineNumber, string line - |] + ignore memberName + ignore path + ignore line + + // use _ = + // Activity.start + // "DiagnosticsLogger.StackGuard.Guard" + // [| + // Activity.Tags.stackGuardName, name + // Activity.Tags.stackGuardCurrentDepth, string depth + // Activity.Tags.stackGuardMaxDepth, string maxDepth + // Activity.Tags.callerMemberName, memberName + // Activity.Tags.callerFilePath, path + // Activity.Tags.callerLineNumber, string line + // |] depth <- depth + 1 diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 7a6dd553f65..074d5456d22 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -38,11 +38,11 @@ type StateMachineConversionFirstPhaseResult = resumableVars: FreeVars } -#if DEBUG +// #if DEBUG let sm_verbose = try not (isNull(System.Environment.GetEnvironmentVariable "FSharp_StateMachineVerbose")) with _ -> false -#else -let sm_verbose = false -#endif +// #else +// let sm_verbose = true +// #endif let rec (|OptionalResumeAtExpr|) g expr = match stripDebugPoints expr with @@ -197,11 +197,12 @@ type LowerStateMachine(g: TcGlobals) = | _ -> (env, expr) - let rec TryReduceApp (env: env) expr (args: Expr list) = + let rec TryReduceApp (env: env) expr (args: Expr list) remake = if isNil args then None else match expr with | Expr.TyLambda _ | Expr.Lambda _ -> + if sm_verbose then printfn "Entering lambda\n%A" (DebugPrint.showExpr expr) let macroTypars, macroParamsCurried, macroBody, _rty = stripTopLambda (expr, tyOfExpr g expr) let m = macroBody.Range if not (isNil macroTypars) then @@ -221,9 +222,10 @@ type LowerStateMachine(g: TcGlobals) = Some expandedExpr else if sm_verbose then printfn "application was partial, reducing further args %A" laterArgs - TryReduceApp env expandedExpr laterArgs + TryReduceApp env expandedExpr laterArgs remake | NewDelegateExpr g (_, macroParams, macroBody, _, _) -> + if sm_verbose then printfn "Entering delegate\n%A" (DebugPrint.showExpr expr) let m = expr.Range let macroVal2 = mkLambdas g m [] macroParams (macroBody, tyOfExpr g macroBody) if args.Length < macroParams.Length then @@ -237,28 +239,33 @@ type LowerStateMachine(g: TcGlobals) = Some expandedExpr else if sm_verbose then printfn "application was partial, reducing further args %A" laterArgs - TryReduceApp env expandedExpr laterArgs + TryReduceApp env expandedExpr laterArgs remake | Expr.Let (bind, bodyExpr, m, _) -> - match TryReduceApp env bodyExpr args with + if sm_verbose then printfn "TryReduceApp Let\n%A" (DebugPrint.showExpr expr) + match TryReduceApp env bodyExpr args remake with | Some bodyExpr2 -> Some (mkLetBind m bind bodyExpr2) | None -> None | Expr.LetRec (binds, bodyExpr, m, _) -> - match TryReduceApp env bodyExpr args with + if sm_verbose then printfn "TryReduceApp LetRec\n%A" (DebugPrint.showExpr expr) + match TryReduceApp env bodyExpr args remake with | Some bodyExpr2 -> Some (mkLetRecBinds m binds bodyExpr2) | None -> None | Expr.Sequential (x1, bodyExpr, sp, m) -> - match TryReduceApp env bodyExpr args with + if sm_verbose then printfn "TryReduceApp Sequential\n%A" (DebugPrint.showExpr expr) + match TryReduceApp env bodyExpr args remake with | Some bodyExpr2 -> Some (Expr.Sequential (x1, bodyExpr2, sp, m)) | None -> None // This construct arises from the 'mkDefault' in the 'Throw' case of an incomplete pattern match | Expr.Const (Const.Zero, m, ty) -> + if sm_verbose then printfn "TryReduceApp Const\n%A" (DebugPrint.showExpr expr) Some (Expr.Const (Const.Zero, m, ty)) | Expr.Match (spBind, mExpr, dtree, targets, m, ty) -> + if sm_verbose then printfn "TryReduceApp Match\n%A" (DebugPrint.showExpr expr) let mutable newTyOpt = None let targets2 = targets |> Array.choose (fun (TTarget(vs, targetExpr, flags)) -> @@ -279,7 +286,7 @@ type LowerStateMachine(g: TcGlobals) = Some targetExpr2 | _ -> - match TryReduceApp env targetExpr args with + match TryReduceApp env targetExpr args remake with | Some targetExpr2 -> newTyOpt <- Some (tyOfExpr g targetExpr2) Some targetExpr2 @@ -294,30 +301,39 @@ type LowerStateMachine(g: TcGlobals) = None | WhileExpr (sp1, sp2, guardExpr, bodyExpr, m) -> - match TryReduceApp env bodyExpr args with + if sm_verbose then printfn "TryReduceApp While\n%A" (DebugPrint.showExpr expr) + match TryReduceApp env bodyExpr args remake with | Some bodyExpr2 -> Some (mkWhile g (sp1, sp2, guardExpr, bodyExpr2, m)) | None -> None | TryFinallyExpr (sp1, sp2, ty, bodyExpr, compensation, m) -> - match TryReduceApp env bodyExpr args with + if sm_verbose then printfn "TryReduceApp TryFinally\n%A" (DebugPrint.showExpr expr) + match TryReduceApp env bodyExpr args remake with | Some bodyExpr2 -> Some (mkTryFinally g (bodyExpr2, compensation, m, ty, sp1, sp2)) | None -> None | TryWithExpr (spTry, spWith, resTy, bodyExpr, filterVar, filterExpr, handlerVar, handlerExpr, m) -> - match TryReduceApp env bodyExpr args with + if sm_verbose then printfn "TryReduceApp TryWith\n%A" (DebugPrint.showExpr expr) + match TryReduceApp env bodyExpr args remake with | Some bodyExpr2 -> Some (mkTryWith g (bodyExpr2, filterVar, filterExpr, handlerVar, handlerExpr, m, resTy, spTry, spWith)) | None -> None | Expr.DebugPoint (dp, innerExpr) -> - match TryReduceApp env innerExpr args with + if sm_verbose then printfn "TryReduceApp DebugPoint\n%A" (DebugPrint.showExpr expr) + match TryReduceApp env innerExpr args remake with | Some innerExpr2 -> Some (Expr.DebugPoint (dp, innerExpr2)) | None -> None + + // | Expr.App _ -> + // if sm_verbose then printfn "TryReduceApp App\n%A" (DebugPrint.showExpr expr) + // TryReduceExpr env expr args remake - | _ -> + | otherwise -> + if sm_verbose then printfn "failed TryReduceApp\n%A\n%A" (DebugPrint.showExpr otherwise) otherwise None // Apply a single expansion of resumable code at the outermost position in an arbitrary expression - let rec TryReduceExpr (env: env) expr args remake = + and TryReduceExpr (env: env) expr args remake = if sm_verbose then printfn "expanding defns and reducing %A..." expr //if sm_verbose then printfn "checking %A for possible resumable code application..." expr match expr with @@ -326,11 +342,12 @@ type LowerStateMachine(g: TcGlobals) = let defn = env.ResumableCodeDefns[defnRef.Deref] if sm_verbose then printfn "found resumable code %A --> %A" defnRef defn // Expand the resumable code definition - match TryReduceApp env defn args with + match TryReduceApp env defn args remake with | Some expandedExpr -> if sm_verbose then printfn "expanded resumable code %A --> %A..." defnRef expandedExpr Some expandedExpr | None -> + if sm_verbose then printfn "failed to expand resumable code %A" defnRef Some (remake defn) // defn.Invoke x --> let arg = x in [defn][arg/x] @@ -345,11 +362,12 @@ type LowerStateMachine(g: TcGlobals) = | _ -> //let (env, expr) = BindResumableCodeDefinitions env expr - match TryReduceApp env expr args with + match TryReduceApp env expr args remake with | Some expandedExpr -> if sm_verbose then printfn "reduction = %A, args = %A --> %A..." expr args expandedExpr Some expandedExpr | None -> + if sm_verbose then printfn "failed to reduce %A" (DebugPrint.showExpr expr) None // Repeated top-down rewrite @@ -448,7 +466,8 @@ type LowerStateMachine(g: TcGlobals) = let res = match expr with | ResumableCodeInvoke g (_, _, _, m, _) -> - Result.Error (FSComp.SR.reprResumableCodeInvokeNotReduced(!!m.ToString())) + if sm_verbose then printfn "found delegate invoke in top-level resumable code" + Result.Error (FSComp.SR.reprResumableCodeInvokeNotReduced(m.ToString())) // Eliminate 'if __useResumableCode ...' within. | IfUseResumableStateMachinesExpr g (thenExpr, _) -> @@ -866,6 +885,9 @@ type LowerStateMachine(g: TcGlobals) = if frees |> Zset.exists (isExpandVar g) then let nonfree = frees |> Zset.elements |> List.filter (isExpandVar g) |> List.map (fun v -> v.DisplayName) |> String.concat "," let msg = FSComp.SR.reprResumableCodeValueHasNoDefinition(nonfree) + + if sm_verbose then + printfn "Resumable code value has no definition: %s" msg fallback msg else let pcExprROpt = pcExprOpt |> Option.map (ConvertStateMachineLeafExpression env) @@ -886,6 +908,7 @@ type LowerStateMachine(g: TcGlobals) = let phase1 = ConvertResumableCode env pcValInfo codeExprR match phase1 with | Result.Error msg -> + if sm_verbose then printfn "Phase1 failed : %s :\n%s" msg (DebugPrint.showExpr codeExprR) fallback msg | Result.Ok phase1 -> @@ -914,8 +937,9 @@ type LowerStateMachine(g: TcGlobals) = let res = remake (moveNextExprWithJumpTable, phase1.stateVars, phase1.thisVars) LoweredStateMachineResult.Lowered res - | _ -> + | other -> let msg = FSComp.SR.reprStateMachineInvalidForm() + if sm_verbose then printfn "Not a state machine expr: \n %s" (DebugPrint.showExpr other) fallback msg let LowerStateMachineExpr g (overallExpr: Expr) : LoweredStateMachineResult = diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index cf67ff37d15..c73228b29f3 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -560,7 +560,7 @@ and [] FSha referencedProjects: FSharpReferencedProjectSnapshot list, isIncompleteTypeCheckEnvironment: bool, useScriptResolutionRules: bool, - loadTime: DateTime, + loadTime: DateTime, unresolvedReferences: FSharpUnresolvedReferencesSet option, originalLoadReferences: (range * string * string) list, stamp: int64 option @@ -707,7 +707,8 @@ let rec internal snapshotToOptions (projectSnapshot: ProjectSnapshot) = type internal Extensions = [] - static member ToOptions(this: ProjectSnapshot) = this |> snapshotToOptions + static member ToOptions(this: ProjectSnapshot) = + this |> snapshotToOptions [] static member ToOptions(this: FSharpProjectSnapshot) = From c7949a8ebe88c8d404cad3817f65218b4a0052fc Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 8 Dec 2024 13:59:14 -0500 Subject: [PATCH 05/11] Remove internalsvisibleto --- src/Compiler/FSharp.Compiler.Service.fsproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index 0f196a64359..b345d6ed1ca 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -100,8 +100,6 @@ - - From 15be2164f5360abc3318253589b85c2e28b01c77 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 8 Dec 2024 13:59:26 -0500 Subject: [PATCH 06/11] Allow CacheSizes to be set --- src/Compiler/Service/TransparentCompiler.fs | 2 +- src/Compiler/Service/TransparentCompiler.fsi | 72 ++++++++++---------- src/Compiler/Service/service.fs | 12 ++-- src/Compiler/Service/service.fsi | 5 +- 4 files changed, 50 insertions(+), 41 deletions(-) diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 483eb84dfe6..f0d9d76c4c6 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -258,6 +258,7 @@ module private TypeCheckingGraphProcessing = return finalFileResults, state } + type CacheSizes = { ParseFileKeepStrongly: int ParseFileKeepWeakly: int @@ -401,7 +402,6 @@ type internal TransparentCompiler captureIdentifiersWhenParsing, getSource: (string -> Async) option, useChangeNotifications, - useSyntaxTreeCache, ?cacheSizes ) as self = diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index 621b44426a2..7c156273b9c 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -98,40 +98,43 @@ type internal Extensions = fileSnapshots: #ProjectSnapshot.IFileSnapshot list * ?extraKeyFlag: DependencyGraphType -> ICacheKey<(DependencyGraphType option * byte array), string> -type CacheSizes = { - ParseFileKeepStrongly: int - ParseFileKeepWeakly: int - ParseFileWithoutProjectKeepStrongly: int - ParseFileWithoutProjectKeepWeakly: int - ParseAndCheckFileInProjectKeepStrongly: int - ParseAndCheckFileInProjectKeepWeakly: int - ParseAndCheckAllFilesInProjectKeepStrongly: int - ParseAndCheckAllFilesInProjectKeepWeakly: int - ParseAndCheckProjectKeepStrongly: int - ParseAndCheckProjectKeepWeakly: int - FrameworkImportsKeepStrongly: int - FrameworkImportsKeepWeakly: int - BootstrapInfoStaticKeepStrongly: int - BootstrapInfoStaticKeepWeakly: int - BootstrapInfoKeepStrongly: int - BootstrapInfoKeepWeakly: int - TcLastFileKeepStrongly: int - TcLastFileKeepWeakly: int - TcIntermediateKeepStrongly: int - TcIntermediateKeepWeakly: int - DependencyGraphKeepStrongly: int - DependencyGraphKeepWeakly: int - ProjectExtrasKeepStrongly: int - ProjectExtrasKeepWeakly: int - AssemblyDataKeepStrongly: int - AssemblyDataKeepWeakly: int - SemanticClassificationKeepStrongly: int - SemanticClassificationKeepWeakly: int - ItemKeyStoreKeepStrongly: int - ItemKeyStoreKeepWeakly: int - ScriptClosureKeepStrongly: int - ScriptClosureKeepWeakly: int -} +[] +type CacheSizes = + { + ParseFileKeepStrongly: int + ParseFileKeepWeakly: int + ParseFileWithoutProjectKeepStrongly: int + ParseFileWithoutProjectKeepWeakly: int + ParseAndCheckFileInProjectKeepStrongly: int + ParseAndCheckFileInProjectKeepWeakly: int + ParseAndCheckAllFilesInProjectKeepStrongly: int + ParseAndCheckAllFilesInProjectKeepWeakly: int + ParseAndCheckProjectKeepStrongly: int + ParseAndCheckProjectKeepWeakly: int + FrameworkImportsKeepStrongly: int + FrameworkImportsKeepWeakly: int + BootstrapInfoStaticKeepStrongly: int + BootstrapInfoStaticKeepWeakly: int + BootstrapInfoKeepStrongly: int + BootstrapInfoKeepWeakly: int + TcLastFileKeepStrongly: int + TcLastFileKeepWeakly: int + TcIntermediateKeepStrongly: int + TcIntermediateKeepWeakly: int + DependencyGraphKeepStrongly: int + DependencyGraphKeepWeakly: int + ProjectExtrasKeepStrongly: int + ProjectExtrasKeepWeakly: int + AssemblyDataKeepStrongly: int + AssemblyDataKeepWeakly: int + SemanticClassificationKeepStrongly: int + SemanticClassificationKeepWeakly: int + ItemKeyStoreKeepStrongly: int + ItemKeyStoreKeepWeakly: int + ScriptClosureKeepStrongly: int + ScriptClosureKeepWeakly: int + } + static member Create: sizeFactor: int -> CacheSizes type internal CompilerCaches = @@ -194,7 +197,6 @@ type internal TransparentCompiler = captureIdentifiersWhenParsing: bool * getSource: (string -> Async) option * useChangeNotifications: bool * - useSyntaxTreeCache: bool * ?cacheSizes: CacheSizes -> TransparentCompiler diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 3e42e03223c..4da328508fb 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -117,7 +117,8 @@ type FSharpChecker captureIdentifiersWhenParsing, getSource, useChangeNotifications, - useTransparentCompiler + useTransparentCompiler, + ?transparentCompilerCacheSizes ) = let backgroundCompiler = @@ -135,7 +136,8 @@ type FSharpChecker parallelReferenceResolution, captureIdentifiersWhenParsing, getSource, - useChangeNotifications + useChangeNotifications, + ?cacheSizes= transparentCompilerCacheSizes ) :> IBackgroundCompiler else @@ -198,7 +200,8 @@ type FSharpChecker ?parallelReferenceResolution: bool, ?captureIdentifiersWhenParsing: bool, ?documentSource: DocumentSource, - ?useTransparentCompiler: bool + ?useTransparentCompiler: bool, + ?transparentCompilerCacheSizes : CacheSizes ) = use _ = Activity.startNoTags "FSharpChecker.Create" @@ -247,7 +250,8 @@ type FSharpChecker | Some(DocumentSource.Custom f) -> Some f | _ -> None), useChangeNotifications, - useTransparentCompiler + useTransparentCompiler, + ?transparentCompilerCacheSizes = transparentCompilerCacheSizes ) member _.UsesTransparentCompiler = useTransparentCompiler = Some true diff --git a/src/Compiler/Service/service.fsi b/src/Compiler/Service/service.fsi index 3e4fde2229c..58c4a8c1dfb 100644 --- a/src/Compiler/Service/service.fsi +++ b/src/Compiler/Service/service.fsi @@ -39,6 +39,7 @@ type public FSharpChecker = /// When set to true we create a set of all identifiers for each parsed file which can be used to speed up finding references. /// Default: FileSystem. You can use Custom source to provide a function that will return the source for a given file path instead of reading it from the file system. Note that with this option the FSharpChecker will also not monitor the file system for file changes. It will expect to be notified of changes via the NotifyFileChanged method. /// Default: false. Indicates whether we use a new experimental background compiler. This does not yet support all features + /// Default: None. The cache sizes for the transparent compiler static member Create: ?projectCacheSize: int * ?keepAssemblyContents: bool * @@ -54,7 +55,9 @@ type public FSharpChecker = [] ?documentSource: DocumentSource * [] ?useTransparentCompiler: - bool -> + bool * + [] ?transparentCompilerCacheSizes: + CacheSizes -> FSharpChecker [] From 74162b1729602f7f2bbf38d6eb48824defe14690 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 8 Dec 2024 14:08:05 -0500 Subject: [PATCH 07/11] Revert testing files --- .vscode/settings.json | 6 +- src/Compiler/Facilities/DiagnosticsLogger.fs | 26 ++++---- src/Compiler/Optimize/LowerStateMachines.fs | 66 +++++++------------- src/Compiler/Service/TransparentCompiler.fs | 1 - 4 files changed, 34 insertions(+), 65 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index eda91bf507e..3fa58d2fc5a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,7 @@ "FSharp.suggestGitignore": false, "FSharp.enableMSBuildProjectGraph": true, "FSharp.enableAdaptiveLspServer": true, - "FSharp.workspacePath": "./FSharp.Compiler.Service.sln", + "FSharp.workspacePath": "FSharp.Compiler.Service.sln", "FSharp.workspaceModePeekDeepLevel": 1, "FSharp.excludeProjectDirectories": [ ".git", @@ -53,7 +53,5 @@ } }, "editor.inlayHints.enabled": "offUnlessPressed", - "dotnet.defaultSolution": "FSharp.Compiler.Service.sln", - "FSharp.fsac.netCoreDllPath": "C:\\Users\\jimmy\\Repositories\\public\\TheAngryByrd\\FsAutoComplete\\src\\FsAutoComplete\\bin\\Release\\", - "FSharp.fcs.transparentCompiler.enabled": true + "dotnet.defaultSolution": "FSharp.Compiler.Service.sln" } diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index ea0c5b37e01..69d1f4fc306 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -875,21 +875,17 @@ type StackGuard(maxDepth: int, name: string) = [] path: string, [] line: int ) = - ignore memberName - ignore path - ignore line - - // use _ = - // Activity.start - // "DiagnosticsLogger.StackGuard.Guard" - // [| - // Activity.Tags.stackGuardName, name - // Activity.Tags.stackGuardCurrentDepth, string depth - // Activity.Tags.stackGuardMaxDepth, string maxDepth - // Activity.Tags.callerMemberName, memberName - // Activity.Tags.callerFilePath, path - // Activity.Tags.callerLineNumber, string line - // |] + use _ = + Activity.start + "DiagnosticsLogger.StackGuard.Guard" + [| + Activity.Tags.stackGuardName, name + Activity.Tags.stackGuardCurrentDepth, string depth + Activity.Tags.stackGuardMaxDepth, string maxDepth + Activity.Tags.callerMemberName, memberName + Activity.Tags.callerFilePath, path + Activity.Tags.callerLineNumber, string line + |] depth <- depth + 1 diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index 074d5456d22..7a6dd553f65 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -38,11 +38,11 @@ type StateMachineConversionFirstPhaseResult = resumableVars: FreeVars } -// #if DEBUG +#if DEBUG let sm_verbose = try not (isNull(System.Environment.GetEnvironmentVariable "FSharp_StateMachineVerbose")) with _ -> false -// #else -// let sm_verbose = true -// #endif +#else +let sm_verbose = false +#endif let rec (|OptionalResumeAtExpr|) g expr = match stripDebugPoints expr with @@ -197,12 +197,11 @@ type LowerStateMachine(g: TcGlobals) = | _ -> (env, expr) - let rec TryReduceApp (env: env) expr (args: Expr list) remake = + let rec TryReduceApp (env: env) expr (args: Expr list) = if isNil args then None else match expr with | Expr.TyLambda _ | Expr.Lambda _ -> - if sm_verbose then printfn "Entering lambda\n%A" (DebugPrint.showExpr expr) let macroTypars, macroParamsCurried, macroBody, _rty = stripTopLambda (expr, tyOfExpr g expr) let m = macroBody.Range if not (isNil macroTypars) then @@ -222,10 +221,9 @@ type LowerStateMachine(g: TcGlobals) = Some expandedExpr else if sm_verbose then printfn "application was partial, reducing further args %A" laterArgs - TryReduceApp env expandedExpr laterArgs remake + TryReduceApp env expandedExpr laterArgs | NewDelegateExpr g (_, macroParams, macroBody, _, _) -> - if sm_verbose then printfn "Entering delegate\n%A" (DebugPrint.showExpr expr) let m = expr.Range let macroVal2 = mkLambdas g m [] macroParams (macroBody, tyOfExpr g macroBody) if args.Length < macroParams.Length then @@ -239,33 +237,28 @@ type LowerStateMachine(g: TcGlobals) = Some expandedExpr else if sm_verbose then printfn "application was partial, reducing further args %A" laterArgs - TryReduceApp env expandedExpr laterArgs remake + TryReduceApp env expandedExpr laterArgs | Expr.Let (bind, bodyExpr, m, _) -> - if sm_verbose then printfn "TryReduceApp Let\n%A" (DebugPrint.showExpr expr) - match TryReduceApp env bodyExpr args remake with + match TryReduceApp env bodyExpr args with | Some bodyExpr2 -> Some (mkLetBind m bind bodyExpr2) | None -> None | Expr.LetRec (binds, bodyExpr, m, _) -> - if sm_verbose then printfn "TryReduceApp LetRec\n%A" (DebugPrint.showExpr expr) - match TryReduceApp env bodyExpr args remake with + match TryReduceApp env bodyExpr args with | Some bodyExpr2 -> Some (mkLetRecBinds m binds bodyExpr2) | None -> None | Expr.Sequential (x1, bodyExpr, sp, m) -> - if sm_verbose then printfn "TryReduceApp Sequential\n%A" (DebugPrint.showExpr expr) - match TryReduceApp env bodyExpr args remake with + match TryReduceApp env bodyExpr args with | Some bodyExpr2 -> Some (Expr.Sequential (x1, bodyExpr2, sp, m)) | None -> None // This construct arises from the 'mkDefault' in the 'Throw' case of an incomplete pattern match | Expr.Const (Const.Zero, m, ty) -> - if sm_verbose then printfn "TryReduceApp Const\n%A" (DebugPrint.showExpr expr) Some (Expr.Const (Const.Zero, m, ty)) | Expr.Match (spBind, mExpr, dtree, targets, m, ty) -> - if sm_verbose then printfn "TryReduceApp Match\n%A" (DebugPrint.showExpr expr) let mutable newTyOpt = None let targets2 = targets |> Array.choose (fun (TTarget(vs, targetExpr, flags)) -> @@ -286,7 +279,7 @@ type LowerStateMachine(g: TcGlobals) = Some targetExpr2 | _ -> - match TryReduceApp env targetExpr args remake with + match TryReduceApp env targetExpr args with | Some targetExpr2 -> newTyOpt <- Some (tyOfExpr g targetExpr2) Some targetExpr2 @@ -301,39 +294,30 @@ type LowerStateMachine(g: TcGlobals) = None | WhileExpr (sp1, sp2, guardExpr, bodyExpr, m) -> - if sm_verbose then printfn "TryReduceApp While\n%A" (DebugPrint.showExpr expr) - match TryReduceApp env bodyExpr args remake with + match TryReduceApp env bodyExpr args with | Some bodyExpr2 -> Some (mkWhile g (sp1, sp2, guardExpr, bodyExpr2, m)) | None -> None | TryFinallyExpr (sp1, sp2, ty, bodyExpr, compensation, m) -> - if sm_verbose then printfn "TryReduceApp TryFinally\n%A" (DebugPrint.showExpr expr) - match TryReduceApp env bodyExpr args remake with + match TryReduceApp env bodyExpr args with | Some bodyExpr2 -> Some (mkTryFinally g (bodyExpr2, compensation, m, ty, sp1, sp2)) | None -> None | TryWithExpr (spTry, spWith, resTy, bodyExpr, filterVar, filterExpr, handlerVar, handlerExpr, m) -> - if sm_verbose then printfn "TryReduceApp TryWith\n%A" (DebugPrint.showExpr expr) - match TryReduceApp env bodyExpr args remake with + match TryReduceApp env bodyExpr args with | Some bodyExpr2 -> Some (mkTryWith g (bodyExpr2, filterVar, filterExpr, handlerVar, handlerExpr, m, resTy, spTry, spWith)) | None -> None | Expr.DebugPoint (dp, innerExpr) -> - if sm_verbose then printfn "TryReduceApp DebugPoint\n%A" (DebugPrint.showExpr expr) - match TryReduceApp env innerExpr args remake with + match TryReduceApp env innerExpr args with | Some innerExpr2 -> Some (Expr.DebugPoint (dp, innerExpr2)) | None -> None - - // | Expr.App _ -> - // if sm_verbose then printfn "TryReduceApp App\n%A" (DebugPrint.showExpr expr) - // TryReduceExpr env expr args remake - | otherwise -> - if sm_verbose then printfn "failed TryReduceApp\n%A\n%A" (DebugPrint.showExpr otherwise) otherwise + | _ -> None // Apply a single expansion of resumable code at the outermost position in an arbitrary expression - and TryReduceExpr (env: env) expr args remake = + let rec TryReduceExpr (env: env) expr args remake = if sm_verbose then printfn "expanding defns and reducing %A..." expr //if sm_verbose then printfn "checking %A for possible resumable code application..." expr match expr with @@ -342,12 +326,11 @@ type LowerStateMachine(g: TcGlobals) = let defn = env.ResumableCodeDefns[defnRef.Deref] if sm_verbose then printfn "found resumable code %A --> %A" defnRef defn // Expand the resumable code definition - match TryReduceApp env defn args remake with + match TryReduceApp env defn args with | Some expandedExpr -> if sm_verbose then printfn "expanded resumable code %A --> %A..." defnRef expandedExpr Some expandedExpr | None -> - if sm_verbose then printfn "failed to expand resumable code %A" defnRef Some (remake defn) // defn.Invoke x --> let arg = x in [defn][arg/x] @@ -362,12 +345,11 @@ type LowerStateMachine(g: TcGlobals) = | _ -> //let (env, expr) = BindResumableCodeDefinitions env expr - match TryReduceApp env expr args remake with + match TryReduceApp env expr args with | Some expandedExpr -> if sm_verbose then printfn "reduction = %A, args = %A --> %A..." expr args expandedExpr Some expandedExpr | None -> - if sm_verbose then printfn "failed to reduce %A" (DebugPrint.showExpr expr) None // Repeated top-down rewrite @@ -466,8 +448,7 @@ type LowerStateMachine(g: TcGlobals) = let res = match expr with | ResumableCodeInvoke g (_, _, _, m, _) -> - if sm_verbose then printfn "found delegate invoke in top-level resumable code" - Result.Error (FSComp.SR.reprResumableCodeInvokeNotReduced(m.ToString())) + Result.Error (FSComp.SR.reprResumableCodeInvokeNotReduced(!!m.ToString())) // Eliminate 'if __useResumableCode ...' within. | IfUseResumableStateMachinesExpr g (thenExpr, _) -> @@ -885,9 +866,6 @@ type LowerStateMachine(g: TcGlobals) = if frees |> Zset.exists (isExpandVar g) then let nonfree = frees |> Zset.elements |> List.filter (isExpandVar g) |> List.map (fun v -> v.DisplayName) |> String.concat "," let msg = FSComp.SR.reprResumableCodeValueHasNoDefinition(nonfree) - - if sm_verbose then - printfn "Resumable code value has no definition: %s" msg fallback msg else let pcExprROpt = pcExprOpt |> Option.map (ConvertStateMachineLeafExpression env) @@ -908,7 +886,6 @@ type LowerStateMachine(g: TcGlobals) = let phase1 = ConvertResumableCode env pcValInfo codeExprR match phase1 with | Result.Error msg -> - if sm_verbose then printfn "Phase1 failed : %s :\n%s" msg (DebugPrint.showExpr codeExprR) fallback msg | Result.Ok phase1 -> @@ -937,9 +914,8 @@ type LowerStateMachine(g: TcGlobals) = let res = remake (moveNextExprWithJumpTable, phase1.stateVars, phase1.thisVars) LoweredStateMachineResult.Lowered res - | other -> + | _ -> let msg = FSComp.SR.reprStateMachineInvalidForm() - if sm_verbose then printfn "Not a state machine expr: \n %s" (DebugPrint.showExpr other) fallback msg let LowerStateMachineExpr g (overallExpr: Expr) : LoweredStateMachineResult = diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index f0d9d76c4c6..63d4e7ce7de 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -1754,7 +1754,6 @@ type internal TransparentCompiler cacheKey.GetKey(), (fun (_fullVersion, fileContentVersion) -> fileContentVersion = (snd version)) ) - match parseFileResultsAndcheckFileAnswer with | Some(parseFileResults, FSharpCheckFileAnswer.Succeeded checkFileResults) -> Some(parseFileResults, checkFileResults) From cabf9bd1857f9c9e4c33165e4cdcc19e650014ee Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 8 Dec 2024 14:13:46 -0500 Subject: [PATCH 08/11] Add release note --- docs/release-notes/.FSharp.Compiler.Service/9.0.200.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md index 66889c7ce39..ec5af5edf10 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md @@ -15,6 +15,7 @@ * Fix locals allocating for the special `copyOfStruct` defensive copy ([PR #18025](https://github.com/dotnet/fsharp/pull/18025)) * Fix lowering of computed array expressions when the expression consists of a simple mapping from a `uint64` or `unativeint` array. [PR #18081](https://github.com/dotnet/fsharp/pull/18081) * Add missing nullable-metadata for C# consumers of records,exceptions and DU subtypes generated from F# code. [PR #18079](https://github.com/dotnet/fsharp/pull/18079) +* Reduce excess memory usage in TransparentCompiler. [PR #17543](https://github.com/dotnet/fsharp/pull/17543) ### Added From 344e376501bababd1ba2080ccf4a89a2592bcecb Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 8 Dec 2024 14:16:56 -0500 Subject: [PATCH 09/11] Formatting --- src/Compiler/Service/FSharpProjectSnapshot.fs | 53 ++++---- src/Compiler/Service/TransparentCompiler.fs | 125 ++++++++++-------- src/Compiler/Service/TransparentCompiler.fsi | 69 +++++----- src/Compiler/Service/service.fs | 4 +- 4 files changed, 136 insertions(+), 115 deletions(-) diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index 41079ccf6d7..030d070a375 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -746,39 +746,42 @@ and [] FSha |> async.Return FSharpProjectSnapshot.FromOptions(options, getFileSnapshot) - -let internal snapshotTable = ConditionalWeakTable() + +let internal snapshotTable = + ConditionalWeakTable() let rec internal snapshotToOptions (projectSnapshot: ProjectSnapshot) = - snapshotTable.GetValue(projectSnapshot, fun projectSnapshot -> - { - ProjectFileName = projectSnapshot.ProjectFileName - ProjectId = projectSnapshot.ProjectId - SourceFiles = projectSnapshot.SourceFiles |> Seq.map (fun x -> x.FileName) |> Seq.toArray - OtherOptions = projectSnapshot.CommandLineOptions |> List.toArray - ReferencedProjects = - projectSnapshot.ReferencedProjects - |> Seq.map (function - | FSharpReference(name, opts) -> FSharpReferencedProject.FSharpReference(name, opts.ProjectSnapshot |> snapshotToOptions) - | PEReference(getStamp, reader) -> FSharpReferencedProject.PEReference(getStamp, reader) - | ILModuleReference(name, getStamp, getReader) -> FSharpReferencedProject.ILModuleReference(name, getStamp, getReader)) - |> Seq.toArray - IsIncompleteTypeCheckEnvironment = projectSnapshot.IsIncompleteTypeCheckEnvironment - UseScriptResolutionRules = projectSnapshot.UseScriptResolutionRules - LoadTime = projectSnapshot.LoadTime - UnresolvedReferences = projectSnapshot.UnresolvedReferences - OriginalLoadReferences = projectSnapshot.OriginalLoadReferences - Stamp = projectSnapshot.Stamp - } + snapshotTable.GetValue( + projectSnapshot, + fun projectSnapshot -> + { + ProjectFileName = projectSnapshot.ProjectFileName + ProjectId = projectSnapshot.ProjectId + SourceFiles = projectSnapshot.SourceFiles |> Seq.map (fun x -> x.FileName) |> Seq.toArray + OtherOptions = projectSnapshot.CommandLineOptions |> List.toArray + ReferencedProjects = + projectSnapshot.ReferencedProjects + |> Seq.map (function + | FSharpReference(name, opts) -> + FSharpReferencedProject.FSharpReference(name, opts.ProjectSnapshot |> snapshotToOptions) + | PEReference(getStamp, reader) -> FSharpReferencedProject.PEReference(getStamp, reader) + | ILModuleReference(name, getStamp, getReader) -> + FSharpReferencedProject.ILModuleReference(name, getStamp, getReader)) + |> Seq.toArray + IsIncompleteTypeCheckEnvironment = projectSnapshot.IsIncompleteTypeCheckEnvironment + UseScriptResolutionRules = projectSnapshot.UseScriptResolutionRules + LoadTime = projectSnapshot.LoadTime + UnresolvedReferences = projectSnapshot.UnresolvedReferences + OriginalLoadReferences = projectSnapshot.OriginalLoadReferences + Stamp = projectSnapshot.Stamp + } ) - [] type internal Extensions = [] - static member ToOptions(this: ProjectSnapshot) = - this |> snapshotToOptions + static member ToOptions(this: ProjectSnapshot) = this |> snapshotToOptions [] static member ToOptions(this: FSharpProjectSnapshot) = diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 63d4e7ce7de..f4d4f5d7c70 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -258,44 +258,45 @@ module private TypeCheckingGraphProcessing = return finalFileResults, state } - -type CacheSizes = { - ParseFileKeepStrongly: int - ParseFileKeepWeakly: int - ParseFileWithoutProjectKeepStrongly: int - ParseFileWithoutProjectKeepWeakly: int - ParseAndCheckFileInProjectKeepStrongly: int - ParseAndCheckFileInProjectKeepWeakly: int - ParseAndCheckAllFilesInProjectKeepStrongly: int - ParseAndCheckAllFilesInProjectKeepWeakly: int - ParseAndCheckProjectKeepStrongly: int - ParseAndCheckProjectKeepWeakly: int - FrameworkImportsKeepStrongly: int - FrameworkImportsKeepWeakly: int - BootstrapInfoStaticKeepStrongly: int - BootstrapInfoStaticKeepWeakly: int - BootstrapInfoKeepStrongly: int - BootstrapInfoKeepWeakly: int - TcLastFileKeepStrongly: int - TcLastFileKeepWeakly: int - TcIntermediateKeepStrongly: int - TcIntermediateKeepWeakly: int - DependencyGraphKeepStrongly: int - DependencyGraphKeepWeakly: int - ProjectExtrasKeepStrongly: int - ProjectExtrasKeepWeakly: int - AssemblyDataKeepStrongly: int - AssemblyDataKeepWeakly: int - SemanticClassificationKeepStrongly: int - SemanticClassificationKeepWeakly: int - ItemKeyStoreKeepStrongly: int - ItemKeyStoreKeepWeakly: int - ScriptClosureKeepStrongly: int - ScriptClosureKeepWeakly: int -} -with + +type CacheSizes = + { + ParseFileKeepStrongly: int + ParseFileKeepWeakly: int + ParseFileWithoutProjectKeepStrongly: int + ParseFileWithoutProjectKeepWeakly: int + ParseAndCheckFileInProjectKeepStrongly: int + ParseAndCheckFileInProjectKeepWeakly: int + ParseAndCheckAllFilesInProjectKeepStrongly: int + ParseAndCheckAllFilesInProjectKeepWeakly: int + ParseAndCheckProjectKeepStrongly: int + ParseAndCheckProjectKeepWeakly: int + FrameworkImportsKeepStrongly: int + FrameworkImportsKeepWeakly: int + BootstrapInfoStaticKeepStrongly: int + BootstrapInfoStaticKeepWeakly: int + BootstrapInfoKeepStrongly: int + BootstrapInfoKeepWeakly: int + TcLastFileKeepStrongly: int + TcLastFileKeepWeakly: int + TcIntermediateKeepStrongly: int + TcIntermediateKeepWeakly: int + DependencyGraphKeepStrongly: int + DependencyGraphKeepWeakly: int + ProjectExtrasKeepStrongly: int + ProjectExtrasKeepWeakly: int + AssemblyDataKeepStrongly: int + AssemblyDataKeepWeakly: int + SemanticClassificationKeepStrongly: int + SemanticClassificationKeepWeakly: int + ItemKeyStoreKeepStrongly: int + ItemKeyStoreKeepWeakly: int + ScriptClosureKeepStrongly: int + ScriptClosureKeepWeakly: int + } + static member Create sizeFactor = - + { ParseFileKeepStrongly = 50 * sizeFactor ParseFileKeepWeakly = 20 * sizeFactor @@ -309,17 +310,17 @@ with ParseAndCheckProjectKeepWeakly = 2 * sizeFactor FrameworkImportsKeepStrongly = sizeFactor FrameworkImportsKeepWeakly = 2 * sizeFactor - BootstrapInfoStaticKeepStrongly = sizeFactor + BootstrapInfoStaticKeepStrongly = sizeFactor BootstrapInfoStaticKeepWeakly = 2 * sizeFactor BootstrapInfoKeepStrongly = sizeFactor - BootstrapInfoKeepWeakly = 2 * sizeFactor - TcLastFileKeepStrongly = sizeFactor + BootstrapInfoKeepWeakly = 2 * sizeFactor + TcLastFileKeepStrongly = sizeFactor TcLastFileKeepWeakly = 2 * sizeFactor TcIntermediateKeepStrongly = 20 * sizeFactor TcIntermediateKeepWeakly = 20 * sizeFactor DependencyGraphKeepStrongly = sizeFactor DependencyGraphKeepWeakly = 2 * sizeFactor - ProjectExtrasKeepStrongly = sizeFactor + ProjectExtrasKeepStrongly = sizeFactor ProjectExtrasKeepWeakly = 2 * sizeFactor AssemblyDataKeepStrongly = sizeFactor AssemblyDataKeepWeakly = 2 * sizeFactor @@ -328,12 +329,13 @@ with ItemKeyStoreKeepStrongly = sizeFactor ItemKeyStoreKeepWeakly = 2 * sizeFactor ScriptClosureKeepStrongly = sizeFactor - ScriptClosureKeepWeakly = 2 * sizeFactor + ScriptClosureKeepWeakly = 2 * sizeFactor } - - static member Default = + + static member Default = let sizeFactor = 100 CacheSizes.Create sizeFactor + type internal CompilerCaches(sizeFactor: CacheSizes) = let sf = sizeFactor @@ -343,17 +345,33 @@ type internal CompilerCaches(sizeFactor: CacheSizes) = member val ParseFile = AsyncMemoize(keepStrongly = sf.ParseFileKeepStrongly, keepWeakly = sf.ParseFileKeepWeakly, name = "ParseFile") member val ParseFileWithoutProject = - AsyncMemoize(sf.ParseFileWithoutProjectKeepStrongly, keepWeakly = sf.ParseFileWithoutProjectKeepWeakly, name = "ParseFileWithoutProject") + AsyncMemoize( + sf.ParseFileWithoutProjectKeepStrongly, + keepWeakly = sf.ParseFileWithoutProjectKeepWeakly, + name = "ParseFileWithoutProject" + ) - member val ParseAndCheckFileInProject = AsyncMemoize(sf.ParseAndCheckFileInProjectKeepStrongly, sf.ParseAndCheckFileInProjectKeepWeakly, name = "ParseAndCheckFileInProject") + member val ParseAndCheckFileInProject = + AsyncMemoize( + sf.ParseAndCheckFileInProjectKeepStrongly, + sf.ParseAndCheckFileInProjectKeepWeakly, + name = "ParseAndCheckFileInProject" + ) - member val ParseAndCheckAllFilesInProject = AsyncMemoizeDisabled(sf.ParseAndCheckAllFilesInProjectKeepStrongly, sf.ParseAndCheckAllFilesInProjectKeepWeakly, name = "ParseAndCheckFullProject") + member val ParseAndCheckAllFilesInProject = + AsyncMemoizeDisabled( + sf.ParseAndCheckAllFilesInProjectKeepStrongly, + sf.ParseAndCheckAllFilesInProjectKeepWeakly, + name = "ParseAndCheckFullProject" + ) - member val ParseAndCheckProject = AsyncMemoize(sf.ParseAndCheckProjectKeepStrongly, sf.ParseAndCheckProjectKeepWeakly, name = "ParseAndCheckProject") + member val ParseAndCheckProject = + AsyncMemoize(sf.ParseAndCheckProjectKeepStrongly, sf.ParseAndCheckProjectKeepWeakly, name = "ParseAndCheckProject") member val FrameworkImports = AsyncMemoize(sf.FrameworkImportsKeepStrongly, sf.FrameworkImportsKeepWeakly, name = "FrameworkImports") - member val BootstrapInfoStatic = AsyncMemoize(sf.BootstrapInfoStaticKeepStrongly, sf.BootstrapInfoStaticKeepWeakly, name = "BootstrapInfoStatic") + member val BootstrapInfoStatic = + AsyncMemoize(sf.BootstrapInfoStaticKeepStrongly, sf.BootstrapInfoStaticKeepWeakly, name = "BootstrapInfoStatic") member val BootstrapInfo = AsyncMemoize(sf.BootstrapInfoKeepStrongly, sf.BootstrapInfoKeepWeakly, name = "BootstrapInfo") @@ -367,7 +385,8 @@ type internal CompilerCaches(sizeFactor: CacheSizes) = member val AssemblyData = AsyncMemoize(sf.AssemblyDataKeepStrongly, sf.AssemblyDataKeepWeakly, name = "AssemblyData") - member val SemanticClassification = AsyncMemoize(sf.SemanticClassificationKeepStrongly, sf.SemanticClassificationKeepWeakly, name = "SemanticClassification") + member val SemanticClassification = + AsyncMemoize(sf.SemanticClassificationKeepStrongly, sf.SemanticClassificationKeepWeakly, name = "SemanticClassification") member val ItemKeyStore = AsyncMemoize(sf.ItemKeyStoreKeepStrongly, sf.ItemKeyStoreKeepWeakly, name = "ItemKeyStore") @@ -412,7 +431,7 @@ type internal TransparentCompiler // Is having just one of these ok? let lexResourceManager = Lexhelp.LexResourceManager() - + let cacheSizes = defaultArg cacheSizes CacheSizes.Default // Mutable so we can easily clear them by creating a new instance @@ -2159,11 +2178,11 @@ type internal TransparentCompiler member _.Caches = caches - member _.SetCacheSize(cacheSize : CacheSizes) = + member _.SetCacheSize(cacheSize: CacheSizes) = if cacheSize <> caches.CacheSizes then caches <- CompilerCaches(cacheSize) - member x.SetCacheSizeFactor(sizeFactor : int) = + member x.SetCacheSizeFactor(sizeFactor: int) = let newCacheSize = CacheSizes.Create sizeFactor x.SetCacheSize newCacheSize diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index 7c156273b9c..f7a0e9ed48a 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -99,41 +99,40 @@ type internal Extensions = ICacheKey<(DependencyGraphType option * byte array), string> [] -type CacheSizes = - { - ParseFileKeepStrongly: int - ParseFileKeepWeakly: int - ParseFileWithoutProjectKeepStrongly: int - ParseFileWithoutProjectKeepWeakly: int - ParseAndCheckFileInProjectKeepStrongly: int - ParseAndCheckFileInProjectKeepWeakly: int - ParseAndCheckAllFilesInProjectKeepStrongly: int - ParseAndCheckAllFilesInProjectKeepWeakly: int - ParseAndCheckProjectKeepStrongly: int - ParseAndCheckProjectKeepWeakly: int - FrameworkImportsKeepStrongly: int - FrameworkImportsKeepWeakly: int - BootstrapInfoStaticKeepStrongly: int - BootstrapInfoStaticKeepWeakly: int - BootstrapInfoKeepStrongly: int - BootstrapInfoKeepWeakly: int - TcLastFileKeepStrongly: int - TcLastFileKeepWeakly: int - TcIntermediateKeepStrongly: int - TcIntermediateKeepWeakly: int - DependencyGraphKeepStrongly: int - DependencyGraphKeepWeakly: int - ProjectExtrasKeepStrongly: int - ProjectExtrasKeepWeakly: int - AssemblyDataKeepStrongly: int - AssemblyDataKeepWeakly: int - SemanticClassificationKeepStrongly: int - SemanticClassificationKeepWeakly: int - ItemKeyStoreKeepStrongly: int - ItemKeyStoreKeepWeakly: int - ScriptClosureKeepStrongly: int - ScriptClosureKeepWeakly: int - } +type CacheSizes = + { ParseFileKeepStrongly: int + ParseFileKeepWeakly: int + ParseFileWithoutProjectKeepStrongly: int + ParseFileWithoutProjectKeepWeakly: int + ParseAndCheckFileInProjectKeepStrongly: int + ParseAndCheckFileInProjectKeepWeakly: int + ParseAndCheckAllFilesInProjectKeepStrongly: int + ParseAndCheckAllFilesInProjectKeepWeakly: int + ParseAndCheckProjectKeepStrongly: int + ParseAndCheckProjectKeepWeakly: int + FrameworkImportsKeepStrongly: int + FrameworkImportsKeepWeakly: int + BootstrapInfoStaticKeepStrongly: int + BootstrapInfoStaticKeepWeakly: int + BootstrapInfoKeepStrongly: int + BootstrapInfoKeepWeakly: int + TcLastFileKeepStrongly: int + TcLastFileKeepWeakly: int + TcIntermediateKeepStrongly: int + TcIntermediateKeepWeakly: int + DependencyGraphKeepStrongly: int + DependencyGraphKeepWeakly: int + ProjectExtrasKeepStrongly: int + ProjectExtrasKeepWeakly: int + AssemblyDataKeepStrongly: int + AssemblyDataKeepWeakly: int + SemanticClassificationKeepStrongly: int + SemanticClassificationKeepWeakly: int + ItemKeyStoreKeepStrongly: int + ItemKeyStoreKeepWeakly: int + ScriptClosureKeepStrongly: int + ScriptClosureKeepWeakly: int } + static member Create: sizeFactor: int -> CacheSizes type internal CompilerCaches = diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 4da328508fb..4835b784bf8 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -137,7 +137,7 @@ type FSharpChecker captureIdentifiersWhenParsing, getSource, useChangeNotifications, - ?cacheSizes= transparentCompilerCacheSizes + ?cacheSizes = transparentCompilerCacheSizes ) :> IBackgroundCompiler else @@ -201,7 +201,7 @@ type FSharpChecker ?captureIdentifiersWhenParsing: bool, ?documentSource: DocumentSource, ?useTransparentCompiler: bool, - ?transparentCompilerCacheSizes : CacheSizes + ?transparentCompilerCacheSizes: CacheSizes ) = use _ = Activity.startNoTags "FSharpChecker.Create" From e52faa245e978ab438ec6cf59b20bc4ee3ae4705 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Mon, 9 Dec 2024 09:11:27 -0500 Subject: [PATCH 10/11] remove oops and rename cacheSizes --- src/Compiler/Service/TransparentCompiler.fs | 59 ++++++++------------ src/Compiler/Service/TransparentCompiler.fsi | 2 +- 2 files changed, 23 insertions(+), 38 deletions(-) diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index f4d4f5d7c70..bc15b6c3b67 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -336,61 +336,60 @@ type CacheSizes = let sizeFactor = 100 CacheSizes.Create sizeFactor -type internal CompilerCaches(sizeFactor: CacheSizes) = +type internal CompilerCaches(cacheSizes: CacheSizes) = + let cs = cacheSizes - let sf = sizeFactor + member _.CacheSizes = cs - member _.CacheSizes = sf - - member val ParseFile = AsyncMemoize(keepStrongly = sf.ParseFileKeepStrongly, keepWeakly = sf.ParseFileKeepWeakly, name = "ParseFile") + member val ParseFile = AsyncMemoize(keepStrongly = cs.ParseFileKeepStrongly, keepWeakly = cs.ParseFileKeepWeakly, name = "ParseFile") member val ParseFileWithoutProject = AsyncMemoize( - sf.ParseFileWithoutProjectKeepStrongly, - keepWeakly = sf.ParseFileWithoutProjectKeepWeakly, + cs.ParseFileWithoutProjectKeepStrongly, + keepWeakly = cs.ParseFileWithoutProjectKeepWeakly, name = "ParseFileWithoutProject" ) member val ParseAndCheckFileInProject = AsyncMemoize( - sf.ParseAndCheckFileInProjectKeepStrongly, - sf.ParseAndCheckFileInProjectKeepWeakly, + cs.ParseAndCheckFileInProjectKeepStrongly, + cs.ParseAndCheckFileInProjectKeepWeakly, name = "ParseAndCheckFileInProject" ) member val ParseAndCheckAllFilesInProject = AsyncMemoizeDisabled( - sf.ParseAndCheckAllFilesInProjectKeepStrongly, - sf.ParseAndCheckAllFilesInProjectKeepWeakly, + cs.ParseAndCheckAllFilesInProjectKeepStrongly, + cs.ParseAndCheckAllFilesInProjectKeepWeakly, name = "ParseAndCheckFullProject" ) member val ParseAndCheckProject = - AsyncMemoize(sf.ParseAndCheckProjectKeepStrongly, sf.ParseAndCheckProjectKeepWeakly, name = "ParseAndCheckProject") + AsyncMemoize(cs.ParseAndCheckProjectKeepStrongly, cs.ParseAndCheckProjectKeepWeakly, name = "ParseAndCheckProject") - member val FrameworkImports = AsyncMemoize(sf.FrameworkImportsKeepStrongly, sf.FrameworkImportsKeepWeakly, name = "FrameworkImports") + member val FrameworkImports = AsyncMemoize(cs.FrameworkImportsKeepStrongly, cs.FrameworkImportsKeepWeakly, name = "FrameworkImports") member val BootstrapInfoStatic = - AsyncMemoize(sf.BootstrapInfoStaticKeepStrongly, sf.BootstrapInfoStaticKeepWeakly, name = "BootstrapInfoStatic") + AsyncMemoize(cs.BootstrapInfoStaticKeepStrongly, cs.BootstrapInfoStaticKeepWeakly, name = "BootstrapInfoStatic") - member val BootstrapInfo = AsyncMemoize(sf.BootstrapInfoKeepStrongly, sf.BootstrapInfoKeepWeakly, name = "BootstrapInfo") + member val BootstrapInfo = AsyncMemoize(cs.BootstrapInfoKeepStrongly, cs.BootstrapInfoKeepWeakly, name = "BootstrapInfo") - member val TcLastFile = AsyncMemoizeDisabled(sf.TcLastFileKeepStrongly, sf.TcLastFileKeepWeakly, name = "TcLastFile") + member val TcLastFile = AsyncMemoizeDisabled(cs.TcLastFileKeepStrongly, cs.TcLastFileKeepWeakly, name = "TcLastFile") - member val TcIntermediate = AsyncMemoize(sf.TcIntermediateKeepStrongly, sf.TcIntermediateKeepWeakly, name = "TcIntermediate") + member val TcIntermediate = AsyncMemoize(cs.TcIntermediateKeepStrongly, cs.TcIntermediateKeepWeakly, name = "TcIntermediate") - member val DependencyGraph = AsyncMemoize(sf.DependencyGraphKeepStrongly, sf.DependencyGraphKeepWeakly, name = "DependencyGraph") + member val DependencyGraph = AsyncMemoize(cs.DependencyGraphKeepStrongly, cs.DependencyGraphKeepWeakly, name = "DependencyGraph") - member val ProjectExtras = AsyncMemoizeDisabled(sf.ProjectExtrasKeepStrongly, sf.ProjectExtrasKeepWeakly, name = "ProjectExtras") + member val ProjectExtras = AsyncMemoizeDisabled(cs.ProjectExtrasKeepStrongly, cs.ProjectExtrasKeepWeakly, name = "ProjectExtras") - member val AssemblyData = AsyncMemoize(sf.AssemblyDataKeepStrongly, sf.AssemblyDataKeepWeakly, name = "AssemblyData") + member val AssemblyData = AsyncMemoize(cs.AssemblyDataKeepStrongly, cs.AssemblyDataKeepWeakly, name = "AssemblyData") member val SemanticClassification = - AsyncMemoize(sf.SemanticClassificationKeepStrongly, sf.SemanticClassificationKeepWeakly, name = "SemanticClassification") + AsyncMemoize(cs.SemanticClassificationKeepStrongly, cs.SemanticClassificationKeepWeakly, name = "SemanticClassification") - member val ItemKeyStore = AsyncMemoize(sf.ItemKeyStoreKeepStrongly, sf.ItemKeyStoreKeepWeakly, name = "ItemKeyStore") + member val ItemKeyStore = AsyncMemoize(cs.ItemKeyStoreKeepStrongly, cs.ItemKeyStoreKeepWeakly, name = "ItemKeyStore") - member val ScriptClosure = AsyncMemoize(sf.ScriptClosureKeepStrongly, sf.ScriptClosureKeepWeakly, name = "ScriptClosure") + member val ScriptClosure = AsyncMemoize(cs.ScriptClosureKeepStrongly, cs.ScriptClosureKeepWeakly, name = "ScriptClosure") member this.Clear(projects: Set) = let shouldClear project = projects |> Set.contains project @@ -1468,17 +1467,6 @@ type internal TransparentCompiler node, (fun tcInfo -> - // if tcInfo.stateContainsNodes |> Set.contains fileNode then - // failwith $"Oops!" - - //if - // tcInfo.stateContainsNodes - // Signature files don't have to be right above the impl file... if we need this check then - // we need to do it differently - // |> Set.contains (NodeToTypeCheck.ArtificialImplFile(index - 1)) - //then - // failwith $"Oops???" - let partialResult, tcState = finisher tcInfo.tcState let tcEnv, topAttribs, _checkImplFileOpt, ccuSigForFile = partialResult @@ -1514,9 +1502,6 @@ type internal TransparentCompiler fileNode, (fun tcInfo -> - // if tcInfo.stateContainsNodes |> Set.contains fileNode then - // failwith $"Oops!" - let parsedInput = projectSnapshot.SourceFiles[index].ParsedInput let prefixPathOpt = None // Retrieve the type-checked signature information and add it to the TcEnvFromImpls. diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index f7a0e9ed48a..93df10b29e2 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -137,7 +137,7 @@ type CacheSizes = type internal CompilerCaches = - new: sizeFactor: CacheSizes -> CompilerCaches + new: cacheSizes: CacheSizes -> CompilerCaches member AssemblyData: AsyncMemoize From d3175b3f08f02f5d461c68d86a434945a60ce641 Mon Sep 17 00:00:00 2001 From: 0101 <0101@innit.cz> Date: Tue, 10 Dec 2024 11:41:44 +0100 Subject: [PATCH 11/11] Update surfacearea --- ...ervice.SurfaceArea.netstandard20.debug.bsl | 78 ++++++++++++++++++- ...vice.SurfaceArea.netstandard20.release.bsl | 78 ++++++++++++++++++- 2 files changed, 154 insertions(+), 2 deletions(-) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index b66bebd1cbc..e079d08a862 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -2138,7 +2138,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] Dependen FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] get_DependencyFiles() FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean UsesTransparentCompiler FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean get_UsesTransparentCompiler() -FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes]) FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Instance FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker get_Instance() FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions GetProjectOptionsFromCommandLineArgs(System.String, System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) @@ -2575,6 +2575,82 @@ FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.Proje FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpReferencedProjectSnapshot FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.ProjectSnapshot+ProjectConfig FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.ProjectSnapshot+ReferenceOnDisk +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes, System.Collections.IEqualityComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(System.Object) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes Create(Int32) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 AssemblyDataKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 AssemblyDataKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoStaticKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoStaticKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 CompareTo(FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 CompareTo(System.Object) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 CompareTo(System.Object, System.Collections.IComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 DependencyGraphKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 DependencyGraphKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 FrameworkImportsKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 FrameworkImportsKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 GetHashCode() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ItemKeyStoreKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ItemKeyStoreKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckAllFilesInProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckAllFilesInProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckFileInProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckFileInProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileWithoutProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileWithoutProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ProjectExtrasKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ProjectExtrasKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ScriptClosureKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ScriptClosureKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 SemanticClassificationKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 SemanticClassificationKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcIntermediateKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcIntermediateKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcLastFileKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcLastFileKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_AssemblyDataKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_AssemblyDataKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoStaticKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoStaticKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_DependencyGraphKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_DependencyGraphKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_FrameworkImportsKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_FrameworkImportsKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ItemKeyStoreKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ItemKeyStoreKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckAllFilesInProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckAllFilesInProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckFileInProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckFileInProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileWithoutProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileWithoutProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ProjectExtrasKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ProjectExtrasKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ScriptClosureKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ScriptClosureKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_SemanticClassificationKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_SemanticClassificationKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcIntermediateKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcIntermediateKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcLastFileKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcLastFileKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: System.String ToString() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) FSharp.Compiler.CodeAnalysis.Workspace.FSharpWorkspace: FSharp.Compiler.CodeAnalysis.FSharpChecker Checker FSharp.Compiler.CodeAnalysis.Workspace.FSharpWorkspace: FSharp.Compiler.CodeAnalysis.FSharpChecker get_Checker() FSharp.Compiler.CodeAnalysis.Workspace.FSharpWorkspace: FSharpWorkspaceFiles Files diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index b66bebd1cbc..e079d08a862 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -2138,7 +2138,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] Dependen FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] get_DependencyFiles() FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean UsesTransparentCompiler FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean get_UsesTransparentCompiler() -FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes]) FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Instance FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker get_Instance() FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions GetProjectOptionsFromCommandLineArgs(System.String, System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) @@ -2575,6 +2575,82 @@ FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.Proje FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpReferencedProjectSnapshot FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.ProjectSnapshot+ProjectConfig FSharp.Compiler.CodeAnalysis.ProjectSnapshot: FSharp.Compiler.CodeAnalysis.ProjectSnapshot+ReferenceOnDisk +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes, System.Collections.IEqualityComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(System.Object) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes Create(Int32) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 AssemblyDataKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 AssemblyDataKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoStaticKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 BootstrapInfoStaticKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 CompareTo(FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 CompareTo(System.Object) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 CompareTo(System.Object, System.Collections.IComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 DependencyGraphKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 DependencyGraphKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 FrameworkImportsKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 FrameworkImportsKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 GetHashCode() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ItemKeyStoreKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ItemKeyStoreKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckAllFilesInProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckAllFilesInProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckFileInProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckFileInProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseAndCheckProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileWithoutProjectKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ParseFileWithoutProjectKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ProjectExtrasKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ProjectExtrasKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ScriptClosureKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 ScriptClosureKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 SemanticClassificationKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 SemanticClassificationKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcIntermediateKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcIntermediateKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcLastFileKeepStrongly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 TcLastFileKeepWeakly +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_AssemblyDataKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_AssemblyDataKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoStaticKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_BootstrapInfoStaticKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_DependencyGraphKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_DependencyGraphKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_FrameworkImportsKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_FrameworkImportsKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ItemKeyStoreKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ItemKeyStoreKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckAllFilesInProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckAllFilesInProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckFileInProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckFileInProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseAndCheckProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileWithoutProjectKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ParseFileWithoutProjectKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ProjectExtrasKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ProjectExtrasKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ScriptClosureKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_ScriptClosureKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_SemanticClassificationKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_SemanticClassificationKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcIntermediateKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcIntermediateKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcLastFileKeepStrongly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Int32 get_TcLastFileKeepWeakly() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: System.String ToString() +FSharp.Compiler.CodeAnalysis.TransparentCompiler.CacheSizes: Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) FSharp.Compiler.CodeAnalysis.Workspace.FSharpWorkspace: FSharp.Compiler.CodeAnalysis.FSharpChecker Checker FSharp.Compiler.CodeAnalysis.Workspace.FSharpWorkspace: FSharp.Compiler.CodeAnalysis.FSharpChecker get_Checker() FSharp.Compiler.CodeAnalysis.Workspace.FSharpWorkspace: FSharpWorkspaceFiles Files