Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Parallel type checking for impl files with backing sig files - fsc.exe #11152

Closed
wants to merge 28 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d238d25
Enabling parallel parsing for compiling
TIHan Feb 23, 2021
9724f27
Using a delayed error logger per parsing file
TIHan Feb 23, 2021
53f234a
Added -parallel option
TIHan Feb 24, 2021
bf07e86
Fixing error logger
TIHan Feb 24, 2021
4b7c652
Moved parallel compiler option to be a test option
TIHan Feb 25, 2021
d2198df
Trying to get tests to pass
TIHan Feb 25, 2021
d4ad54c
Remove switch
TIHan Feb 25, 2021
23d81e3
Minor refactor
TIHan Feb 25, 2021
3f32f7d
More refactoring
TIHan Feb 25, 2021
03c8b8a
Add comment
TIHan Feb 25, 2021
51c897b
Initial work for parallel type checking
TIHan Feb 25, 2021
d3c674d
Minor refactor
TIHan Feb 26, 2021
20f285e
Add max
TIHan Feb 26, 2021
f40de5b
Merge branch 'parallel-parsing-2' into parallel-type-checking
TIHan Feb 26, 2021
6b06c3a
Some cleanup
TIHan Feb 26, 2021
c6c54b9
do not use SkipImpl
TIHan Feb 26, 2021
0f39ad4
minor refactor
TIHan Feb 26, 2021
fa5d394
Merged main
TIHan Feb 26, 2021
1236cbf
Merge branch 'parallel-parsing-2' into parallel-type-checking
TIHan Feb 26, 2021
5c5a466
Handling aggregate exceptions from ArrayParallel. Using try/finally t…
TIHan Mar 2, 2021
20e5263
Merge branch 'parallel-parsing-2' into parallel-type-checking
TIHan Mar 2, 2021
e5fa18b
Merged main
TIHan Mar 3, 2021
8b419b3
Merging main
TIHan Mar 4, 2021
311d436
Fix build
TIHan Mar 5, 2021
18cb076
merging
TIHan May 10, 2021
fee99c6
Merging main
TIHan Nov 4, 2021
4fe0f71
Fixing build
TIHan Nov 4, 2021
a3d39b2
Merge remote-tracking branch 'upstream/main' into parallel-type-checking
vzarytovskii Nov 25, 2021
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
Prev Previous commit
Next Next commit
Fixing build
TIHan committed Nov 4, 2021
commit 4fe0f71120b9cc7b59dd32692a9dcff7666deb81
16 changes: 8 additions & 8 deletions src/fsharp/ParseAndCheckInputs.fs
Original file line number Diff line number Diff line change
@@ -949,7 +949,7 @@ let TypeCheckOneInput(checkForErrors,
}

/// Typecheck a single file (or interactive entry into F# Interactive)
let TypeCheckOneInputEntry (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp skipImplIfSigExists =
let TypeCheckOneInputEntryAux (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp skipImplIfSigExists =
// 'use' ensures that the warning handler is restored at the end
use unwindEL = PushErrorLoggerPhaseUntilUnwind(fun oldLogger -> GetErrorLoggerFilteringByScopedPragmas(false, GetScopedPragmasForInput inp, oldLogger) )
use unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.TypeCheck
@@ -959,12 +959,12 @@ let TypeCheckOneInputEntry (ctok, checkForErrors, tcConfig, tcImports, tcGlobals
|> Cancellable.runWithoutCancellation

/// Typecheck a single file (or interactive entry into F# Interactive)
let TypeCheckOneInput (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp =
TypeCheckOneInputEntry(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp false
let TypeCheckOneInputEntry (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp =
TypeCheckOneInputEntryAux(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp false

/// Typecheck a single file but skip it if the file is an impl and has a backing sig
let TypeCheckOneInputSkipImpl (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp =
TypeCheckOneInputEntry(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp true
let TypeCheckOneInputEntrySkipImpl (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp =
TypeCheckOneInputEntryAux(ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState inp true

/// Finish checking multiple files (or one interactive entry into F# Interactive)
let TypeCheckMultipleInputsFinish(results, tcState: TcState) =
@@ -999,7 +999,7 @@ let TypeCheckClosedInputSet (ctok, checkForErrors, tcConfig: TcConfig, tcImports
// tcEnvAtEndOfLastFile is the environment required by fsi.exe when incrementally adding definitions
let results, tcState =
if tcConfig.concurrentBuild then
let results, tcState = (tcState, inputs) ||> List.mapFold (TypeCheckOneInputSkipImpl (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt))
let results, tcState = (tcState, inputs) ||> List.mapFold (TypeCheckOneInputEntrySkipImpl (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt))

let inputs = Array.ofList inputs
let newResults = Array.ofList results
@@ -1020,13 +1020,13 @@ let TypeCheckClosedInputSet (ctok, checkForErrors, tcConfig: TcConfig, tcImports
|> Array.choose id
|> ArrayParallel.iter (fun (i, input, qualifiedNameOfFile) ->
dsyme marked this conversation as resolved.
Show resolved Hide resolved
let tcState = tcState.RemoveImpl(qualifiedNameOfFile)
let result, _ = TypeCheckOneInput (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState input
let result, _ = TypeCheckOneInputEntry (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt) tcState input
newResults.[i] <- result
)

newResults |> List.ofArray, tcState
else
(tcState, inputs) ||> List.mapFold (TypeCheckOneInput (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt))
(tcState, inputs) ||> List.mapFold (TypeCheckOneInputEntry (ctok, checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt))

let (tcEnvAtEndOfLastFile, topAttrs, implFiles, _), tcState = TypeCheckMultipleInputsFinish(results, tcState)
let tcState, declaredImpls, ccuContents = TypeCheckClosedInputSetFinish (implFiles, tcState)