Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae55828

Browse files
authored
Merge pull request #4007 from auduchinok/deduplicate-name-concurrent
Use ConcurrentDictionary in deduplicate names
2 parents27923d4 +33a94a1 commitae55828

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

‎src/fsharp/CompileOps.fs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
moduleinternalMicrosoft.FSharp.Compiler.CompileOps
55

66
openSystem
7+
openSystem.Collections.Concurrent
8+
openSystem.Collections.Generic
79
openSystem.Diagnostics
8-
openSystem.Text
910
openSystem.IO
10-
openSystem.Collections.Generic
1111
openSystem.Runtime.CompilerServices
12+
openSystem.Text
1213

1314
openInternal.Utilities
1415
openInternal.Utilities.Text
@@ -3509,14 +3510,14 @@ let PostParseModuleSpecs (defaultNamespace, filename, isLastCompiland, ParsedSig
35093510
ParsedInput.SigFile(ParsedSigFileInput(filename, qualName, scopedPragmas, hashDirectives, specs))
35103511

35113512
/// Checks if a module name is already given and deduplicates the name if needed.
3512-
letDeduplicateModuleName(moduleNamesDict:Dictionary<string,Set<string>>)(paths:Set<string>)path(qualifiedNameOfFile:QualifiedNameOfFile)=
3513+
letDeduplicateModuleName(moduleNamesDict:IDictionary<string,Set<string>>)(paths:Set<string>)path(qualifiedNameOfFile:QualifiedNameOfFile)=
35133514
letcount=if paths.Contains paththen paths.Countelse paths.Count+1
35143515
moduleNamesDict.[qualifiedNameOfFile.Text]<- Set.add path paths
35153516
letid= qualifiedNameOfFile.Id
35163517
if count=1then qualifiedNameOfFileelse QualifiedNameOfFile(Ident(id.idText+"___"+ count.ToString(), id.idRange))
35173518

35183519
/// Checks if a ParsedInput is using a module name that was already given and deduplicates the name if needed.
3519-
letDeduplicateParsedInputModuleName(moduleNamesDict:Dictionary<string,Set<string>>)input=
3520+
letDeduplicateParsedInputModuleName(moduleNamesDict:IDictionary<string,Set<string>>)input=
35203521
match inputwith
35213522
| ParsedInput.ImplFile(ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules,(isLastCompiland, isExe)))->
35223523
letpath= Path.GetDirectoryName fileName
@@ -3525,7 +3526,7 @@ let DeduplicateParsedInputModuleName (moduleNamesDict:Dictionary<string, Set<str
35253526
letqualifiedNameOfFile= DeduplicateModuleName moduleNamesDict paths path qualifiedNameOfFile
35263527
ParsedInput.ImplFile(ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules,(isLastCompiland, isExe)))
35273528
|_->
3528-
moduleNamesDict.Add(qualifiedNameOfFile.Text,Set.singleton path)
3529+
moduleNamesDict.[qualifiedNameOfFile.Text]<-Set.singleton path
35293530
input
35303531
| ParsedInput.SigFile(ParsedSigFileInput.ParsedSigFileInput(fileName, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules))->
35313532
letpath= Path.GetDirectoryName fileName
@@ -3534,7 +3535,7 @@ let DeduplicateParsedInputModuleName (moduleNamesDict:Dictionary<string, Set<str
35343535
letqualifiedNameOfFile= DeduplicateModuleName moduleNamesDict paths path qualifiedNameOfFile
35353536
ParsedInput.SigFile(ParsedSigFileInput.ParsedSigFileInput(fileName, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules))
35363537
|_->
3537-
moduleNamesDict.Add(qualifiedNameOfFile.Text,Set.singleton path)
3538+
moduleNamesDict.[qualifiedNameOfFile.Text]<-Set.singleton path
35383539
input
35393540

35403541
letParseInput(lexer,errorLogger:ErrorLogger,lexbuf:UnicodeLexing.Lexbuf,defaultNamespace,filename,isLastCompiland)=

‎src/fsharp/CompileOps.fsi‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ val ComputeQualifiedNameOfFileFromUniquePath: range * string list -> Ast.Qualifi
6565
val PrependPathToInput: Ast.Ident list-> Ast.ParsedInput-> Ast.ParsedInput
6666

6767
/// Checks if a module name is already given and deduplicates the name if needed.
68-
val DeduplicateModuleName:Dictionary<string,Set<string>>-> Set<string>-> string-> Ast.QualifiedNameOfFile-> Ast.QualifiedNameOfFile
68+
val DeduplicateModuleName:IDictionary<string,Set<string>>-> Set<string>-> string-> Ast.QualifiedNameOfFile-> Ast.QualifiedNameOfFile
6969

7070
/// Checks if a ParsedInput is using a module name that was already given and deduplicates the name if needed.
71-
val DeduplicateParsedInputModuleName:Dictionary<string,Set<string>>-> Ast.ParsedInput-> Ast.ParsedInput
71+
val DeduplicateParsedInputModuleName:IDictionary<string,Set<string>>-> Ast.ParsedInput-> Ast.ParsedInput
7272

7373
val ParseInput:(UnicodeLexing.Lexbuf-> Parser.token)* ErrorLogger* UnicodeLexing.Lexbuf* string option* string* isLastCompiland:(bool* bool)-> Ast.ParsedInput
7474

‎src/fsharp/fsc.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
moduleinternalMicrosoft.FSharp.Compiler.Driver
1414

1515
openSystem
16+
openSystem.Collections.Concurrent
1617
openSystem.Collections.Generic
1718
openSystem.Diagnostics
1819
openSystem.Globalization
@@ -1758,7 +1759,7 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, openBinarie
17581759

17591760
letinputs=
17601761
// Deduplicate module names
1761-
letmoduleNamesDict=Dictionary<string,Set<string>>()
1762+
letmoduleNamesDict=ConcurrentDictionary<string,Set<string>>()
17621763
inputs
17631764
|> List.map(fun(input,x)-> DeduplicateParsedInputModuleName moduleNamesDict input,x)
17641765

‎src/fsharp/vs/IncrementalBuild.fs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ namespace Microsoft.FSharp.Compiler
44

55

66
openSystem
7-
openSystem.IO
7+
openSystem.Collections.Concurrent
88
openSystem.Collections.Generic
9+
openSystem.IO
910
openSystem.Threading
1011
openMicrosoft.FSharp.Compiler
1112
openMicrosoft.FSharp.Compiler.NameResolution
@@ -1239,7 +1240,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput
12391240
cache.GetFileTimeStamp filename
12401241

12411242
// Deduplicate module names
1242-
letmoduleNamesDict=Dictionary<string, Set<string>>()
1243+
letmoduleNamesDict=ConcurrentDictionary<string, Set<string>>()
12431244

12441245
/// This is a build task function that gets placed into the build rules as the computation for a VectorMap
12451246
///

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp