Remove prev_index_to_index
field from CurrentDepGraph
#138824
+271
−219
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The dep graph currently has 2 ways to map a previous index into a current index. The
prev_index_to_index
map stores the current index equivalent of a previous index. For indices which are marked green, we also store the same information in theDepNodeColorMap
. We actually only need to known the mapping for green nodes however, so this PR removesprev_index_to_index
and instead makes use of theDepNodeColorMap
.To avoid racing when promoting a node from the previous session, the encoder lock is now used to ensure only one thread encodes the promoted node. This was previously done by the lock in
prev_index_to_index
.This also changes
nodes_newly_allocated_in_current_session
used to detect duplicate dep nodes to contain both new and previous nodes, which is simpler and can better catch duplicates.The dep node index encoding used in
DepNodeColorMap
is tweak to avoid subtraction / addition to optimize accessing the current equivalent of a previous index.This is based on #138629.
r? @oli-obk