Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dbccb1c
Merge pull request #6641 from Microsoft/merges/dev16.1-to-dev16.2
Apr 27, 2019
e3e148c
update vs minor version (#6649)
brettfo Apr 29, 2019
046491a
Merge pull request #6642 from Microsoft/merges/master-to-dev16.2
brettfo Apr 29, 2019
34c27d3
Merge pull request #6651 from Microsoft/merges/master-to-dev16.2
Apr 30, 2019
ef3fc2e
Merge remote-tracking branch 'upstream/master' into merges/master-to-…
brettfo Apr 30, 2019
35c5f78
Merge pull request #6658 from Microsoft/merges/master-to-dev16.2
May 1, 2019
267fa06
Merge pull request #6663 from Microsoft/merges/master-to-dev16.2
May 2, 2019
1185538
Merge pull request #6670 from Microsoft/merges/master-to-dev16.2
May 3, 2019
0f93a32
Merge pull request #6683 from Microsoft/merges/master-to-dev16.2
May 3, 2019
485db82
Merge pull request #6682 from Microsoft/merges/dev16.1-to-dev16.2
May 4, 2019
8cc3c7e
Merge pull request #6692 from microsoft/merges/master-to-dev16.2
May 7, 2019
bdf1bec
Merge pull request #6696 from microsoft/merges/master-to-dev16.2
May 7, 2019
2f7ce9e
Merge pull request #6704 from microsoft/merges/master-to-dev16.2
May 10, 2019
1e6bb28
Merge pull request #6708 from microsoft/merges/master-to-dev16.2
May 10, 2019
732b6d0
Merge pull request #6713 from microsoft/merges/master-to-dev16.2
May 13, 2019
5ade74b
Merge pull request #6719 from microsoft/merges/master-to-dev16.2
May 13, 2019
d697eac
Merge pull request #6720 from microsoft/merges/master-to-dev16.2
May 13, 2019
e8102e4
Merge pull request #6726 from microsoft/merges/master-to-dev16.2
May 14, 2019
52c75b3
Update Versions.props
KevinRansom May 14, 2019
90895fd
Merge remote-tracking branch 'upstream/master' into merges/master-to-…
brettfo May 15, 2019
62e9d32
Merge pull request #6736 from microsoft/merges/master-to-release/dev16.2
May 15, 2019
a45d839
Merge pull request #6743 from dotnet/merges/master-to-release/dev16.2
May 16, 2019
eab5ba5
Merge pull request #6757 from dotnet/merges/master-to-release/dev16.2
May 17, 2019
c865d96
Merge pull request #6762 from dotnet/merges/master-to-release/dev16.2
May 17, 2019
0b12961
Merge pull request #6773 from dotnet/merges/master-to-release/dev16.2
May 18, 2019
12313b2
Merge pull request #6787 from dotnet/merges/master-to-release/dev16.2
May 21, 2019
22ecba8
Merge pull request #6792 from dotnet/merges/master-to-release/dev16.2
brettfo May 21, 2019
ca554b0
Merge pull request #6798 from dotnet/merges/master-to-release/dev16.2
May 22, 2019
d6da7ce
Merge pull request #6821 from dotnet/merges/master-to-release/dev16.2
May 23, 2019
808f232
Merge pull request #6834 from dotnet/merges/master-to-release/dev16.2
May 24, 2019
6b02b74
Merge pull request #6852 from dotnet/merges/master-to-release/dev16.2
May 25, 2019
cb51737
Merge branch 'release/dev16.2' into merges/master-to-release/dev16.2
KevinRansom May 27, 2019
42c125e
Merge pull request #6878 from dotnet/merges/master-to-release/dev16.2
May 27, 2019
00cbd3f
Fixed uninitialized mutable locals inside loops (#6899)
TIHan May 31, 2019
f96a2f6
Merge branch 'release/dev16.2' into merges/master-to-release/dev16.2
brettfo Jun 1, 2019
c31566c
Merge pull request #6894 from dotnet/merges/master-to-release/dev16.2
Jun 1, 2019
431fdea
Merge pull request #6918 from dotnet/merges/master-to-release/dev16.2
Jun 2, 2019
3de631a
Stop calling GetHierarchy in FSharpProjectOptionsReactor (#6946)
TIHan Jun 6, 2019
3040aa2
Merge pull request #6982 from dotnet/merges/master-to-release/dev16.2
brettfo Jun 12, 2019
bff4fff
don't ship LSP in VS in `release/dev16.2` (#6983)
brettfo Jun 12, 2019
0aeb4a0
Roslyn Shim - Round 2 (#6734)
TIHan Jun 13, 2019
a24d94e
LOC CHECKIN | Microsoft/visualfsharp release/dev16.2 | 20190620 (#7022)
v-zbsail Jun 20, 2019
a67156b
Merge branch 'master' into merges/release/dev16.2-to-master
brettfo Jul 24, 2019
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: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19260.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19262.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>810920cf8a5fc183585304193f8b4e4e189497e9</Sha>
<Sha>30682cda0dd7ca1765463749dd91ec3cfec75eb9</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
3 changes: 3 additions & 0 deletions fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@
<Compile Include="$(FSharpSourcesRoot)/fsharp/QuotationPickler.fs">
<Link>TypedAST/QuotationPickler.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/CompilerGlobalState.fs">
<Link>TypedAST/CompilerGlobalState.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/tast.fs">
<Link>TypedAST/tast.fs</Link>
</Compile>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19260.2",
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19262.1",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
12 changes: 6 additions & 6 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4639,13 +4639,13 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu
match scoref with
| ILScopeRef.Assembly aref -> Some aref
| ILScopeRef.Local | ILScopeRef.Module _ -> error(InternalError("not ILScopeRef.Assembly", rangeStartup)))
fslibCcuInfo.FSharpViewOfMetadata
fslibCcuInfo.FSharpViewOfMetadata

// OK, now we have both mscorlib.dll and FSharp.Core.dll we can create TcGlobals
let tcGlobals = TcGlobals(tcConfig.compilingFslib, ilGlobals, fslibCcu,
tcConfig.implicitIncludeDir, tcConfig.mlCompatibility,
tcConfig.isInteractive, tryFindSysTypeCcu, tcConfig.emitDebugInfoInQuotations,
tcConfig.noDebugData, tcConfig.pathMap)
let tcGlobals = TcGlobals(tcConfig.compilingFslib, ilGlobals, fslibCcu,
tcConfig.implicitIncludeDir, tcConfig.mlCompatibility,
tcConfig.isInteractive, tryFindSysTypeCcu, tcConfig.emitDebugInfoInQuotations,
tcConfig.noDebugData, tcConfig.pathMap)

#if DEBUG
// the global_g reference cell is used only for debug printing
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/CompileOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ val GetInitialTcEnv: assemblyName: string * range * TcConfig * TcImports * TcGlo
[<Sealed>]
/// Represents the incremental type checking state for a set of inputs
type TcState =
member NiceNameGenerator: Ast.NiceNameGenerator
member NiceNameGenerator: NiceNameGenerator

/// The CcuThunk for the current assembly being checked
member Ccu: CcuThunk
Expand All @@ -729,7 +729,7 @@ type TcState =

/// Get the initial type checking state for a set of inputs
val GetInitialTcState:
range * string * TcConfig * TcGlobals * TcImports * Ast.NiceNameGenerator * TcEnv -> TcState
range * string * TcConfig * TcGlobals * TcImports * NiceNameGenerator * TcEnv -> TcState

/// Check one input, returned as an Eventually computation
val TypeCheckOneInputEventually :
Expand Down
16 changes: 7 additions & 9 deletions src/fsharp/CompileOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,17 +1572,17 @@ let ApplyCommandLineArgs(tcConfigB: TcConfigBuilder, sourceFiles: string list, c
//----------------------------------------------------------------------------

let showTermFileCount = ref 0
let PrintWholeAssemblyImplementation (tcConfig:TcConfig) outfile header expr =
let PrintWholeAssemblyImplementation g (tcConfig:TcConfig) outfile header expr =
if tcConfig.showTerms then
if tcConfig.writeTermsToFiles then
let filename = outfile + ".terms"
let n = !showTermFileCount
showTermFileCount := n+1
use f = System.IO.File.CreateText (filename + "-" + string n + "-" + header)
Layout.outL f (Layout.squashTo 192 (DebugPrint.implFilesL expr))
Layout.outL f (Layout.squashTo 192 (DebugPrint.implFilesL g expr))
else
dprintf "\n------------------\nshowTerm: %s:\n" header
Layout.outL stderr (Layout.squashTo 192 (DebugPrint.implFilesL expr))
Layout.outL stderr (Layout.squashTo 192 (DebugPrint.implFilesL g expr))
dprintf "\n------------------\n"

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -1680,13 +1680,13 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM
// Always optimize once - the results of this step give the x-module optimization
// info. Subsequent optimization steps choose representations etc. which we don't
// want to save in the x-module info (i.e. x-module info is currently "high level").
PrintWholeAssemblyImplementation tcConfig outfile "pass-start" implFiles
PrintWholeAssemblyImplementation tcGlobals tcConfig outfile "pass-start" implFiles
#if DEBUG
if tcConfig.showOptimizationData then
dprintf "Expression prior to optimization:\n%s\n" (Layout.showL (Layout.squashTo 192 (DebugPrint.implFilesL implFiles)))
dprintf "Expression prior to optimization:\n%s\n" (Layout.showL (Layout.squashTo 192 (DebugPrint.implFilesL tcGlobals implFiles)))

if tcConfig.showOptimizationData then
dprintf "CCU prior to optimization:\n%s\n" (Layout.showL (Layout.squashTo 192 (DebugPrint.entityL ccu.Contents)))
dprintf "CCU prior to optimization:\n%s\n" (Layout.showL (Layout.squashTo 192 (DebugPrint.entityL tcGlobals ccu.Contents)))
#endif

let optEnv0 = optEnv
Expand Down Expand Up @@ -1768,12 +1768,10 @@ let ApplyAllOptimizations (tcConfig:TcConfig, tcGlobals, tcVal, outfile, importM
let implFiles, implFileOptDatas = List.unzip results
let assemblyOptData = Optimizer.UnionOptimizationInfos implFileOptDatas
let tassembly = TypedAssemblyAfterOptimization implFiles
PrintWholeAssemblyImplementation tcConfig outfile "pass-end" (List.map fst implFiles)
PrintWholeAssemblyImplementation tcGlobals tcConfig outfile "pass-end" (List.map fst implFiles)
ReportTime tcConfig ("Ending Optimizations")

tassembly, assemblyOptData, optEnvFirstLoop


//----------------------------------------------------------------------------
// ILX generation
//----------------------------------------------------------------------------
Expand Down
96 changes: 96 additions & 0 deletions src/fsharp/CompilerGlobalState.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

/// Defines the global environment for all type checking.

namespace FSharp.Compiler

open System.Collections.Generic
open FSharp.Compiler.AbstractIL
open FSharp.Compiler.Range
open FSharp.Compiler.PrettyNaming


/// Generates compiler-generated names. Each name generated also includes the StartLine number of the range passed in
/// at the point of first generation.
///
/// This type may be accessed concurrently, though in practice it is only used from the compilation thread.
/// It is made concurrency-safe since a global instance of the type is allocated in tast.fs, and it is good
/// policy to make all globally-allocated objects concurrency safe in case future versions of the compiler
/// are used to host multiple concurrent instances of compilation.
type NiceNameGenerator() =

let lockObj = obj()
let basicNameCounts = new Dictionary<string, int>(100)

member x.FreshCompilerGeneratedName (name, m: range) =
lock lockObj (fun () ->
let basicName = GetBasicNameOfPossibleCompilerGeneratedName name
let n =
match basicNameCounts.TryGetValue basicName with
| true, count -> count
| _ -> 0
let nm = CompilerGeneratedNameSuffix basicName (string m.StartLine + (match n with 0 -> "" | n -> "-" + string n))
basicNameCounts.[basicName] <- n + 1
nm)

member x.Reset () =
lock lockObj (fun () ->
basicNameCounts.Clear()
)

/// Generates compiler-generated names marked up with a source code location, but if given the same unique value then
/// return precisely the same name. Each name generated also includes the StartLine number of the range passed in
/// at the point of first generation.
///
/// This type may be accessed concurrently, though in practice it is only used from the compilation thread.
/// It is made concurrency-safe since a global instance of the type is allocated in tast.fs.
type StableNiceNameGenerator() =

let lockObj = obj()

let names = new Dictionary<(string * int64), string>(100)
let basicNameCounts = new Dictionary<string, int>(100)

member x.GetUniqueCompilerGeneratedName (name, m: range, uniq) =
lock lockObj (fun () ->
let basicName = GetBasicNameOfPossibleCompilerGeneratedName name
let key = basicName, uniq
match names.TryGetValue key with
| true, nm -> nm
| _ ->
let n =
match basicNameCounts.TryGetValue basicName with
| true, c -> c
| _ -> 0
let nm = CompilerGeneratedNameSuffix basicName (string m.StartLine + (match n with 0 -> "" | n -> "-" + string n))
names.[key] <- nm
basicNameCounts.[basicName] <- n + 1
nm
)

member x.Reset () =
lock lockObj (fun () ->
basicNameCounts.Clear()
names.Clear()
)

type internal CompilerGlobalState () =
/// A global generator of compiler generated names
// ++GLOBAL MUTABLE STATE (concurrency safe by locking inside NiceNameGenerator)
let globalNng = NiceNameGenerator()


/// A global generator of stable compiler generated names
// MUTABLE STATE (concurrency safe by locking inside StableNiceNameGenerator)
let globalStableNameGenerator = StableNiceNameGenerator ()

/// A name generator used by IlxGen for static fields, some generated arguments and other things.
/// REVIEW: this will mean the hosted compiler service is not deterministic. We should at least create a new one
/// of these for each compilation.
let ilxgenGlobalNng = NiceNameGenerator ()

member __.NiceNameGenerator = globalNng

member __.StableNameGenerator = globalStableNameGenerator

member __.IlxGenNiceNameGenerator = ilxgenGlobalNng
7 changes: 5 additions & 2 deletions src/fsharp/DetupleArgs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,11 @@ let mkTransform g (f: Val) m tps x1Ntys rty (callPattern, tyfringes: (TType list
let tys1r = List.collect fst tyfringes (* types for collapsed initial r args *)
let tysrN = List.drop tyfringes.Length x1Ntys (* types for remaining args *)
let argtys = tys1r @ tysrN
let fCty = mkLambdaTy tps argtys rty
let transformedVal = mkLocalVal f.Range (globalNng.FreshCompilerGeneratedName (f.LogicalName, f.Range)) fCty topValInfo
let fCty = mkLambdaTy tps argtys rty
let transformedVal =
// Ensure that we have an g.CompilerGlobalState
assert(g.CompilerGlobalState |> Option.isSome)
mkLocalVal f.Range (g.CompilerGlobalState.Value.NiceNameGenerator.FreshCompilerGeneratedName (f.LogicalName, f.Range)) fCty topValInfo
{ transformCallPattern = callPattern
transformedFormals = transformedFormals
transformedVal = transformedVal }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@
<Compile Include="..\QuotationPickler.fs">
<Link>TypedAST\QuotationPickler.fs</Link>
</Compile>
<Compile Include="..\CompilerGlobalState.fs">
<Link>TypedAST\CompilerGlobalState.fs</Link>
</Compile>
<Compile Include="..\tast.fs">
<Link>TypedAST\tast.fs</Link>
</Compile>
Expand Down
Loading