Automatic code cleanup. PiperOrigin-RevId: 222106347
diff --git a/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java b/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java index a8ad00c..e7f4fe5 100644 --- a/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java +++ b/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java
@@ -64,14 +64,6 @@ enqueueing(skyKey, false); } - /** - * Called when a node was requested to be enqueued but wasn't because either an interrupt or - * an error (in nokeep_going mode) had occurred. - */ - protected void enqueueAfterError(SkyKey skyKey) { - enqueueing(skyKey, true); - } - private void enqueueing(SkyKey skyKey, boolean afterError) { // We unconditionally add the key to the set of in-flight nodes even if evaluation is never // scheduled, because we still want to remove the previously created NodeEntry from the graph. @@ -91,6 +83,14 @@ } } + /** + * Called when a node was requested to be enqueued but wasn't because either an interrupt or an + * error (in nokeep_going mode) had occurred. + */ + protected void enqueueAfterError(SkyKey skyKey) { + enqueueing(skyKey, true); + } + @Override public void stateStarting(SkyKey skyKey, NodeState nodeState) { if (progressReceiver != null) {
diff --git a/src/main/java/com/google/devtools/build/skyframe/EvaluationResult.java b/src/main/java/com/google/devtools/build/skyframe/EvaluationResult.java index 54db16e..88b48ba 100644 --- a/src/main/java/com/google/devtools/build/skyframe/EvaluationResult.java +++ b/src/main/java/com/google/devtools/build/skyframe/EvaluationResult.java
@@ -105,6 +105,14 @@ } /** + * Returns some error info. Convenience method equivalent to Iterables.getFirst({@link + * #errorMap()}, null).getValue(). + */ + public ErrorInfo getError() { + return Iterables.getFirst(errorMap.entrySet(), null).getValue(); + } + + /** * @return Names of all values that were successfully evaluated. This collection is disjoint from * the keys in {@link #errorMap}. */ @@ -126,14 +134,6 @@ return walkableGraph; } - /** - * Returns some error info. Convenience method equivalent to - * Iterables.getFirst({@link #errorMap()}, null).getValue(). - */ - public ErrorInfo getError() { - return Iterables.getFirst(errorMap.entrySet(), null).getValue(); - } - @Override public String toString() { return MoreObjects.toStringHelper(this)
diff --git a/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java b/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java index 491d10d..018ddc4 100644 --- a/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java +++ b/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java
@@ -688,6 +688,12 @@ return isReady(getNumTemporaryDirectDeps()); } + /** Returns whether all known children of this node have signaled that they are done. */ + private boolean isReady(int numDirectDeps) { + Preconditions.checkState(signaledDeps <= numDirectDeps, "%s %s", numDirectDeps, this); + return signaledDeps == numDirectDeps; + } + /** True if the child should cause re-evaluation of this node. */ protected boolean childCausesReevaluation( Version lastEvaluatedVersion, @@ -705,12 +711,6 @@ throw error; } - /** Returns whether all known children of this node have signaled that they are done. */ - private boolean isReady(int numDirectDeps) { - Preconditions.checkState(signaledDeps <= numDirectDeps, "%s %s", numDirectDeps, this); - return signaledDeps == numDirectDeps; - } - private boolean isEvaluating() { return signaledDeps > NOT_EVALUATING_SENTINEL; }
diff --git a/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java b/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java index e597a50..587b16c 100644 --- a/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java +++ b/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java
@@ -58,7 +58,7 @@ * * <p>This is intended only for use in alternative {@code MemoizingEvaluator} implementations. */ -public abstract class InvalidatingNodeVisitor<TGraph extends QueryableGraph> { +public abstract class InvalidatingNodeVisitor<GraphT extends QueryableGraph> { // Default thread count is equal to the number of cores to exploit // that level of hardware parallelism, since invalidation should be CPU-bound. @@ -77,16 +77,14 @@ } }; - protected final TGraph graph; + protected final GraphT graph; protected final DirtyTrackingProgressReceiver progressReceiver; // Aliased to InvalidationState.pendingVisitations. protected final Set<Pair<SkyKey, InvalidationType>> pendingVisitations; protected final QuiescingExecutor executor; protected InvalidatingNodeVisitor( - TGraph graph, - DirtyTrackingProgressReceiver progressReceiver, - InvalidationState state) { + GraphT graph, DirtyTrackingProgressReceiver progressReceiver, InvalidationState state) { this.executor = new AbstractQueueVisitor( /*parallelism=*/ DEFAULT_THREAD_COUNT, @@ -101,7 +99,7 @@ } protected InvalidatingNodeVisitor( - TGraph graph, + GraphT graph, DirtyTrackingProgressReceiver progressReceiver, InvalidationState state, ForkJoinPool forkJoinPool) {
diff --git a/src/main/java/com/google/devtools/build/skyframe/SimpleCycleDetector.java b/src/main/java/com/google/devtools/build/skyframe/SimpleCycleDetector.java index cf82baf..69d9fb1 100644 --- a/src/main/java/com/google/devtools/build/skyframe/SimpleCycleDetector.java +++ b/src/main/java/com/google/devtools/build/skyframe/SimpleCycleDetector.java
@@ -74,16 +74,6 @@ } /** - * Marker value that we push onto a stack before we push a node's children on. When the marker - * value is popped, we know that all the children are finished. We would use null instead, but - * ArrayDeque does not permit null elements. - */ - private static final SkyKey CHILDREN_FINISHED = () -> null; - - /** The max number of cycles we will report to the user for a given root, to avoid OOMing. */ - private static final int MAX_CYCLES = 20; - - /** * The algorithm for this cycle detector is as follows. We visit the graph depth-first, keeping * track of the path we are currently on. We skip any DONE nodes (they are transitively * error-free). If we come to a node already on the path, we immediately construct a cycle. If we @@ -283,6 +273,16 @@ } /** + * Marker value that we push onto a stack before we push a node's children on. When the marker + * value is popped, we know that all the children are finished. We would use null instead, but + * ArrayDeque does not permit null elements. + */ + private static final SkyKey CHILDREN_FINISHED = () -> null; + + /** The max number of cycles we will report to the user for a given root, to avoid OOMing. */ + private static final int MAX_CYCLES = 20; + + /** * Returns the child of this node that is in the cycle that was just found. If the cycle is a * self-edge, returns the node itself. */
diff --git a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java index eb41634..32630c8 100644 --- a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java +++ b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java
@@ -191,7 +191,8 @@ batchPrefetch(skyKey, directDeps, oldDeps, /*assertDone=*/ false, skyKey); } catch (UndonePreviouslyRequestedDep undonePreviouslyRequestedDep) { throw new IllegalStateException( - "batchPrefetch can't throw UndonePreviouslyRequestedDep unless assertDone is true"); + "batchPrefetch can't throw UndonePreviouslyRequestedDep unless assertDone is true", + undonePreviouslyRequestedDep); } Preconditions.checkState( !this.previouslyRequestedDepsValues.containsKey(ErrorTransienceValue.KEY),