Skip to content

Commit 2ff5855

Browse files
author
David Ungar
committed
Rename DependencyGraphImpl -> CoarseGrainedDependencyGraphImpl, unformatted
1 parent 200b181 commit 2ff5855

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

include/swift/Driver/CoarseGrainedDependencyGraph.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class UnifiedStatsReporter;
3939
/// The non-templated implementation of DependencyGraph.
4040
///
4141
/// \see DependencyGraph
42-
class DependencyGraphImpl {
42+
class CoarseGrainedDependencyGraphImpl {
4343
public:
4444
/// Possible dependency kinds.
4545
///
@@ -70,7 +70,7 @@ class DependencyGraphImpl {
7070
llvm::DenseMap<const void *, SmallVector<Entry, 4>> Table;
7171
UnifiedStatsReporter *Stats;
7272

73-
friend class DependencyGraphImpl;
73+
friend class CoarseGrainedDependencyGraphImpl;
7474
protected:
7575
explicit MarkTracerImpl(UnifiedStatsReporter *Stats);
7676
~MarkTracerImpl();
@@ -196,7 +196,7 @@ class DependencyGraphImpl {
196196
/// The graph also supports a "mark" operation, which is intended to track
197197
/// nodes that have been not just visited but transitively marked through.
198198
template <typename T>
199-
class DependencyGraph : public DependencyGraphImpl {
199+
class DependencyGraph : public CoarseGrainedDependencyGraphImpl {
200200
using Traits = llvm::PointerLikeTypeTraits<T>;
201201
static_assert(Traits::NumLowBitsAvailable >= 0, "not a pointer-like type");
202202

@@ -240,7 +240,7 @@ class DependencyGraph : public DependencyGraphImpl {
240240
/// call site can polymorphically call \ref
241241
/// fine_grained_dependencies::ModuleDepGraph::loadFromPath
242242
LoadResult loadFromPath(T node, StringRef path, DiagnosticEngine &) {
243-
return DependencyGraphImpl::loadFromPath(Traits::getAsVoidPointer(node),
243+
return CoarseGrainedDependencyGraphImpl::loadFromPath(Traits::getAsVoidPointer(node),
244244
path);
245245
}
246246

@@ -250,7 +250,7 @@ class DependencyGraph : public DependencyGraphImpl {
250250
///
251251
/// \sa loadFromPath
252252
LoadResult loadFromString(T node, StringRef data) {
253-
return DependencyGraphImpl::loadFromString(Traits::getAsVoidPointer(node),
253+
return CoarseGrainedDependencyGraphImpl::loadFromString(Traits::getAsVoidPointer(node),
254254
data);
255255
}
256256

@@ -259,7 +259,7 @@ class DependencyGraph : public DependencyGraphImpl {
259259
/// This can be used for new nodes that may be updated later.
260260
void addIndependentNode(T node) {
261261
return
262-
DependencyGraphImpl::addIndependentNode(Traits::getAsVoidPointer(node));
262+
CoarseGrainedDependencyGraphImpl::addIndependentNode(Traits::getAsVoidPointer(node));
263263
}
264264

265265
/// Marks \p node and all nodes that depend on \p node, and places any nodes
@@ -287,7 +287,7 @@ class DependencyGraph : public DependencyGraphImpl {
287287
void markTransitive(SmallVector<T, N> &visited, T node,
288288
MarkTracer *tracer = nullptr) {
289289
SmallVector<const void *, N> rawMarked;
290-
DependencyGraphImpl::markTransitive(rawMarked,
290+
CoarseGrainedDependencyGraphImpl::markTransitive(rawMarked,
291291
Traits::getAsVoidPointer(node),
292292
tracer);
293293
// FIXME: How can we avoid this copy?
@@ -297,7 +297,7 @@ class DependencyGraph : public DependencyGraphImpl {
297297
template <unsigned N>
298298
void markExternal(SmallVector<T, N> &visited, StringRef externalDependency) {
299299
SmallVector<const void *, N> rawMarked;
300-
DependencyGraphImpl::markExternal(rawMarked, externalDependency);
300+
CoarseGrainedDependencyGraphImpl::markExternal(rawMarked, externalDependency);
301301
// FIXME: How can we avoid this copy?
302302
copyBack(visited, rawMarked);
303303
}
@@ -309,12 +309,12 @@ class DependencyGraph : public DependencyGraphImpl {
309309
/// \sa #markTransitive
310310
bool markIntransitive(T node) {
311311
return
312-
DependencyGraphImpl::markIntransitive(Traits::getAsVoidPointer(node));
312+
CoarseGrainedDependencyGraphImpl::markIntransitive(Traits::getAsVoidPointer(node));
313313
}
314314

315315
/// Returns true if \p node has been marked (directly or transitively).
316316
bool isMarked(T node) const {
317-
return DependencyGraphImpl::isMarked(Traits::getAsVoidPointer(node));
317+
return CoarseGrainedDependencyGraphImpl::isMarked(Traits::getAsVoidPointer(node));
318318
}
319319
};
320320

include/swift/Driver/FineGrainedDependencyDriverGraph.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ class ModuleDepGraphNode : public DepGraphNode {
107107

108108
/// A placeholder allowing the experimental system to fit into the driver
109109
/// without changing as much code.
110-
class DependencyGraphImpl {
110+
class CoarseGrainedDependencyGraphImpl {
111111
public:
112112
/// Use the status quo LoadResult for now.
113-
using LoadResult = typename swift::DependencyGraphImpl::LoadResult;
113+
using LoadResult = typename swift::CoarseGrainedDependencyGraphImpl::LoadResult;
114114
};
115115

116116
//==============================================================================
@@ -268,9 +268,9 @@ class ModuleDepGraph {
268268
}
269269

270270
/// Unlike the standard \c DependencyGraph, returns \c
271-
/// DependencyGraphImpl::LoadResult::AffectsDownstream when loading a new
271+
/// CoarseGrainedDependencyGraphImpl::LoadResult::AffectsDownstream when loading a new
272272
/// file, i.e. when determining the initial set. Caller compensates.
273-
DependencyGraphImpl::LoadResult loadFromPath(const driver::Job *, StringRef,
273+
CoarseGrainedDependencyGraphImpl::LoadResult loadFromPath(const driver::Job *, StringRef,
274274
DiagnosticEngine &);
275275

276276
/// For the dot file.
@@ -372,12 +372,12 @@ class ModuleDepGraph {
372372
/// and integrate it into the ModuleDepGraph.
373373
/// Used both the first time, and to reload the SourceFileDepGraph.
374374
/// If any changes were observed, indicate same in the return vale.
375-
DependencyGraphImpl::LoadResult loadFromBuffer(const driver::Job *,
375+
CoarseGrainedDependencyGraphImpl::LoadResult loadFromBuffer(const driver::Job *,
376376
llvm::MemoryBuffer &);
377377

378378
/// Integrate a SourceFileDepGraph into the receiver.
379379
/// Integration happens when the driver needs to read SourceFileDepGraph.
380-
DependencyGraphImpl::LoadResult integrate(const SourceFileDepGraph &);
380+
CoarseGrainedDependencyGraphImpl::LoadResult integrate(const SourceFileDepGraph &);
381381

382382
enum class LocationOfPreexistingNode { nowhere, here, elsewhere };
383383

lib/Driver/CoarseGrainedDependencyGraph.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,30 @@
2525

2626
using namespace swift;
2727

28-
enum class DependencyGraphImpl::DependencyKind : uint8_t {
28+
enum class CoarseGrainedDependencyGraphImpl::DependencyKind : uint8_t {
2929
TopLevelName = 1 << 0,
3030
DynamicLookupName = 1 << 1,
3131
NominalType = 1 << 2,
3232
NominalTypeMember = 1 << 3,
3333
ExternalFile = 1 << 4,
3434
};
35-
enum class DependencyGraphImpl::DependencyFlags : uint8_t {
35+
enum class CoarseGrainedDependencyGraphImpl::DependencyFlags : uint8_t {
3636
IsCascading = 1 << 0
3737
};
3838

39-
class DependencyGraphImpl::MarkTracerImpl::Entry {
39+
class CoarseGrainedDependencyGraphImpl::MarkTracerImpl::Entry {
4040
public:
4141
const void *Node;
4242
StringRef Name;
4343
DependencyMaskTy KindMask;
4444
};
4545

46-
DependencyGraphImpl::MarkTracerImpl::MarkTracerImpl(UnifiedStatsReporter *Stats)
46+
CoarseGrainedDependencyGraphImpl::MarkTracerImpl::MarkTracerImpl(UnifiedStatsReporter *Stats)
4747
: Stats(Stats) {}
48-
DependencyGraphImpl::MarkTracerImpl::~MarkTracerImpl() = default;
48+
CoarseGrainedDependencyGraphImpl::MarkTracerImpl::~MarkTracerImpl() = default;
4949

50-
using LoadResult = DependencyGraphImpl::LoadResult;
51-
using DependencyKind = DependencyGraphImpl::DependencyKind;
50+
using LoadResult = CoarseGrainedDependencyGraphImpl::LoadResult;
51+
using DependencyKind = CoarseGrainedDependencyGraphImpl::DependencyKind;
5252
using DependencyCallbackTy = LoadResult(StringRef, DependencyKind, bool);
5353
using InterfaceHashCallbackTy = LoadResult(StringRef);
5454

@@ -211,20 +211,20 @@ parseDependencyFile(llvm::MemoryBuffer &buffer,
211211
return result;
212212
}
213213

214-
LoadResult DependencyGraphImpl::loadFromPath(const void *node, StringRef path) {
214+
LoadResult CoarseGrainedDependencyGraphImpl::loadFromPath(const void *node, StringRef path) {
215215
auto buffer = llvm::MemoryBuffer::getFile(path);
216216
if (!buffer)
217217
return LoadResult::HadError;
218218
return loadFromBuffer(node, *buffer.get());
219219
}
220220

221221
LoadResult
222-
DependencyGraphImpl::loadFromString(const void *node, StringRef data) {
222+
CoarseGrainedDependencyGraphImpl::loadFromString(const void *node, StringRef data) {
223223
auto buffer = llvm::MemoryBuffer::getMemBuffer(data);
224224
return loadFromBuffer(node, *buffer);
225225
}
226226

227-
LoadResult DependencyGraphImpl::loadFromBuffer(const void *node,
227+
LoadResult CoarseGrainedDependencyGraphImpl::loadFromBuffer(const void *node,
228228
llvm::MemoryBuffer &buffer) {
229229
auto &provides = Provides[node];
230230

@@ -294,7 +294,7 @@ LoadResult DependencyGraphImpl::loadFromBuffer(const void *node,
294294
interfaceHashCallback);
295295
}
296296

297-
void DependencyGraphImpl::markExternal(SmallVectorImpl<const void *> &visited,
297+
void CoarseGrainedDependencyGraphImpl::markExternal(SmallVectorImpl<const void *> &visited,
298298
StringRef externalDependency) {
299299
forEachUnmarkedJobDirectlyDependentOnExternalSwiftdeps(
300300
externalDependency, [&](const void *node) {
@@ -303,7 +303,7 @@ void DependencyGraphImpl::markExternal(SmallVectorImpl<const void *> &visited,
303303
});
304304
}
305305

306-
void DependencyGraphImpl::
306+
void CoarseGrainedDependencyGraphImpl::
307307
forEachUnmarkedJobDirectlyDependentOnExternalSwiftdeps(
308308
StringRef externalSwiftDeps, function_ref<void(const void *node)> fn) {
309309
auto allDependents = Dependencies.find(externalSwiftDeps);
@@ -320,7 +320,7 @@ void DependencyGraphImpl::
320320
}
321321

322322
void
323-
DependencyGraphImpl::markTransitive(SmallVectorImpl<const void *> &visited,
323+
CoarseGrainedDependencyGraphImpl::markTransitive(SmallVectorImpl<const void *> &visited,
324324
const void *node, MarkTracerImpl *tracer) {
325325
assert(Provides.count(node) && "node is not in the graph");
326326
llvm::SpecificBumpPtrAllocator<MarkTracerImpl::Entry> scratchAlloc;
@@ -407,7 +407,7 @@ DependencyGraphImpl::markTransitive(SmallVectorImpl<const void *> &visited,
407407
}
408408
}
409409

410-
void DependencyGraphImpl::MarkTracerImpl::countStatsForNodeMarking(
410+
void CoarseGrainedDependencyGraphImpl::MarkTracerImpl::countStatsForNodeMarking(
411411
const OptionSet<DependencyKind> &Kind, bool IsCascading) const {
412412

413413
if (!Stats)
@@ -439,7 +439,7 @@ void DependencyGraphImpl::MarkTracerImpl::countStatsForNodeMarking(
439439
}
440440
}
441441

442-
void DependencyGraphImpl::MarkTracerImpl::printPath(
442+
void CoarseGrainedDependencyGraphImpl::MarkTracerImpl::printPath(
443443
raw_ostream &out,
444444
const void *item,
445445
llvm::function_ref<void (const void *)> printItem) const {

lib/Driver/Compilation.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ namespace driver {
469469

470470
switch (loadDepGraphFromPath(FinishedCmd, DependenciesFile,
471471
Comp.getDiags(), forRanges)) {
472-
case DependencyGraphImpl::LoadResult::HadError:
472+
case CoarseGrainedDependencyGraphImpl::LoadResult::HadError:
473473
if (ReturnCode == EXIT_SUCCESS) {
474474
dependencyLoadFailed(DependenciesFile);
475475
// Better try compiling whatever was waiting on more info.
@@ -479,11 +479,11 @@ namespace driver {
479479
Dependents.clear();
480480
} // else, let the next build handle it.
481481
break;
482-
case DependencyGraphImpl::LoadResult::UpToDate:
482+
case CoarseGrainedDependencyGraphImpl::LoadResult::UpToDate:
483483
if (!wasCascading)
484484
break;
485485
LLVM_FALLTHROUGH;
486-
case DependencyGraphImpl::LoadResult::AffectsDownstream:
486+
case CoarseGrainedDependencyGraphImpl::LoadResult::AffectsDownstream:
487487
markTransitiveInDepGraph(Dependents, FinishedCmd, forRanges,
488488
IncrementalTracer);
489489
break;
@@ -1034,12 +1034,12 @@ namespace driver {
10341034
const auto loadResult = loadDepGraphFromPath(Cmd, DependenciesFile,
10351035
Comp.getDiags(), forRanges);
10361036
switch (loadResult) {
1037-
case DependencyGraphImpl::LoadResult::HadError:
1037+
case CoarseGrainedDependencyGraphImpl::LoadResult::HadError:
10381038
dependencyLoadFailed(DependenciesFile, /*Warn=*/true);
10391039
return None;
1040-
case DependencyGraphImpl::LoadResult::UpToDate:
1040+
case CoarseGrainedDependencyGraphImpl::LoadResult::UpToDate:
10411041
return std::make_pair(Cmd->getCondition(), true);
1042-
case DependencyGraphImpl::LoadResult::AffectsDownstream:
1042+
case CoarseGrainedDependencyGraphImpl::LoadResult::AffectsDownstream:
10431043
if (Comp.getEnableFineGrainedDependencies()) {
10441044
// The fine-grained graph reports a change, since it lumps new
10451045
// files together with new "Provides".

lib/Driver/FineGrainedDependencyDriverGraph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ using namespace swift::driver;
4141
// MARK: Interfacing to Compilation
4242
//==============================================================================
4343

44-
using LoadResult = fine_grained_dependencies::DependencyGraphImpl::LoadResult;
44+
using LoadResult = fine_grained_dependencies::CoarseGrainedDependencyGraphImpl::LoadResult;
4545

4646
LoadResult ModuleDepGraph::loadFromPath(const Job *Cmd, StringRef path,
4747
DiagnosticEngine &diags) {
@@ -70,7 +70,7 @@ LoadResult ModuleDepGraph::loadFromBuffer(const Job *job,
7070
Optional<SourceFileDepGraph> sourceFileDepGraph =
7171
SourceFileDepGraph::loadFromBuffer(buffer);
7272
if (!sourceFileDepGraph)
73-
return DependencyGraphImpl::LoadResult::HadError;
73+
return CoarseGrainedDependencyGraphImpl::LoadResult::HadError;
7474
addIndependentNode(job);
7575
return integrate(sourceFileDepGraph.getValue());
7676
}

unittests/Driver/CoarseGrainedDependencyGraphTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "gtest/gtest.h"
44

55
using namespace swift;
6-
using LoadResult = DependencyGraphImpl::LoadResult;
6+
using LoadResult = CoarseGrainedDependencyGraphImpl::LoadResult;
77
using namespace reference_dependency_keys;
88

99
static LoadResult loadFromString(DependencyGraph<uintptr_t> &dg, uintptr_t node,

0 commit comments

Comments
 (0)