mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
incr.comp.: Add some logging to DepGraph::try_mark_green().
This commit is contained in:
parent
e1994bd27b
commit
c9a17ef174
@ -347,7 +347,7 @@ impl fmt::Debug for DepNode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self.kind)?;
|
||||
|
||||
if !self.kind.has_params() {
|
||||
if !self.kind.has_params() && !self.kind.is_anon() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@ -356,14 +356,14 @@ impl fmt::Debug for DepNode {
|
||||
::ty::tls::with_opt(|opt_tcx| {
|
||||
if let Some(tcx) = opt_tcx {
|
||||
if let Some(def_id) = self.extract_def_id(tcx) {
|
||||
write!(f, "{}", tcx.item_path_str(def_id))?;
|
||||
write!(f, "{}", tcx.def_path(def_id).to_string(tcx))?;
|
||||
} else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) {
|
||||
write!(f, "{}", s)?;
|
||||
} else {
|
||||
write!(f, "{:?}", self.hash)?;
|
||||
write!(f, "{}", self.hash)?;
|
||||
}
|
||||
} else {
|
||||
write!(f, "{:?}", self.hash)?;
|
||||
write!(f, "{}", self.hash)?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
@ -429,6 +429,7 @@ impl DepGraph {
|
||||
tcx: TyCtxt,
|
||||
dep_node: &DepNode)
|
||||
-> Option<DepNodeIndex> {
|
||||
debug!("try_mark_green({:?}) - BEGIN", dep_node);
|
||||
let data = self.data.as_ref().unwrap();
|
||||
|
||||
debug_assert!(!data.colors.borrow().contains_key(dep_node));
|
||||
@ -440,6 +441,7 @@ impl DepGraph {
|
||||
// eagerly marked as either red/green before any queries are
|
||||
// executed.
|
||||
debug_assert!(dep_node.extract_def_id(tcx).is_none());
|
||||
debug!("try_mark_green({:?}) - END - DepNode is deleted input", dep_node);
|
||||
return None;
|
||||
}
|
||||
|
||||
@ -454,6 +456,8 @@ impl DepGraph {
|
||||
None => {
|
||||
// This DepNode did not exist in the previous compilation session,
|
||||
// so we cannot mark it as green.
|
||||
debug!("try_mark_green({:?}) - END - DepNode does not exist in \
|
||||
current compilation session anymore", dep_node);
|
||||
return None
|
||||
}
|
||||
};
|
||||
@ -469,6 +473,8 @@ impl DepGraph {
|
||||
// This dependency has been marked as green before, we are
|
||||
// still fine and can continue with checking the other
|
||||
// dependencies.
|
||||
debug!("try_mark_green({:?}) --- found dependency {:?} to \
|
||||
be immediately green", dep_node, dep_dep_node);
|
||||
current_deps.push(node_index);
|
||||
}
|
||||
Some(DepNodeColor::Red) => {
|
||||
@ -476,28 +482,47 @@ impl DepGraph {
|
||||
// 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!("try_mark_green({:?}) - END - dependency {:?} was \
|
||||
immediately red", dep_node, dep_dep_node);
|
||||
return None
|
||||
}
|
||||
None => {
|
||||
if dep_dep_node.kind.is_input() {
|
||||
// This input does not exist anymore.
|
||||
debug_assert!(dep_dep_node.extract_def_id(tcx).is_none());
|
||||
debug!("try_mark_green({:?}) - END - dependency {:?} \
|
||||
was deleted input", dep_node, dep_dep_node);
|
||||
return None;
|
||||
}
|
||||
|
||||
debug!("try_mark_green({:?}) --- state of dependency {:?} \
|
||||
is unknown, trying to mark it green", dep_node,
|
||||
dep_dep_node);
|
||||
|
||||
// We don't know the state of this dependency. Let's try to
|
||||
// mark it green.
|
||||
if let Some(node_index) = self.try_mark_green(tcx, dep_dep_node) {
|
||||
debug!("try_mark_green({:?}) --- managed to MARK \
|
||||
dependency {:?} as green", dep_node, dep_dep_node);
|
||||
current_deps.push(node_index);
|
||||
} else {
|
||||
// We failed to mark it green, so we try to force the query.
|
||||
debug!("try_mark_green({:?}) --- trying to force \
|
||||
dependency {:?}", dep_node, dep_dep_node);
|
||||
if ::ty::maps::force_from_dep_node(tcx, dep_dep_node) {
|
||||
let dep_dep_node_color = data.colors.borrow().get(dep_dep_node).cloned();
|
||||
match dep_dep_node_color {
|
||||
Some(DepNodeColor::Green(node_index)) => {
|
||||
debug!("try_mark_green({:?}) --- managed to \
|
||||
FORCE dependency {:?} to green",
|
||||
dep_node, dep_dep_node);
|
||||
current_deps.push(node_index);
|
||||
}
|
||||
Some(DepNodeColor::Red) => {
|
||||
debug!("try_mark_green({:?}) - END - \
|
||||
dependency {:?} was red after forcing",
|
||||
dep_node,
|
||||
dep_dep_node);
|
||||
return None
|
||||
}
|
||||
None => {
|
||||
@ -507,6 +532,8 @@ impl DepGraph {
|
||||
}
|
||||
} else {
|
||||
// The DepNode could not be forced.
|
||||
debug!("try_mark_green({:?}) - END - dependency {:?} \
|
||||
could not be forced", dep_node, dep_dep_node);
|
||||
return None
|
||||
}
|
||||
}
|
||||
@ -553,6 +580,7 @@ impl DepGraph {
|
||||
.insert(*dep_node, DepNodeColor::Green(node_index))
|
||||
.is_none());
|
||||
|
||||
debug!("try_mark_green({:?}) - END - successfully marked as green", dep_node.kind);
|
||||
Some(node_index)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user