Skip to content

Commit 3463451

Browse files
author
David Ungar
committed
More fixes.
1 parent 6823b93 commit 3463451

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

include/swift/Driver/DependencyGraph.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,6 @@ class DependencyGraphImpl {
121121
llvm::StringMap<std::pair<std::vector<DependencyEntryTy>, DependencyMaskTy>> Dependencies;
122122

123123
/// The set of marked nodes.
124-
/// "Marked" means that everything provided by this node (i.e. Job) is
125-
/// dirty. Thus any file using any of these provides must be recompiled.
126-
/// (Only non-private entities are output as provides.)
127-
/// In other words, this Job "cascades"; the need to recompile it causes other
128-
/// recompilations. It is possible that the current code marks things that do
129-
/// not need to be marked. Nothing would break if that were the case.
130124

131125
llvm::SmallPtrSet<const void *, 16> Marked;
132126

@@ -263,7 +257,7 @@ class DependencyGraph : public DependencyGraphImpl {
263257
/// Marks \p node and all nodes that depend on \p node, and places any nodes
264258
/// that get transitively marked into \p visited.
265259
///
266-
/// Nodes that have been previously marked are not included in \p newlyMarked,
260+
/// Nodes that have been previously marked are not included in \p visited,
267261
/// nor are their successors traversed, <em>even if their "provides" set has
268262
/// been updated since it was marked.</em> (However, nodes that depend on the
269263
/// given \p node are always traversed.)
@@ -279,9 +273,8 @@ class DependencyGraph : public DependencyGraphImpl {
279273
/// visited node, add it to visited, and mark it if it cascades. The start
280274
/// node is NOT added to visited.
281275
///
282-
/// Do not confused "Marked" with "Visited".
283-
/// "Marked" does NOT influence the traversal. The traversal routines use
284-
/// "Visited" to avoid endless "recursion".
276+
/// The traversal routines use
277+
/// \p visited to avoid endless recursion.
285278
template <unsigned N>
286279
void markTransitive(SmallVector<T, N> &visited, T node,
287280
MarkTracer *tracer = nullptr) {

include/swift/Driver/Job.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,19 +231,19 @@ class Job {
231231
public:
232232
enum class Condition {
233233
// There was no information about the previous build (i.e., an input map),
234-
// or the map marked this Job as dirty
235-
// but the input didn't change.
234+
// or the map marked this Job as dirty or needing a cascading build.
236235
// Be maximally conservative with dependencies.
237236
Always,
238-
// The input changed, or this job was non-cascading or [it was not dirty but
239-
// primary output was missing].
240-
// In other words, this job was scheduled as non-cascading in the last build
237+
// The input changed, or this job was scheduled as non-cascading in the last
238+
// build
241239
// but didn't get to run.
240+
// The scheduled-but-didn't-run condition is detected when the job was not
241+
// dirty but its primary output was missing.
242242
RunWithoutCascading,
243243
// The best case: input didn't change, output exists.
244244
// Only run if it depends on some other thing that changed.
245245
CheckDependencies,
246-
// Pessimal: Run no matter what (but may or may not cascade).
246+
// Run no matter what (but may or may not cascade).
247247
NewlyAdded
248248
};
249249

lib/Driver/Compilation.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ namespace driver {
209209
/// Jobs in the initial set with Condition::Always, and having an existing
210210
/// .swiftdeps files.
211211
/// Set by scheduleInitialJobs and used only by scheduleAdditionalJobs.
212-
SmallVector<const Job *, 16> InitialOutOfDateCommands;
212+
SmallVector<const Job *, 16> InitialCascadingCommands;
213213

214214
/// Dependency graph for deciding which jobs are dirty (need running)
215215
/// or clean (can be skipped).
@@ -407,6 +407,13 @@ namespace driver {
407407
// If we have a dependency file /and/ the frontend task exited normally,
408408
// we can be discerning about what downstream files to rebuild.
409409
if (ReturnCode == EXIT_SUCCESS || ReturnCode == EXIT_FAILURE) {
410+
// "Marked" means that everything provided by this node (i.e. Job) is
411+
// dirty. Thus any file using any of these provides must be
412+
// recompiled. (Only non-private entities are output as provides.) In
413+
// other words, this Job "cascades"; the need to recompile it causes
414+
// other recompilations. It is possible that the current code marks
415+
// things that do not need to be marked. Unecessary compilation would
416+
// result if that were the case.
410417
bool wasCascading = DepGraph.isMarked(FinishedCmd);
411418

412419
switch (DepGraph.loadFromPath(FinishedCmd, DependenciesFile)) {
@@ -717,14 +724,14 @@ namespace driver {
717724
case Job::Condition::Always:
718725
if (Comp.getIncrementalBuildEnabled() && !DependenciesFile.empty()) {
719726
// Ensure dependents will get recompiled.
720-
InitialOutOfDateCommands.push_back(Cmd);
727+
InitialCascadingCommands.push_back(Cmd);
721728
// Mark this job as cascading.
722729
//
723730
// It would probably be safe and simpler to markTransitive on the
724731
// start nodes in the "Always" condition from the start instead of
725732
// using markIntransitive and having later functions call
726-
// markTransitive. That way markInstransitive would be an
727-
// implementation detail.
733+
// markTransitive. That way markIntransitive would be an
734+
// implementation detail of DependencyGraph.
728735
DepGraph.markIntransitive(Cmd);
729736
}
730737
LLVM_FALLTHROUGH;
@@ -749,7 +756,7 @@ namespace driver {
749756
// We scheduled all of the files that have actually changed. Now add the
750757
// files that haven't changed, so that they'll get built in parallel if
751758
// possible and after the first set of files if it's not.
752-
for (auto *Cmd : InitialOutOfDateCommands) {
759+
for (auto *Cmd : InitialCascadingCommands) {
753760
DepGraph.markTransitive(AdditionalOutOfDateCommands, Cmd,
754761
IncrementalTracer);
755762
}

0 commit comments

Comments
 (0)