Skip to content

Commit a7c86ea

Browse files
committed
Merge pull request #444 from dsyme/fix-mem2
Disable MaxMem by default, fix formatting of types
2 parents 6a5a393 + 96a00a9 commit a7c86ea

File tree

6 files changed

+26
-21
lines changed

6 files changed

+26
-21
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#### 1.4.0.9 -
2+
* FSharpType.Format fix
3+
* Disable maximum-memory trigger by default until use case ironed out
4+
15
#### 1.4.0.8 -
26
* FSharpType.Format now prettifies type variables. If necessary, FSharpType.Prettify can also be called
37
* Add maximum-memory trigger to downsize FCS caches. Defaults to 1.7GB of allocaed memory in the system

docs/content/caches.fsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ the strong sizes of all FCS caches are reduced to either 0 or 1. This happens f
6767
In practice this will still make tools like the Visual Studio F# Power Tools usable, but some operations like renaming across multiple
6868
projects may take substantially longer.
6969
70-
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
71-
it is twice this.
70+
By default the maximum memory trigger is disabled, see `maxMBDefault` in `service.fs`.
7271
7372
Reducing the FCS strong cache sizes does not guarantee there will be enough memory to continue operations - even holding one project
7473
strongly may exceed a process memory budget. It just means FCS may hold less memory strongly.

src/fsharp/NicePrint.fs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,14 +1061,16 @@ module private PrintTypes =
10611061
nameL ^^ wordL ":" ^^ tauL
10621062

10631063

1064-
let layoutPrettyTypeWithPrec prec denv typ =
1064+
1065+
let layoutPrettyType denv typ =
10651066
let _,typ,cxs = PrettyTypes.PrettifyTypes1 denv.g typ
10661067
let env = SimplifyTypes.CollectInfo true [typ] cxs
10671068
let cxsL = layoutConstraintsWithInfo denv env env.postfixConstraints
1068-
layoutTypeWithInfoAndPrec denv env prec typ --- cxsL
1069+
layoutTypeWithInfoAndPrec denv env 2 typ --- cxsL
10691070

1070-
let layoutPrettyType denv typ = layoutPrettyTypeWithPrec 2 denv typ
1071-
let layoutPrettyTypeHighPrec denv typ = layoutPrettyTypeWithPrec 5 denv typ
1071+
let layoutPrettyTypeNoCx denv typ =
1072+
let _,typ,_cxs = PrettyTypes.PrettifyTypes1 denv.g typ
1073+
layoutTypeWithInfoAndPrec denv SimplifyTypes.typeSimplificationInfo0 5 typ
10721074

10731075
/// Printing TAST objects
10741076
module private PrintTastMemberOrVals =
@@ -1881,7 +1883,7 @@ let isGeneratedExceptionField pos f = TastDefinitionPrinting.isGeneratedExce
18811883
let stringOfTyparConstraint denv tpc = stringOfTyparConstraints denv [tpc]
18821884
let stringOfTy denv x = x |> PrintTypes.layoutType denv |> showL
18831885
let prettyStringOfTy denv x = x |> PrintTypes.layoutPrettyType denv |> showL
1884-
let prettyStringOfTyHighPrec denv x = x |> PrintTypes.layoutPrettyTypeHighPrec denv |> showL
1886+
let prettyStringOfTyNoCx denv x = x |> PrintTypes.layoutPrettyTypeNoCx denv |> showL
18851887
let stringOfRecdField denv x = x |> TastDefinitionPrinting.layoutRecdField false denv |> showL
18861888
let stringOfUnionCase denv x = x |> TastDefinitionPrinting.layoutUnionCase denv (wordL "|") |> showL
18871889
let stringOfExnDef denv x = x |> TastDefinitionPrinting.layoutExnDefn denv |> showL

src/fsharp/vs/Symbols.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,11 +1848,11 @@ and FSharpType(cenv, typ:TType) =
18481848

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

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

18571857
static member Prettify(typ: FSharpType) =
18581858
let t = PrettyTypes.PrettifyTypes1 typ.cenv.g typ.V |> p23

src/fsharp/vs/service.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ module EnvMisc =
6262

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

6768
//----------------------------------------------------------------------------
6869
// Methods
@@ -2472,7 +2473,7 @@ type BackgroundCompiler(projectCacheSize, keepAssemblyContents, keepAllBackgroun
24722473
// including by SetAlternate.
24732474
let builderB, errorsB, decrementB = CreateOneIncrementalBuilder options
24742475
incrementalBuildersCache.Set(options, (builderB, errorsB, decrementB))
2475-
//bc.StartBackgroundCompile(options)
2476+
bc.StartBackgroundCompile(options)
24762477

24772478
member bc.NotifyProjectCleaned(options : FSharpProjectOptions) =
24782479
match incrementalBuildersCache.TryGetAny options with
@@ -3049,8 +3050,7 @@ type FSharpChecker(projectCacheSize, keepAssemblyContents, keepAllBackgroundReso
30493050
match checkAnswer with
30503051
| None
30513052
| Some FSharpCheckFileAnswer.Aborted ->
3052-
//backgroundCompiler.StartBackgroundCompile(options)
3053-
()
3053+
backgroundCompiler.StartBackgroundCompile(options)
30543054
| Some (FSharpCheckFileAnswer.Succeeded typedResults) ->
30553055
foregroundTypeCheckCount <- foregroundTypeCheckCount + 1
30563056
parseAndCheckFileInProjectCachePossiblyStale.Set((filename,options),(parseResults,typedResults,fileVersion))

tests/service/ProjectAnalysisTests.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4744,29 +4744,29 @@ let ``Test project39 all symbols`` () =
47444744
[("functionWithIncompleteSignature", ((4, 4), (4, 35)),
47454745
("full", "'a -> 'b"), ("params", [["'a"]]), ("return", "'b"));
47464746
("curriedFunctionWithIncompleteSignature", ((5, 4), (5, 42)),
4747-
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
4747+
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b"),
47484748
("params",
4749-
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
4749+
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
47504750
("return", "'b"));
47514751
("MemberWithIncompleteSignature", ((10, 13), (10, 42)),
47524752
("full", "C -> 'c -> 'd"), ("params", [["'c"]]), ("return", "'d"));
47534753
("CurriedMemberWithIncompleteSignature", ((11, 13), (11, 49)),
4754-
("full", "C -> 'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
4754+
("full", "C -> 'a -> 'a0 -> 'a * 'a0 -> 'b"),
47554755
("params",
4756-
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
4756+
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
47574757
("return", "'b"));
47584758
("functionWithIncompleteSignature", ((16, 3), (16, 34)),
47594759
("full", "'a -> 'b"), ("params", [["'a"]]), ("return", "'b"));
47604760
("curriedFunctionWithIncompleteSignature", ((17, 3), (17, 41)),
4761-
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
4761+
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b"),
47624762
("params",
4763-
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
4763+
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
47644764
("return", "'b"));
47654765
("MemberWithIncompleteSignature", ((18, 3), (18, 36)),
47664766
("full", "'c -> 'd"), ("params", [["'c"]]), ("return", "'d"));
47674767
("CurriedMemberWithIncompleteSignature", ((19, 3), (19, 43)),
4768-
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b when 'a0 : equality"),
4768+
("full", "'a -> 'a0 -> 'a * 'a0 -> 'b"),
47694769
("params",
4770-
[["'a"]; ["'a0 when 'a0 : equality"]; ["'a"; "'a0 when 'a0 : equality"]]),
4770+
[["'a"]; ["'a0"]; ["'a"; "'a0"]]),
47714771
("return", "'b"))]
47724772

0 commit comments

Comments
 (0)