Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable MaxMem by default, fix formatting of types #444

Merged
merged 4 commits into from
Oct 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### 1.4.0.9 -
* FSharpType.Format fix
* Disable maximum-memory trigger by default until use case ironed out

#### 1.4.0.8 -
* FSharpType.Format now prettifies type variables. If necessary, FSharpType.Prettify can also be called
* Add maximum-memory trigger to downsize FCS caches. Defaults to 1.7GB of allocaed memory in the system
Expand Down
3 changes: 1 addition & 2 deletions docs/content/caches.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ the strong sizes of all FCS caches are reduced to either 0 or 1. This happens f
In practice this will still make tools like the Visual Studio F# Power Tools usable, but some operations like renaming across multiple
projects may take substantially longer.

For a 32-bit process the default threshold is 1.7GB of allocated managed memory in a process, see `maxMBDefault` in `service.fs`. For a 64-bit process
it is twice this.
By default the maximum memory trigger is disabled, see `maxMBDefault` in `service.fs`.

Reducing the FCS strong cache sizes does not guarantee there will be enough memory to continue operations - even holding one project
strongly may exceed a process memory budget. It just means FCS may hold less memory strongly.
Expand Down
12 changes: 7 additions & 5 deletions src/fsharp/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,14 +1061,16 @@ module private PrintTypes =
nameL ^^ wordL ":" ^^ tauL


let layoutPrettyTypeWithPrec prec denv typ =

let layoutPrettyType denv typ =
let _,typ,cxs = PrettyTypes.PrettifyTypes1 denv.g typ
let env = SimplifyTypes.CollectInfo true [typ] cxs
let cxsL = layoutConstraintsWithInfo denv env env.postfixConstraints
layoutTypeWithInfoAndPrec denv env prec typ --- cxsL
layoutTypeWithInfoAndPrec denv env 2 typ --- cxsL

let layoutPrettyType denv typ = layoutPrettyTypeWithPrec 2 denv typ
let layoutPrettyTypeHighPrec denv typ = layoutPrettyTypeWithPrec 5 denv typ
let layoutPrettyTypeNoCx denv typ =
let _,typ,_cxs = PrettyTypes.PrettifyTypes1 denv.g typ
layoutTypeWithInfoAndPrec denv SimplifyTypes.typeSimplificationInfo0 5 typ

/// Printing TAST objects
module private PrintTastMemberOrVals =
Expand Down Expand Up @@ -1881,7 +1883,7 @@ let isGeneratedExceptionField pos f = TastDefinitionPrinting.isGeneratedExce
let stringOfTyparConstraint denv tpc = stringOfTyparConstraints denv [tpc]
let stringOfTy denv x = x |> PrintTypes.layoutType denv |> showL
let prettyStringOfTy denv x = x |> PrintTypes.layoutPrettyType denv |> showL
let prettyStringOfTyHighPrec denv x = x |> PrintTypes.layoutPrettyTypeHighPrec denv |> showL
let prettyStringOfTyNoCx denv x = x |> PrintTypes.layoutPrettyTypeNoCx denv |> showL
let stringOfRecdField denv x = x |> TastDefinitionPrinting.layoutRecdField false denv |> showL
let stringOfUnionCase denv x = x |> TastDefinitionPrinting.layoutUnionCase denv (wordL "|") |> showL
let stringOfExnDef denv x = x |> TastDefinitionPrinting.layoutExnDefn denv |> showL
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/vs/Symbols.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,11 +1848,11 @@ and FSharpType(cenv, typ:TType) =

member x.Format(denv: FSharpDisplayContext) =
protect <| fun () ->
NicePrint.prettyStringOfTyHighPrec (denv.Contents cenv.g) typ
NicePrint.prettyStringOfTyNoCx (denv.Contents cenv.g) typ

override x.ToString() =
protect <| fun () ->
"type " + NicePrint.prettyStringOfTyHighPrec (DisplayEnv.Empty(cenv.g)) typ
"type " + NicePrint.prettyStringOfTyNoCx (DisplayEnv.Empty(cenv.g)) typ

static member Prettify(typ: FSharpType) =
let t = PrettyTypes.PrettifyTypes1 typ.cenv.g typ.V |> p23
Expand Down
8 changes: 4 additions & 4 deletions src/fsharp/vs/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ module EnvMisc =

let projectCacheSizeDefault = GetEnvInteger "mFSharp_ProjectCacheSizeDefault" 3
let frameworkTcImportsCacheStrongSize = GetEnvInteger "mFSharp_frameworkTcImportsCacheStrongSizeDefault" 8
let maxMBDefault = GetEnvInteger "mFSharp_maxMB" (if sizeof<int> = 4 then 1700 else 3400)
let maxMBDefault = GetEnvInteger "mFSharp_maxMB" 1000000 // a million MB = 1TB = disabled
//let maxMBDefault = GetEnvInteger "mFSharp_maxMB" (if sizeof<int> = 4 then 1700 else 3400)

//----------------------------------------------------------------------------
// Methods
Expand Down Expand Up @@ -2472,7 +2473,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun
// including by SetAlternate.
let builderB, errorsB, decrementB = CreateOneIncrementalBuilder options
incrementalBuildersCache.Set(options, (builderB, errorsB, decrementB))
//bc.StartBackgroundCompile(options)
bc.StartBackgroundCompile(options)

member bc.NotifyProjectCleaned(options : FSharpProjectOptions) =
match incrementalBuildersCache.TryGetAny options with
Expand Down Expand Up @@ -3049,8 +3050,7 @@ type FSharpChecker(projectCacheSize, keepAssemblyContents, keepAllBackgroundReso
match checkAnswer with
| None
| Some FSharpCheckFileAnswer.Aborted ->
//backgroundCompiler.StartBackgroundCompile(options)
()
backgroundCompiler.StartBackgroundCompile(options)
| Some (FSharpCheckFileAnswer.Succeeded typedResults) ->
foregroundTypeCheckCount <- foregroundTypeCheckCount + 1
parseAndCheckFileInProjectCachePossiblyStale.Set((filename,options),(parseResults,typedResults,fileVersion))
Expand Down
16 changes: 8 additions & 8 deletions tests/service/ProjectAnalysisTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4744,29 +4744,29 @@ let ``Test project39 all symbols`` () =
[("functionWithIncompleteSignature", ((4, 4), (4, 35)),
("full", "'a -> 'b"), ("params", [["'a"]]), ("return", "'b"));
("curriedFunctionWithIncompleteSignature", ((5, 4), (5, 42)),
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b"),
("params",
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
("return", "'b"));
("MemberWithIncompleteSignature", ((10, 13), (10, 42)),
("full", "C -> 'c -> 'd"), ("params", [["'c"]]), ("return", "'d"));
("CurriedMemberWithIncompleteSignature", ((11, 13), (11, 49)),
("full", "C -> 'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
("full", "C -> 'a -> 'a0 -> 'a * 'a0 -> 'b"),
("params",
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
("return", "'b"));
("functionWithIncompleteSignature", ((16, 3), (16, 34)),
("full", "'a -> 'b"), ("params", [["'a"]]), ("return", "'b"));
("curriedFunctionWithIncompleteSignature", ((17, 3), (17, 41)),
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b"),
("params",
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
("return", "'b"));
("MemberWithIncompleteSignature", ((18, 3), (18, 36)),
("full", "'c -> 'd"), ("params", [["'c"]]), ("return", "'d"));
("CurriedMemberWithIncompleteSignature", ((19, 3), (19, 43)),
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b"),
("params",
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
("return", "'b"))]