Skip to content

Commit 5721a21

Browse files
committed
changes
1 parent d82c543 commit 5721a21

4 files changed

Lines changed: 90 additions & 48 deletions

File tree

src/Compiler/Driver/ParseAndCheckInputs.fs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ let AddCheckResultsToTcState
11791179
sw.Stop()
11801180
totalSw.Stop()
11811181
singles <- singles + 1
1182-
printfn $"[{singles}] single add took {sw.ElapsedMilliseconds}ms, total so far: {totalSw.ElapsedMilliseconds}ms"
1182+
printfn $"[{Threading.Thread.CurrentThread.ManagedThreadId}] [{singles}] single add took {sw.ElapsedMilliseconds}ms, total so far: {totalSw.ElapsedMilliseconds}ms"
11831183

11841184
ccuSigForFile, tcState
11851185

@@ -1206,10 +1206,6 @@ let AddDummyCheckResultsToTcState
12061206
type PartialResult = TcEnv * TopAttribs * CheckedImplFile option * ModuleOrNamespaceType
12071207

12081208
type CheckArgs = CompilationThreadToken * (unit -> bool) * TcConfig * TcImports * TcGlobals * LongIdent option * TcState * (PhasedDiagnostic -> PhasedDiagnostic) * ParsedInput list
1209-
/// Use parallel checking of implementation files that have signature files
1210-
let mutable CheckMultipleInputsInParallel2 : CheckArgs -> (PartialResult list * TcState)
1211-
=
1212-
fun _ -> failwith "Dummy implementation"
12131209

12141210
/// Typecheck a single file (or interactive entry into F# Interactive)
12151211
let CheckOneInputAux
@@ -1707,7 +1703,12 @@ let CheckMultipleInputsInParallel
17071703
}
17081704

17091705
results, tcState)
1710-
1706+
1707+
/// Use parallel checking of implementation files that have signature files
1708+
let mutable CheckMultipleInputsInParallel2 : CheckArgs -> (PartialResult list * TcState)
1709+
=
1710+
CheckMultipleInputsInParallel
1711+
17111712
type WorkInput =
17121713
{
17131714
FileIndex : int

tests/FSharp.Compiler.Service.Tests2/FCSArgs.txt

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
-o:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.dll
1+
-o:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.dll
22
-g
33
--debug:embedded
4-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\buildproperties.fs
5-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSComp.fs
6-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSIstrings.fs
7-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\UtilsStrings.fs
8-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.AssemblyInfo.fs
9-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\illex.fs
10-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pplex.fs
11-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\lex.fs
12-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\ilpars.fs
13-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pppars.fs
14-
--embed:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pars.fs
15-
--sourcelink:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.sourcelink.json
16-
--test:ParallelCheckingWithSignatureFilesOn
4+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\buildproperties.fs
5+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSComp.fs
6+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSIstrings.fs
7+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\UtilsStrings.fs
8+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.AssemblyInfo.fs
9+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\illex.fs
10+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pplex.fs
11+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\lex.fs
12+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\ilpars.fs
13+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pppars.fs
14+
--embed:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pars.fs
15+
--sourcelink:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.sourcelink.json
1716
--times
1817
--noframework
1918
--define:TRACE
@@ -32,16 +31,16 @@
3231
--define:NETSTANDARD1_5_OR_GREATER
3332
--define:NETSTANDARD1_6_OR_GREATER
3433
--define:NETSTANDARD2_0_OR_GREATER
35-
--doc:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.xml
34+
--doc:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.xml
3635
--keyfile:C:\Users\janus\.nuget\packages\microsoft.dotnet.arcade.sdk\8.0.0-beta.22512.1\tools\snk/MSFT.snk
3736
--publicsign+
38-
--optimize+
39-
--resource:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSComp.resources
40-
--resource:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSIstrings.resources
41-
--resource:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\UtilsStrings.resources
42-
--resource:C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSStrings.resources
43-
-r:C:\projekty\fsharp\heuristic\artifacts\bin\FSharp.Core\Debug\netstandard2.0\FSharp.Core.dll
44-
-r:C:\projekty\fsharp\heuristic\artifacts\bin\FSharp.DependencyManager.Nuget\Debug\netstandard2.0\FSharp.DependencyManager.Nuget.dll
37+
--optimize-
38+
--resource:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSComp.resources
39+
--resource:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSIstrings.resources
40+
--resource:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\UtilsStrings.resources
41+
--resource:C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSStrings.resources
42+
-r:C:\projekty\fsharp\fsharp_main\artifacts\bin\FSharp.Core\Debug\netstandard2.0\FSharp.Core.dll
43+
-r:C:\projekty\fsharp\fsharp_main\artifacts\bin\FSharp.DependencyManager.Nuget\Debug\netstandard2.0\FSharp.DependencyManager.Nuget.dll
4544
-r:C:\Users\janus\.nuget\packages\microsoft.build.framework\17.4.0-preview-22469-04\ref\netstandard2.0\Microsoft.Build.Framework.dll
4645
-r:C:\Users\janus\.nuget\packages\microsoft.build.tasks.core\17.4.0-preview-22469-04\ref\netstandard2.0\Microsoft.Build.Tasks.Core.dll
4746
-r:C:\Users\janus\.nuget\packages\microsoft.build.utilities.core\17.4.0-preview-22469-04\ref\netstandard2.0\Microsoft.Build.Utilities.Core.dll
@@ -200,13 +199,13 @@
200199
--warnon:3218
201200
--warnon:3390
202201
--simpleresolution
203-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\buildproperties.fs
204-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSComp.fs
205-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSIstrings.fs
206-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\UtilsStrings.fs
207-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.InternalsVisibleTo.fs
208-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.fs
209-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.AssemblyInfo.fs
202+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\buildproperties.fs
203+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSComp.fs
204+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSIstrings.fs
205+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\UtilsStrings.fs
206+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.InternalsVisibleTo.fs
207+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.fs
208+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\FSharp.Compiler.Service.AssemblyInfo.fs
210209
Utilities\sformat.fsi
211210
Utilities\sformat.fs
212211
Utilities\sr.fsi
@@ -276,8 +275,8 @@ AbstractIL\ilx.fsi
276275
AbstractIL\ilx.fs
277276
AbstractIL\ilascii.fsi
278277
AbstractIL\ilascii.fs
279-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\ilpars.fs
280-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\illex.fs
278+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\ilpars.fs
279+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\illex.fs
281280
AbstractIL\ilprint.fsi
282281
AbstractIL\ilprint.fs
283282
AbstractIL\ilmorph.fsi
@@ -312,12 +311,12 @@ SyntaxTree\SyntaxTreeOps.fsi
312311
SyntaxTree\SyntaxTreeOps.fs
313312
SyntaxTree\ParseHelpers.fsi
314313
SyntaxTree\ParseHelpers.fs
315-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pppars.fs
316-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pars.fs
314+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pppars.fs
315+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pars.fs
317316
SyntaxTree\LexHelpers.fsi
318317
SyntaxTree\LexHelpers.fs
319-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pplex.fs
320-
C:\projekty\fsharp\heuristic\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\\lex.fs
318+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\pplex.fs
319+
C:\projekty\fsharp\fsharp_main\artifacts\obj\FSharp.Compiler.Service\Debug\netstandard2.0\\lex.fs
321320
SyntaxTree\LexFilter.fsi
322321
SyntaxTree\LexFilter.fs
323322
TypedTree\tainted.fsi

tests/FSharp.Compiler.Service.Tests2/ParallelTypeChecking.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ open FSharp.Compiler.Syntax
1818
open FSharp.Compiler.TcGlobals
1919
open FSharp.Compiler.TypedTree
2020
open Internal.Utilities.Library
21+
open Newtonsoft.Json
2122

2223
type FileGraph = Graph<File>
2324

@@ -82,6 +83,11 @@ module internal Real =
8283
)
8384
let graph = DepResolving.AutomatedDependencyResolving.detectFileDependencies sourceFiles
8485

