Re-use the precomputed universe key in WalkableGraphFactory#prepareAndGet.
--
MOS_MIGRATED_REVID=139357569
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 9e33d50..1ed21a0 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 @@
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 96b84a8..2c38f6d 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 @@
}
/**
- * 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 240ea7c..50de277 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 @@
/** 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);