diff options
author | Mark Schaller <mschaller@google.com> | 2015-08-10 20:11:56 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2015-08-11 07:53:24 +0000 |
commit | 593d3e0577c00c910834801732cb81cb16a3dac0 (patch) | |
tree | 33bfc1a125491c319a4fc71c01b020438e7d231e /src/main/java/com/google/devtools/build | |
parent | d12c398f96f15f1cfaf9b509c19da1964d422ba6 (diff) |
Don't return SkyValue when dirtying node
The invalidator is no longer using the SkyValue, so there's no need
to return it when dirtying a node.
--
MOS_MIGRATED_REVID=100307211
Diffstat (limited to 'src/main/java/com/google/devtools/build')
3 files changed, 11 insertions, 17 deletions
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 be20224bbc..4acf4285ea 100644 --- a/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java +++ b/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java @@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.util.GroupedList; import com.google.devtools.build.lib.util.GroupedList.GroupedListHelper; -import com.google.devtools.build.lib.util.Pair; import java.util.Collection; import java.util.List; @@ -316,17 +315,14 @@ public class InMemoryNodeEntry implements NodeEntry { @Override @Nullable - public synchronized Pair<? extends Iterable<SkyKey>, ? extends SkyValue> markDirty( - boolean isChanged) { + public synchronized Iterable<SkyKey> markDirty(boolean isChanged) { assertKeepEdges(); if (isDone()) { GroupedList<SkyKey> lastDirectDeps = GroupedList.create(directDeps); buildingState = BuildingState.newDirtyState(isChanged, lastDirectDeps, value); - Pair<? extends Iterable<SkyKey>, ? extends SkyValue> result = - Pair.of(lastDirectDeps.toSet(), value); value = null; directDeps = null; - return result; + return lastDirectDeps.toSet(); } // The caller may be simultaneously trying to mark this node dirty and changed, and the dirty // thread may have lost the race, but it is the caller's responsibility not to try to mark 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 e0d5b8c0e9..7e2d2247d0 100644 --- a/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java +++ b/src/main/java/com/google/devtools/build/skyframe/InvalidatingNodeVisitor.java @@ -351,11 +351,10 @@ public abstract class InvalidatingNodeVisitor extends AbstractQueueVisitor { } // This entry remains in the graph in this dirty state until it is re-evaluated. - Pair<? extends Iterable<SkyKey>, ? extends SkyValue> depsAndValue = - entry.markDirty(isChanged); + Iterable<SkyKey> deps = entry.markDirty(isChanged); // It is not safe to interrupt the logic from this point until the end of the method. // Any exception thrown should be unrecoverable. - if (depsAndValue == null) { + if (deps == null) { // Another thread has already dirtied this node. Don't do anything in this thread. pendingVisitations.remove(invalidationPair); return; @@ -368,12 +367,12 @@ public abstract class InvalidatingNodeVisitor extends AbstractQueueVisitor { // Remove this node as a reverse dep from its children, since we have reset it and it no // longer lists its children as direct deps. - Map<SkyKey, NodeEntry> children = graph.getBatch(depsAndValue.first); - if (children.size() != Iterables.size(depsAndValue.first)) { - Set<SkyKey> deps = ImmutableSet.copyOf(depsAndValue.first); + Map<SkyKey, NodeEntry> children = graph.getBatch(deps); + if (children.size() != Iterables.size(deps)) { + Set<SkyKey> depsSet = ImmutableSet.copyOf(deps); throw new IllegalStateException("Mismatch in getBatch: " + key + ", " + entry + "\n" - + Sets.difference(deps, children.keySet()) + "\n" - + Sets.difference(children.keySet(), deps)); + + Sets.difference(depsSet, children.keySet()) + "\n" + + Sets.difference(children.keySet(), depsSet)); } for (NodeEntry child : children.values()) { child.removeReverseDep(key); diff --git a/src/main/java/com/google/devtools/build/skyframe/NodeEntry.java b/src/main/java/com/google/devtools/build/skyframe/NodeEntry.java index 1905657177..ed9904d8f7 100644 --- a/src/main/java/com/google/devtools/build/skyframe/NodeEntry.java +++ b/src/main/java/com/google/devtools/build/skyframe/NodeEntry.java @@ -15,7 +15,6 @@ package com.google.devtools.build.skyframe; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; import com.google.devtools.build.lib.util.GroupedList.GroupedListHelper; -import com.google.devtools.build.lib.util.Pair; import java.util.Collection; import java.util.Set; @@ -227,13 +226,13 @@ public interface NodeEntry { * the caller will only ever want to call {@code markDirty()} a second time if a transition from a * dirty-unchanged state to a dirty-changed state is required. * - * @return The direct deps and value of this entry, or null if the entry has already been marked + * @return The direct deps of this entry, or null if the entry has already been marked * dirty. In the latter case, the caller should abort its handling of this node, since another * thread is already dealing with it. */ @Nullable @ThreadSafe - Pair<? extends Iterable<SkyKey>, ? extends SkyValue> markDirty(boolean isChanged); + Iterable<SkyKey> markDirty(boolean isChanged); /** * Marks this entry as up-to-date at this version. |