Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions compiler/rustc_query_system/src/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,28 +875,33 @@ impl<D: Deps> DepGraphData<D> {
parent_dep_node_index: SerializedDepNodeIndex,
frame: Option<&MarkFrame<'_>>,
) -> Option<()> {
let dep_dep_node_color = self.colors.get(parent_dep_node_index);
let dep_dep_node = &self.previous.index_to_node(parent_dep_node_index);
let get_dep_dep_node = || self.previous.index_to_node(parent_dep_node_index);

match dep_dep_node_color {
match self.colors.get(parent_dep_node_index) {
Some(DepNodeColor::Green(_)) => {
// This dependency has been marked as green before, we are
// still fine and can continue with checking the other
// dependencies.
debug!("dependency {dep_dep_node:?} was immediately green");
//
// This path is extremely hot. We don't want to get the
// `dep_dep_node` unless it's necessary. Hence the
// `get_dep_dep_node` closure.
debug!("dependency {:?} was immediately green", get_dep_dep_node());
return Some(());
}
Some(DepNodeColor::Red) => {
// We found a dependency the value of which has changed
// compared to the previous compilation session. We cannot
// mark the DepNode as green and also don't need to bother
// with checking any of the other dependencies.
debug!("dependency {dep_dep_node:?} was immediately red");
debug!("dependency {:?} was immediately red", get_dep_dep_node());
return None;
}
None => {}
}

let dep_dep_node = &get_dep_dep_node();

// We don't know the state of this dependency. If it isn't
// an eval_always node, let's try to mark it green recursively.
if !qcx.dep_context().is_eval_always(dep_dep_node.kind) {
Expand All @@ -922,9 +927,7 @@ impl<D: Deps> DepGraphData<D> {
return None;
}

let dep_dep_node_color = self.colors.get(parent_dep_node_index);

match dep_dep_node_color {
match self.colors.get(parent_dep_node_index) {
Some(DepNodeColor::Green(_)) => {
debug!("managed to FORCE dependency {dep_dep_node:?} to green");
return Some(());
Expand Down
Loading