86+
let graphJson = graph.Graph |> Seq.map (fun (KeyValue(file, deps)) -> file.Name, deps |> Array.map (fun d -> d.Name)) |> dict
87+
let json = JsonConvert.SerializeObject(graphJson, Formatting.Indented)
88+
let path = $"c:/projekty/fsharp/heuristic/FCS.deps.json"
89+
System.IO.File.WriteAllText(path, json)
90+
8591
let _ = ctok // TODO Use
8692
let diagnosticsLogger = DiagnosticsThreadStatics.DiagnosticsLogger
8793

tests/FSharp.Compiler.Service.Tests2/Program.fs

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,49 @@ let runCompiler () =
88
Environment.CurrentDirectory <- "c:/projekty/fsharp/heuristic/src/Compiler"
99
RunCompiler.runCompiler()
1010

11+
type Method =
12+
| Sequential
13+
| ParallelFs
14+
| Graph
15+
1116
[<EntryPoint>]
12-
let main _ =
13-
//runCompiler ()
14-
//TestDepResolving.TestHardcodedFiles()
15-
//TestDepResolving.TestProject(@"C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj")
16-
//TestDepResolving.TestProject(@"C:\projekty\fsharp\fsharp_main\src\Compiler\FSharp.Compiler.Service.fsproj")
17-
ParseAndCheckInputs.CheckMultipleInputsInParallel2 <- ParallelTypeChecking.Real.CheckMultipleInputsInParallelMy
18-
let args = System.IO.File.ReadAllLines(@"C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.Service.Tests2\DiamondArgs.txt")
17+
let main argv =
18+
//let args = System.IO.File.ReadAllLines(@"C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.Service.Tests2\DiamondArgs.txt")
19+
20+
let parseMode (mode : string) =
21+
match mode.ToLower() with
22+
| "sequential" -> Method.Sequential
23+
| "parallelfs" -> Method.ParallelFs
24+
| "graph" -> Method.Graph
25+
| _ -> failwith $"Unrecognised method: {mode}"
26+
27+
let path, mode, workingDir =
28+
match argv with
29+
| [|path|] ->
30+
path, Method.Sequential, None
31+
| [|path; mode|] ->
32+
path, parseMode mode, None
33+
| [|path; mode; workingDir|] ->
34+
path, parseMode mode, Some workingDir
35+
| _ -> failwith "Invalid args - use 'args_path [fs-parallel]"
36+
37+
printfn $"WorkingDir = {workingDir}"
38+
39+
let args = System.IO.File.ReadAllLines(path)
40+
41+
let args =
42+
match mode with
43+
| Method.Sequential ->
44+
args
45+
| Method.ParallelFs ->
46+
printfn "Using fsParallel"
47+
Array.append args [|"--test:ParallelCheckingWithSignatureFilesOn"|]
48+
| Method.Graph ->
49+
printfn "Using graph"
50+
ParseAndCheckInputs.CheckMultipleInputsInParallel2 <- ParallelTypeChecking.Real.CheckMultipleInputsInParallelMy
51+
Array.append args [|"--test:ParallelCheckingWithSignatureFilesOn"|]
52+
53+
workingDir |> Option.iter (fun dir -> Environment.CurrentDirectory <- dir)
54+
1955
let exit = CommandLineMain.main args
2056
exit

0 commit comments

Comments
 (0)