Skip to content

Commit 615475b

Browse files
authored
Take the Unshadow stackguard from environment (#16583)
* try to take the stackguard depth for pushShadowedLocals from the environment * add release notes entry * add PR number
1 parent 4c0a592 commit 615475b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/release-notes/.FSharp.Compiler.Service/8.0.300.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### Added
88

9+
* The stackguard depth for ILPdbWriter.unshadowScopes can be modified via the environment variable `FSHARP_ILPdb_UnshadowScopes_StackGuardDepth`([PR #16583](https://github.com/dotnet/fsharp/pull/16583))
910
* Parser recovers on complex primary constructor patterns, better tree representation for primary constructor patterns. ([PR #16425](https://github.com/dotnet/fsharp/pull/16425))
1011
* Name resolution: keep type vars in subsequent checks ([PR #16456](https://github.com/dotnet/fsharp/pull/16456))
1112
* Higher-order-function-based API for working with the untyped abstract syntax tree. ([PR #16462](https://github.com/dotnet/fsharp/pull/16462))

src/Compiler/AbstractIL/ilwritepdb.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ open Internal.Utilities
1616
open FSharp.Compiler.AbstractIL.IL
1717
open FSharp.Compiler.AbstractIL.Support
1818
open Internal.Utilities.Library
19+
open Internal.Utilities.Library.Extras
1920
open FSharp.Compiler.DiagnosticsLogger
2021
open FSharp.Compiler.IO
2122
open FSharp.Compiler.Text.Range
@@ -1028,6 +1029,11 @@ let rec pushShadowedLocals (stackGuard: StackGuard) (localsToPush: PdbLocalVar[]
10281029
// adding the text " (shadowed)" to the names of those with name conflicts.
10291030
let unshadowScopes rootScope =
10301031
// Avoid stack overflow when writing linearly nested scopes
1031-
let stackGuard = StackGuard(100, "ILPdbWriter.unshadowScopes")
1032+
let UnshadowScopesStackGuardDepth =
1033+
GetEnvInteger "FSHARP_ILPdb_UnshadowScopes_StackGuardDepth" 100
1034+
1035+
let stackGuard =
1036+
StackGuard(UnshadowScopesStackGuardDepth, "ILPdbWriter.unshadowScopes")
1037+
10321038
let result, _ = pushShadowedLocals stackGuard [||] rootScope
10331039
result

0 commit comments

Comments
 (0)