Skip to content

Commit 3991b48

Browse files
committed
[Dependency Scanning] Remove coarse-grained synchronization on all dependency scan queries
In the `InterModuleDependencyOracle`, which may be shared across different instances of the `Driver`, all dependency scanning queries are executed synchronously on a shared dispatch queue. This is no longer necessary with the scanner guarding its own shared state as of swiftlang/swift#64615.
1 parent 40a45ec commit 3991b48

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/InterModuleDependencies/InterModuleDependencyOracle.swift

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ public class InterModuleDependencyOracle {
4747
commandLine: [String])
4848
throws -> InterModuleDependencyGraph {
4949
precondition(hasScannerInstance)
50-
return try queue.sync {
51-
return try swiftScanLibInstance!.scanDependencies(workingDirectory: workingDirectory,
52-
moduleAliases: moduleAliases,
53-
invocationCommand: commandLine)
54-
}
50+
return try swiftScanLibInstance!.scanDependencies(workingDirectory: workingDirectory,
51+
moduleAliases: moduleAliases,
52+
invocationCommand: commandLine)
5553
}
5654

5755
@_spi(Testing) public func getBatchDependencies(workingDirectory: AbsolutePath,
@@ -60,24 +58,20 @@ public class InterModuleDependencyOracle {
6058
batchInfos: [BatchScanModuleInfo])
6159
throws -> [ModuleDependencyId: [InterModuleDependencyGraph]] {
6260
precondition(hasScannerInstance)
63-
return try queue.sync {
64-
return try swiftScanLibInstance!.batchScanDependencies(workingDirectory: workingDirectory,
65-
moduleAliases: moduleAliases,
66-
invocationCommand: commandLine,
67-
batchInfos: batchInfos)
68-
}
61+
return try swiftScanLibInstance!.batchScanDependencies(workingDirectory: workingDirectory,
62+
moduleAliases: moduleAliases,
63+
invocationCommand: commandLine,
64+
batchInfos: batchInfos)
6965
}
7066

7167
@_spi(Testing) public func getImports(workingDirectory: AbsolutePath,
7268
moduleAliases: [String: String]? = nil,
7369
commandLine: [String])
7470
throws -> InterModuleDependencyImports {
7571
precondition(hasScannerInstance)
76-
return try queue.sync {
77-
return try swiftScanLibInstance!.preScanImports(workingDirectory: workingDirectory,
78-
moduleAliases: moduleAliases,
79-
invocationCommand: commandLine)
80-
}
72+
return try swiftScanLibInstance!.preScanImports(workingDirectory: workingDirectory,
73+
moduleAliases: moduleAliases,
74+
invocationCommand: commandLine)
8175
}
8276

8377
/// Given a specified toolchain path, locate and instantiate an instance of the SwiftScan library

0 commit comments

Comments
 (0)