Skip to content

Commit

Permalink
Take the Unshadow stackguard from environment (#16583)
Browse files Browse the repository at this point in the history
* try to take the stackguard depth for pushShadowedLocals from the environment

* add release notes entry

* add PR number
  • Loading branch information
dawedawe authored Jan 25, 2024
1 parent 4c0a592 commit 615475b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Added

* 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))
* Parser recovers on complex primary constructor patterns, better tree representation for primary constructor patterns. ([PR #16425](https://github.com/dotnet/fsharp/pull/16425))
* Name resolution: keep type vars in subsequent checks ([PR #16456](https://github.com/dotnet/fsharp/pull/16456))
* Higher-order-function-based API for working with the untyped abstract syntax tree. ([PR #16462](https://github.com/dotnet/fsharp/pull/16462))
Expand Down
8 changes: 7 additions & 1 deletion src/Compiler/AbstractIL/ilwritepdb.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ open Internal.Utilities
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.Support
open Internal.Utilities.Library
open Internal.Utilities.Library.Extras
open FSharp.Compiler.DiagnosticsLogger
open FSharp.Compiler.IO
open FSharp.Compiler.Text.Range
Expand Down Expand Up @@ -1028,6 +1029,11 @@ let rec pushShadowedLocals (stackGuard: StackGuard) (localsToPush: PdbLocalVar[]
// adding the text " (shadowed)" to the names of those with name conflicts.
let unshadowScopes rootScope =
// Avoid stack overflow when writing linearly nested scopes
let stackGuard = StackGuard(100, "ILPdbWriter.unshadowScopes")
let UnshadowScopesStackGuardDepth =
GetEnvInteger "FSHARP_ILPdb_UnshadowScopes_StackGuardDepth" 100

let stackGuard =
StackGuard(UnshadowScopesStackGuardDepth, "ILPdbWriter.unshadowScopes")

let result, _ = pushShadowedLocals stackGuard [||] rootScope
result

0 comments on commit 615475b

Please sign in to comment.