Skip to content

Commit 30e48aa

Browse files
authored
Merge pull request #1327 from artemcm/59NoCoarseDepScanSync
[5.9][🍒][Dependency Scanning] Remove coarse-grained synchronization on all dependency scan queries
2 parents f602d24 + 665e8b9 commit 30e48aa

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
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

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
996996
"-I", stdLibPath.nativePathString(escaped: true),
997997
"-I", shimsPath.nativePathString(escaped: true),
998998
"-F", frameworksPath.nativePathString(escaped: true),
999-
"-import-objc-header",
1000999
"-explicit-module-build",
10011000
"-module-name", "main",
10021001
"-working-directory", path.nativePathString(escaped: true),
@@ -1193,7 +1192,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
11931192
"-I", swiftModuleInterfacesPath.nativePathString(escaped: true),
11941193
"-I", stdlibPath.nativePathString(escaped: true),
11951194
"-I", shimsPath.nativePathString(escaped: true),
1196-
"-import-objc-header",
11971195
"-explicit-module-build",
11981196
"-working-directory", path.nativePathString(escaped: true),
11991197
"-disable-clang-target",
@@ -1265,7 +1263,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
12651263
"-I", stdlibPath.nativePathString(escaped: true),
12661264
"-I", shimsPath.nativePathString(escaped: true),
12671265
"/tmp/Foo.o",
1268-
"-import-objc-header",
12691266
"-explicit-module-build",
12701267
"-working-directory", path.nativePathString(escaped: true),
12711268
"-disable-clang-target",
@@ -1303,7 +1300,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
13031300
DispatchQueue.concurrentPerform(iterations: 20) { index in
13041301
// Give the main modules different names
13051302
let iterationCommand = scannerCommand + ["-module-name",
1306-
"testDependencyScanning\(index)"]
1303+
"testDependencyScanning\(index)",
1304+
// FIXME: We need to differentiate the scanning action hash,
1305+
// though the module-name above should be sufficient.
1306+
"-I/tmp/foo/bar/\(index)"]
13071307
let dependencyGraph =
13081308
try! dependencyOracle.getDependencies(workingDirectory: path,
13091309
commandLine: iterationCommand)
@@ -1458,7 +1458,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
14581458
"-I", swiftModuleInterfacesPath.nativePathString(escaped: true),
14591459
"-I", stdlibPath.nativePathString(escaped: true),
14601460
"-I", shimsPath.nativePathString(escaped: true),
1461-
"-import-objc-header",
14621461
"-explicit-module-build",
14631462
"-working-directory", path.nativePathString(escaped: true),
14641463
"-disable-clang-target",

0 commit comments

Comments
 (0)