diff options
author | 2016-11-16 19:35:48 +0000 | |
---|---|---|
committer | 2016-11-17 18:18:00 +0000 | |
commit | 18d0a5dcd0d349669fd0b44c7d36e32c19230278 (patch) | |
tree | bc76629a2242a4e30300455ba1a8c4d1c3286543 /src | |
parent | a3c053bf957587e09b22db6f3547934bcbdb574d (diff) |
Re-use the precomputed universe key in WalkableGraphFactory#prepareAndGet.
--
MOS_MIGRATED_REVID=139357569
Diffstat (limited to 'src')
4 files changed, 13 insertions, 16 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 9e33d50bf6..1ed21a08c7 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 @@ -205,9 +205,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target> private void beforeEvaluateQuery() throws InterruptedException { EvaluationResult<SkyValue> result; try (AutoProfiler p = AutoProfiler.logged("evaluation and walkable graph", LOG)) { - result = - graphFactory.prepareAndGet( - universeScope, parserPrefix, loadingPhaseThreads, eventHandler); + result = graphFactory.prepareAndGet(universeKey, loadingPhaseThreads, eventHandler); } checkEvaluationResult(result); 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 96b84a86a2..2c38f6d924 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 @@ -1530,20 +1530,19 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { } /** - * For internal use in queries: performs a graph update to make sure the transitive closure of - * the specified target {@code patterns} is present in the graph, and returns the {@link + * For internal use in queries: performs a graph update to make sure the transitive closure of the + * specified {@code universeKey} is present in the graph, and returns the {@link * EvaluationResult}. * * <p>The graph update is unconditionally done in keep-going mode, so that the query is guaranteed * a complete graph to work on. */ @Override - public EvaluationResult<SkyValue> prepareAndGet(Collection<String> patterns, String offset, - int numThreads, EventHandler eventHandler) throws InterruptedException { - SkyKey skyKey = getUniverseKey(patterns, offset); + public EvaluationResult<SkyValue> prepareAndGet( + SkyKey universeKey, int numThreads, EventHandler eventHandler) throws InterruptedException { EvaluationResult<SkyValue> evaluationResult = - buildDriver.evaluate(ImmutableList.of(skyKey), true, numThreads, eventHandler); - Preconditions.checkNotNull(evaluationResult.getWalkableGraph(), patterns); + buildDriver.evaluate(ImmutableList.of(universeKey), true, numThreads, eventHandler); + Preconditions.checkNotNull(evaluationResult.getWalkableGraph(), universeKey); return evaluationResult; } 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 240ea7c0a8..50de277be9 100644 --- a/src/main/java/com/google/devtools/build/skyframe/WalkableGraph.java +++ b/src/main/java/com/google/devtools/build/skyframe/WalkableGraph.java @@ -92,8 +92,8 @@ public interface WalkableGraph { /** Provides a WalkableGraph on demand after preparing it. */ interface WalkableGraphFactory { - EvaluationResult<SkyValue> prepareAndGet(Collection<String> roots, String offset, - int numThreads, EventHandler eventHandler) throws InterruptedException; + EvaluationResult<SkyValue> prepareAndGet( + SkyKey universeKey, int numThreads, EventHandler eventHandler) throws InterruptedException; /** Returns the {@link SkyKey} that defines this universe. */ SkyKey getUniverseKey(Collection<String> roots, String offset); diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java index 869423e55b..b29ec04b0d 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionTest.java @@ -161,10 +161,10 @@ public class PrepareDepsOfPatternsFunctionTest extends BuildViewTestCase { } /** - * PrepareDepsOfPatternsFunction always keeps going despite any target pattern parsing errors, - * in keeping with the original behavior of {@link SkyframeExecutor#prepareAndGet}, which - * always used {@code keepGoing=true} during target pattern parsing because it was responsible - * for ensuring that queries had a complete graph to work on. + * PrepareDepsOfPatternsFunction always keeps going despite any target pattern parsing errors, in + * keeping with the original behavior of {@link WalkableGraph.WalkableGraphFactory#prepareAndGet}, + * which always used {@code keepGoing=true} during target pattern parsing because it was + * responsible for ensuring that queries had a complete graph to work on. */ @Test public void testParsingProblemsNoKeepGoing() throws Exception { |