Skip to content

Commit b115874

Browse files
author
David Ungar
committed
batch 1st wave
1 parent 009aa5c commit b115874

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Sources/SwiftDriver/Incremental Compilation/IncrementalCompilationState.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,26 +366,31 @@ extension IncrementalCompilationState {
366366
/// Remember a job (group) that is before a compile or a compile itself.
367367
/// (A group also includes the "backend" jobs for bitcode.)
368368
/// Decide if a job can be skipped, and register accordingly
369-
func addPreOrCompileJobGroups(_ groups: [[Job]]) {
369+
func addPreOrCompileJobGroups(_ groups: [[Job]],
370+
formBatchedJobs: ([Job]) throws -> [Job]
371+
) throws {
370372
for group in groups {
371373
if let firstJob = group.first, isSkipped(firstJob) {
372374
recordSkippedGroup(group)
373375
}
374376
else {
375-
scheduleMandatoryPreOrCompile(group: group)
377+
try scheduleMandatoryPreOrCompile(group: group, formBatchedJobs: formBatchedJobs)
376378
}
377379
}
378380
}
379381

380382
/// Remember that `group` (a compilation and possibly bitcode generation)
381383
/// must definitely be executed.
382-
private func scheduleMandatoryPreOrCompile(group: [Job]) {
384+
private func scheduleMandatoryPreOrCompile(
385+
group: [Job],
386+
formBatchedJobs: ([Job]) throws -> [Job]
387+
) throws {
383388
if let report = reportIncrementalDecision {
384389
for job in group {
385390
report("Queuing \(job.descriptionForLifecycle)", nil)
386391
}
387392
}
388-
mandatoryPreOrCompileJobsInOrder.append(contentsOf: group)
393+
mandatoryPreOrCompileJobsInOrder.append(contentsOf: try formBatchedJobs(group))
389394
unfinishedMandatoryJobs.formUnion(group)
390395
let mandantoryCompilationInputs = group
391396
.flatMap {$0.kind == .compile ? $0.primaryInputs : []}

Sources/SwiftDriver/Jobs/Planning.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ extension Driver {
6767
debugInfo: debugInfo,
6868
addJob: addPostCompileJob)
6969

70-
incrementalCompilationState?.addPreOrCompileJobGroups(preAndCompileJobGroups)
70+
try incrementalCompilationState?.addPreOrCompileJobGroups(preAndCompileJobGroups) {
71+
try formBatchedJobs($0, forIncremental: true)
72+
}
7173
incrementalCompilationState?.addPostCompileJobs(postCompileJobs)
7274

7375
return try formBatchedJobs(allJobs, forIncremental: false)

0 commit comments

Comments
 (0)