зеркало из https://github.com/dotnet/fsharp.git
Enable parallel compilation features for users of LangVersion=preview (#17948)
This commit is contained in:
Родитель
ab3c936a7a
Коммит
26edc075d9
|
@ -18,8 +18,8 @@
|
|||
<NullCheckingSupportInLibrary>false</NullCheckingSupportInLibrary>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' != 'Proto' and '$(BUILDING_USING_DOTNET)' != 'true'">
|
||||
<OtherFlags>$(OtherFlags) /langversion:preview</OtherFlags>
|
||||
<PropertyGroup Condition="'$(Configuration)' != 'Proto' and '$(BUILDING_USING_DOTNET)' != 'true' and '$(MSBuildProjectExtension)' == '.fsproj'"> <!-- VB.NET does not understand "preview". It only knows "old","older" and "boomer" :-)) (jk)-->
|
||||
<LangVersion>preview</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* Deprecate places where `seq` can be omitted. ([Language suggestion #1033](https://github.com/fsharp/fslang-suggestions/issues/1033), [PR #17772](https://github.com/dotnet/fsharp/pull/17772))
|
||||
* Support literal attribute on decimals ([PR #17769](https://github.com/dotnet/fsharp/pull/17769))
|
||||
* Added type conversions cache, only enabled for compiler runs, guarded by language version preview ([PR#17668](https://github.com/dotnet/fsharp/pull/17668))
|
||||
* Added project property ParallelCompilation which turns on graph based type checking, parallel ILXGen and parallel optimization. By default on for users of langversion=preview ([PR#17948](https://github.com/dotnet/fsharp/pull/17948))
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -566,7 +566,7 @@ type TcConfigBuilder =
|
|||
mutable optSettings: Optimizer.OptimizationSettings
|
||||
mutable emitTailcalls: bool
|
||||
mutable deterministic: bool
|
||||
mutable concurrentBuild: bool
|
||||
mutable parallelParsing: bool
|
||||
mutable parallelIlxGen: bool
|
||||
mutable emitMetadataAssembly: MetadataAssemblyGeneration
|
||||
mutable preferredUiLang: string option
|
||||
|
@ -817,7 +817,7 @@ type TcConfigBuilder =
|
|||
}
|
||||
emitTailcalls = true
|
||||
deterministic = false
|
||||
concurrentBuild = true
|
||||
parallelParsing = true
|
||||
parallelIlxGen = FSharpExperimentalFeaturesEnabledAutomatically
|
||||
emitMetadataAssembly = MetadataAssemblyGeneration.None
|
||||
preferredUiLang = None
|
||||
|
@ -1380,7 +1380,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
|
|||
member _.optSettings = data.optSettings
|
||||
member _.emitTailcalls = data.emitTailcalls
|
||||
member _.deterministic = data.deterministic
|
||||
member _.concurrentBuild = data.concurrentBuild
|
||||
member _.parallelParsing = data.parallelParsing
|
||||
member _.parallelIlxGen = data.parallelIlxGen
|
||||
member _.emitMetadataAssembly = data.emitMetadataAssembly
|
||||
member _.pathMap = data.pathMap
|
||||
|
|
|
@ -435,7 +435,7 @@ type TcConfigBuilder =
|
|||
|
||||
mutable deterministic: bool
|
||||
|
||||
mutable concurrentBuild: bool
|
||||
mutable parallelParsing: bool
|
||||
|
||||
mutable parallelIlxGen: bool
|
||||
|
||||
|
@ -771,7 +771,7 @@ type TcConfig =
|
|||
|
||||
member deterministic: bool
|
||||
|
||||
member concurrentBuild: bool
|
||||
member parallelParsing: bool
|
||||
|
||||
member parallelIlxGen: bool
|
||||
|
||||
|
|
|
@ -622,6 +622,26 @@ let splittingSwitch (tcConfigB: TcConfigBuilder) switch =
|
|||
let callVirtSwitch (tcConfigB: TcConfigBuilder) switch =
|
||||
tcConfigB.alwaysCallVirt <- switch = OptionSwitch.On
|
||||
|
||||
let callParallelCompilationSwitch (tcConfigB: TcConfigBuilder) switch =
|
||||
tcConfigB.parallelIlxGen <- switch = OptionSwitch.On
|
||||
|
||||
let (graphCheckingMode, optMode) =
|
||||
match switch with
|
||||
| OptionSwitch.On -> TypeCheckingMode.Graph, OptimizationProcessingMode.Parallel
|
||||
| OptionSwitch.Off -> TypeCheckingMode.Sequential, OptimizationProcessingMode.Sequential
|
||||
|
||||
if tcConfigB.typeCheckingConfig.Mode <> graphCheckingMode then
|
||||
tcConfigB.typeCheckingConfig <-
|
||||
{ tcConfigB.typeCheckingConfig with
|
||||
Mode = graphCheckingMode
|
||||
}
|
||||
|
||||
if tcConfigB.optSettings.processingMode <> optMode then
|
||||
tcConfigB.optSettings <-
|
||||
{ tcConfigB.optSettings with
|
||||
processingMode = optMode
|
||||
}
|
||||
|
||||
let useHighEntropyVASwitch (tcConfigB: TcConfigBuilder) switch =
|
||||
tcConfigB.useHighEntropyVA <- switch = OptionSwitch.On
|
||||
|
||||
|
@ -1365,9 +1385,9 @@ let testFlag tcConfigB =
|
|||
| "DumpDebugInfo" -> tcConfigB.dumpDebugInfo <- true
|
||||
| "ShowLoadedAssemblies" -> tcConfigB.showLoadedAssemblies <- true
|
||||
| "ContinueAfterParseFailure" -> tcConfigB.continueAfterParseFailure <- true
|
||||
| "ParallelOff" -> tcConfigB.concurrentBuild <- false
|
||||
| "ParallelIlxGen" -> tcConfigB.parallelIlxGen <- true
|
||||
| "GraphBasedChecking" ->
|
||||
| "ParallelOff" -> tcConfigB.parallelParsing <- false
|
||||
| "ParallelIlxGen" -> tcConfigB.parallelIlxGen <- true // Kept as --test:.. flag for temporary backwards compatibility during .NET10 period.
|
||||
| "GraphBasedChecking" -> // Kept as --test:.. flag for temporary backwards compatibility during .NET10 period.
|
||||
tcConfigB.typeCheckingConfig <-
|
||||
{ tcConfigB.typeCheckingConfig with
|
||||
Mode = TypeCheckingMode.Graph
|
||||
|
@ -1378,7 +1398,7 @@ let testFlag tcConfigB =
|
|||
DumpGraph = true
|
||||
}
|
||||
| "DumpSignatureData" -> tcConfigB.dumpSignatureData <- true
|
||||
| "ParallelOptimization" ->
|
||||
| "ParallelOptimization" -> // Kept as --test:.. flag for temporary backwards compatibility during .NET10 period.
|
||||
tcConfigB.optSettings <-
|
||||
{ tcConfigB.optSettings with
|
||||
processingMode = OptimizationProcessingMode.Parallel
|
||||
|
@ -1692,6 +1712,14 @@ let internalFlags (tcConfigB: TcConfigBuilder) =
|
|||
None
|
||||
)
|
||||
|
||||
CompilerOption(
|
||||
"parallelcompilation",
|
||||
tagNone,
|
||||
OptionSwitch(callParallelCompilationSwitch tcConfigB),
|
||||
Some(InternalCommandLineOption("--parallelcompilation", rangeCmdArgs)),
|
||||
None
|
||||
)
|
||||
|
||||
testFlag tcConfigB
|
||||
]
|
||||
@
|
||||
|
|
|
@ -853,7 +853,7 @@ let ParseInputFilesSequential (tcConfig: TcConfig, lexResourceManager, sourceFil
|
|||
/// Parse multiple input files from disk
|
||||
let ParseInputFiles (tcConfig: TcConfig, lexResourceManager, sourceFiles, diagnosticsLogger: DiagnosticsLogger, retryLocked) =
|
||||
try
|
||||
if tcConfig.concurrentBuild then
|
||||
if tcConfig.parallelParsing then
|
||||
ParseInputFilesInParallel(tcConfig, lexResourceManager, sourceFiles, diagnosticsLogger, retryLocked)
|
||||
else
|
||||
ParseInputFilesSequential(tcConfig, lexResourceManager, sourceFiles, diagnosticsLogger, retryLocked)
|
||||
|
|
|
@ -49,6 +49,7 @@ type public Fsc() as this =
|
|||
let mutable otherFlags: string MaybeNull = null
|
||||
let mutable outputAssembly: string MaybeNull = null
|
||||
let mutable outputRefAssembly: string MaybeNull = null
|
||||
let mutable parallelCompilation: bool option = None
|
||||
let mutable pathMap: string MaybeNull = null
|
||||
let mutable pdbFile: string MaybeNull = null
|
||||
let mutable platform: string MaybeNull = null
|
||||
|
@ -202,6 +203,7 @@ type public Fsc() as this =
|
|||
if not tailcalls then
|
||||
builder.AppendSwitch("--tailcalls-")
|
||||
|
||||
// Nullables
|
||||
match nullable with
|
||||
| Some true ->
|
||||
builder.AppendSwitch("--checknulls+")
|
||||
|
@ -345,6 +347,8 @@ type public Fsc() as this =
|
|||
if deterministic then
|
||||
builder.AppendSwitch("--deterministic+")
|
||||
|
||||
builder.AppendOptionalSwitch("--parallelcompilation", parallelCompilation)
|
||||
|
||||
// OtherFlags - must be second-to-last
|
||||
builder.AppendSwitchUnquotedIfNotNull("", otherFlags)
|
||||
capturedArguments <- builder.CapturedArguments()
|
||||
|
@ -504,6 +508,10 @@ type public Fsc() as this =
|
|||
with get () = outputRefAssembly
|
||||
and set (s) = outputRefAssembly <- s
|
||||
|
||||
member _.ParallelCompilation
|
||||
with get () = parallelCompilation |> Option.defaultValue false
|
||||
and set (p) = parallelCompilation <- Some p
|
||||
|
||||
// --pathmap <string>: Paths to rewrite when producing deterministic builds
|
||||
member _.PathMap
|
||||
with get () = pathMap
|
||||
|
|
|
@ -50,6 +50,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
|
|||
<UseStandardResourceNames Condition=" '$(UseStandardResourceNames)' == '' ">true</UseStandardResourceNames>
|
||||
<FsiExec Condition=" '$(FsiExec)' == '' ">true</FsiExec>
|
||||
<ReflectionFree Condition=" '$(ReflectionFree)' == '' ">false</ReflectionFree>
|
||||
<ParallelCompilation Condition=" '$(ParallelCompilation)' == '' and '$(LangVersion)' == 'preview' "></ParallelCompilation> <!-- Default to parallel compilation for preview language users before it is rolled out to everyone -->
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- BinaryFormatter is disabled (warning is treated as error) by default in .NET8+, this mirroring the change in SDK (https://github.com/dotnet/sdk/pull/31591) -->
|
||||
|
|
|
@ -380,6 +380,7 @@ this file.
|
|||
OtherFlags="$(FscOtherFlags)"
|
||||
OutputAssembly="@(IntermediateAssembly)"
|
||||
OutputRefAssembly="@(IntermediateRefAssembly)"
|
||||
ParallelCompilation="@(ParallelCompilation)"
|
||||
PathMap="$(PathMap)"
|
||||
PdbFile="$(PdbFile)"
|
||||
Platform="$(PlatformTarget)"
|
||||
|
|
Загрузка…
Ссылка в новой задаче