aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-11-08 18:44:55 +0000
committerGravatar Klaus Aehlig <aehlig@google.com>2016-11-09 09:14:05 +0000
commite77b6d2ef3975e515408d19e62cd3d4de854c378 (patch)
tree597a27d961f001c017dfe46c1c07d9a837d150a0 /src
parentdf69432e383cc6621fbd5955de09f6d29bd326bb (diff)
Precompute the universe key in SkyQueryEnvironment. Since it's a function of the scope and the parser prefix, both of which are final, it never changes.
-- MOS_MIGRATED_REVID=138536185
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java11
1 files changed, 6 insertions, 5 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 2bfd5e7450..c5efe91a51 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
@@ -126,7 +126,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
private final BlazeTargetAccessor accessor = new BlazeTargetAccessor(this);
protected final int loadingPhaseThreads;
protected final WalkableGraphFactory graphFactory;
- protected final List<String> universeScope;
+ protected final ImmutableList<String> universeScope;
protected final String parserPrefix;
protected final PathPackageLocator pkgPath;
private final int queryEvaluationParallelismLevel;
@@ -136,6 +136,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
private InterruptibleSupplier<ImmutableSet<PathFragment>> blacklistPatternsSupplier;
private ForkJoinPool forkJoinPool;
private RecursivePackageProviderBackedTargetPatternResolver resolver;
+ private final SkyKey universeKey;
public SkyQueryEnvironment(
boolean keepGoing,
@@ -187,11 +188,12 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
this.loadingPhaseThreads = loadingPhaseThreads;
this.graphFactory = graphFactory;
this.pkgPath = pkgPath;
- this.universeScope = Preconditions.checkNotNull(universeScope);
+ this.universeScope = ImmutableList.copyOf(Preconditions.checkNotNull(universeScope));
this.parserPrefix = parserPrefix;
Preconditions.checkState(
!universeScope.isEmpty(), "No queries can be performed with an empty universe");
this.queryEvaluationParallelismLevel = queryEvaluationParallelismLevel;
+ this.universeKey = graphFactory.getUniverseKey(universeScope, parserPrefix);
}
private void beforeEvaluateQuery() throws InterruptedException {
@@ -201,8 +203,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
graphFactory.prepareAndGet(
universeScope, parserPrefix, loadingPhaseThreads, eventHandler);
}
- SkyKey universeKey = graphFactory.getUniverseKey(universeScope, parserPrefix);
- checkEvaluationResult(result, universeKey);
+ checkEvaluationResult(result);
graph = result.getWalkableGraph();
blacklistPatternsSupplier = InterruptibleSupplier.Memoize.of(new BlacklistSupplier(graph));
@@ -226,7 +227,7 @@ public class SkyQueryEnvironment extends AbstractBlazeQueryEnvironment<Target>
* The {@link EvaluationResult} is from the evaluation of a single PrepareDepsOfPatterns node. We
* expect to see either a single successfully evaluated value or a cycle in the result.
*/
- private void checkEvaluationResult(EvaluationResult<SkyValue> result, SkyKey universeKey) {
+ private void checkEvaluationResult(EvaluationResult<SkyValue> result) {
Collection<SkyValue> values = result.values();
if (!values.isEmpty()) {
Preconditions.checkState(