diff options
author | 2018-02-13 11:37:30 -0800 | |
---|---|---|
committer | 2018-02-13 11:39:27 -0800 | |
commit | 537552028eb00c5939cdfa60702f57d716a949a3 (patch) | |
tree | 4d72f90c48a3a4acaaad4885521c583004aafc21 /src | |
parent | f365d3f3451c3aac00990d7c5c9a2610d96cc2cd (diff) |
Refactor WalkableGraph and BuildDriver interfaces
Remove WalkableGraph#isUpToDate and BuildDriver#alreadyEvaluated and delegate the
work to implementation.
RELNOTES: None
PiperOrigin-RevId: 185562370
Diffstat (limited to 'src')
5 files changed, 5 insertions, 35 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java index 0485f9dd95..e7ce0a3a29 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java @@ -249,26 +249,20 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> throws QueryException, InterruptedException { Set<SkyKey> roots = getGraphRootsFromExpression(expr); - if (graph == null || !graphFactory.isUpToDate(roots)) { - // If this environment is uninitialized or the graph factory needs to evaluate, do so. We - // assume here that this environment cannot be initialized-but-stale if the factory is up - // to date. - EvaluationResult<SkyValue> result; - try (AutoProfiler p = AutoProfiler.logged("evaluation and walkable graph", logger)) { - result = graphFactory.prepareAndGet(roots, loadingPhaseThreads, universeEvalEventHandler); - } + EvaluationResult<SkyValue> result; + try (AutoProfiler p = AutoProfiler.logged("evaluation and walkable graph", logger)) { + result = graphFactory.prepareAndGet(roots, loadingPhaseThreads, universeEvalEventHandler); + } + if (graph == null || graph != result.getWalkableGraph()) { checkEvaluationResult(roots, result); - packageSemaphore = makeFreshPackageMultisetSemaphore(); graph = result.getWalkableGraph(); blacklistPatternsSupplier = InterruptibleSupplier.Memoize.of(new BlacklistSupplier(graph)); - graphBackedRecursivePackageProvider = new GraphBackedRecursivePackageProvider(graph, universeTargetPatternKeys, pkgPath); } - if (executor == null) { executor = MoreExecutors.listeningDecorator( new ThreadPoolExecutor( diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java index 5677caad8d..a0245b7d4b 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java @@ -1788,11 +1788,6 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { return evaluationResult; } - @Override - public boolean isUpToDate(Set<SkyKey> roots) { - return buildDriver.alreadyEvaluated(roots); - } - /** * Get metadata related to the prepareAndGet() lookup. Resulting data is specific to the * underlying evaluation implementation. diff --git a/src/main/java/com/google/devtools/build/skyframe/BuildDriver.java b/src/main/java/com/google/devtools/build/skyframe/BuildDriver.java index 78c24793c6..d1f942e0c7 100644 --- a/src/main/java/com/google/devtools/build/skyframe/BuildDriver.java +++ b/src/main/java/com/google/devtools/build/skyframe/BuildDriver.java @@ -37,13 +37,6 @@ public interface BuildDriver { String meta(Iterable<SkyKey> roots, OptionsClassProvider options) throws AbruptExitException, InterruptedException; - /** - * Returns true if this {@link BuildDriver} instance has already been used to {@link #evaluate} - * the given {@code roots} at the Version that would be passed along to the next call to {@link - * MemoizingEvaluator#evaluate} in {@link #evaluate}. - */ - boolean alreadyEvaluated(Iterable<SkyKey> roots); - MemoizingEvaluator getGraphForTesting(); @Nullable diff --git a/src/main/java/com/google/devtools/build/skyframe/SequentialBuildDriver.java b/src/main/java/com/google/devtools/build/skyframe/SequentialBuildDriver.java index 8a42189407..51724cdc05 100644 --- a/src/main/java/com/google/devtools/build/skyframe/SequentialBuildDriver.java +++ b/src/main/java/com/google/devtools/build/skyframe/SequentialBuildDriver.java @@ -48,11 +48,6 @@ public class SequentialBuildDriver implements BuildDriver { } @Override - public boolean alreadyEvaluated(Iterable<SkyKey> roots) { - return false; - } - - @Override public MemoizingEvaluator getGraphForTesting() { return memoizingEvaluator; } diff --git a/src/main/java/com/google/devtools/build/skyframe/WalkableGraph.java b/src/main/java/com/google/devtools/build/skyframe/WalkableGraph.java index b5b744f6af..a55bbc5415 100644 --- a/src/main/java/com/google/devtools/build/skyframe/WalkableGraph.java +++ b/src/main/java/com/google/devtools/build/skyframe/WalkableGraph.java @@ -103,13 +103,6 @@ public interface WalkableGraph { Set<SkyKey> roots, int numThreads, ExtendedEventHandler eventHandler) throws InterruptedException; - /** - * Returns true if this instance has already been used to {@link #prepareAndGet} {@code roots}. - * If so, cached results from {@link #prepareAndGet} can be re-used safely, potentially saving - * some processing time. - */ - boolean isUpToDate(Set<SkyKey> roots); - /** Returns the {@link SkyKey} that defines this universe. */ SkyKey getUniverseKey(Collection<String> roots, String offset); } |