Improve tracing logging
This commit is contained in:
parent
3da576804a
commit
91971f293c
3 changed files with 17 additions and 43 deletions
|
@ -598,6 +598,7 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(skip(self, tcx, data, parent_dep_node_index), level = "debug")]
|
||||||
fn try_mark_parent_green<Ctxt: QueryContext<DepKind = K>>(
|
fn try_mark_parent_green<Ctxt: QueryContext<DepKind = K>>(
|
||||||
&self,
|
&self,
|
||||||
tcx: Ctxt,
|
tcx: Ctxt,
|
||||||
|
@ -613,11 +614,7 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
// This dependency has been marked as green before, we are
|
// This dependency has been marked as green before, we are
|
||||||
// still fine and can continue with checking the other
|
// still fine and can continue with checking the other
|
||||||
// dependencies.
|
// dependencies.
|
||||||
debug!(
|
debug!("dependency {dep_dep_node:?} was immediately green");
|
||||||
"try_mark_previous_green({:?}) --- found dependency {:?} to \
|
|
||||||
be immediately green",
|
|
||||||
dep_node, dep_dep_node,
|
|
||||||
);
|
|
||||||
return Some(());
|
return Some(());
|
||||||
}
|
}
|
||||||
Some(DepNodeColor::Red) => {
|
Some(DepNodeColor::Red) => {
|
||||||
|
@ -625,10 +622,7 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
// compared to the previous compilation session. We cannot
|
// compared to the previous compilation session. We cannot
|
||||||
// mark the DepNode as green and also don't need to bother
|
// mark the DepNode as green and also don't need to bother
|
||||||
// with checking any of the other dependencies.
|
// with checking any of the other dependencies.
|
||||||
debug!(
|
debug!("dependency {dep_dep_node:?} was immediately red");
|
||||||
"try_mark_previous_green({:?}) - END - dependency {:?} was immediately red",
|
|
||||||
dep_node, dep_dep_node,
|
|
||||||
);
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -638,33 +632,24 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
// an eval_always node, let's try to mark it green recursively.
|
// an eval_always node, let's try to mark it green recursively.
|
||||||
if !tcx.dep_context().is_eval_always(dep_dep_node.kind) {
|
if !tcx.dep_context().is_eval_always(dep_dep_node.kind) {
|
||||||
debug!(
|
debug!(
|
||||||
"try_mark_previous_green({:?}) --- state of dependency {:?} ({}) \
|
"state of dependency {:?} ({}) is unknown, trying to mark it green",
|
||||||
is unknown, trying to mark it green",
|
dep_dep_node, dep_dep_node.hash,
|
||||||
dep_node, dep_dep_node, dep_dep_node.hash,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let node_index =
|
let node_index =
|
||||||
self.try_mark_previous_green(tcx, data, parent_dep_node_index, dep_dep_node);
|
self.try_mark_previous_green(tcx, data, parent_dep_node_index, dep_dep_node);
|
||||||
|
|
||||||
if node_index.is_some() {
|
if node_index.is_some() {
|
||||||
debug!(
|
debug!("managed to MARK dependency {dep_dep_node:?} as green",);
|
||||||
"try_mark_previous_green({:?}) --- managed to MARK dependency {:?} as green",
|
|
||||||
dep_node, dep_dep_node
|
|
||||||
);
|
|
||||||
return Some(());
|
return Some(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We failed to mark it green, so we try to force the query.
|
// We failed to mark it green, so we try to force the query.
|
||||||
debug!(
|
debug!("trying to force dependency {dep_dep_node:?}");
|
||||||
"try_mark_previous_green({:?}) --- trying to force dependency {:?}",
|
|
||||||
dep_node, dep_dep_node
|
|
||||||
);
|
|
||||||
if !tcx.dep_context().try_force_from_dep_node(*dep_dep_node) {
|
if !tcx.dep_context().try_force_from_dep_node(*dep_dep_node) {
|
||||||
// The DepNode could not be forced.
|
// The DepNode could not be forced.
|
||||||
debug!(
|
debug!("dependency {dep_dep_node:?} could not be forced");
|
||||||
"try_mark_previous_green({:?}) - END - dependency {:?} could not be forced",
|
|
||||||
dep_node, dep_dep_node
|
|
||||||
);
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,17 +657,11 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
|
|
||||||
match dep_dep_node_color {
|
match dep_dep_node_color {
|
||||||
Some(DepNodeColor::Green(_)) => {
|
Some(DepNodeColor::Green(_)) => {
|
||||||
debug!(
|
debug!("managed to FORCE dependency {dep_dep_node:?} to green");
|
||||||
"try_mark_previous_green({:?}) --- managed to FORCE dependency {:?} to green",
|
|
||||||
dep_node, dep_dep_node
|
|
||||||
);
|
|
||||||
return Some(());
|
return Some(());
|
||||||
}
|
}
|
||||||
Some(DepNodeColor::Red) => {
|
Some(DepNodeColor::Red) => {
|
||||||
debug!(
|
debug!("dependency {dep_dep_node:?} was red after forcing",);
|
||||||
"try_mark_previous_green({:?}) - END - dependency {:?} was red after forcing",
|
|
||||||
dep_node, dep_dep_node
|
|
||||||
);
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -702,14 +681,12 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
// invalid state will not be persisted to the
|
// invalid state will not be persisted to the
|
||||||
// incremental compilation cache because of
|
// incremental compilation cache because of
|
||||||
// compilation errors being present.
|
// compilation errors being present.
|
||||||
debug!(
|
debug!("dependency {dep_dep_node:?} resulted in compilation error",);
|
||||||
"try_mark_previous_green({:?}) - END - dependency {:?} resulted in compilation error",
|
|
||||||
dep_node, dep_dep_node
|
|
||||||
);
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to mark a dep-node which existed in the previous compilation session as green.
|
/// Try to mark a dep-node which existed in the previous compilation session as green.
|
||||||
|
#[instrument(skip(self, tcx, data, prev_dep_node_index), level = "debug")]
|
||||||
fn try_mark_previous_green<Ctxt: QueryContext<DepKind = K>>(
|
fn try_mark_previous_green<Ctxt: QueryContext<DepKind = K>>(
|
||||||
&self,
|
&self,
|
||||||
tcx: Ctxt,
|
tcx: Ctxt,
|
||||||
|
@ -717,8 +694,6 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
prev_dep_node_index: SerializedDepNodeIndex,
|
prev_dep_node_index: SerializedDepNodeIndex,
|
||||||
dep_node: &DepNode<K>,
|
dep_node: &DepNode<K>,
|
||||||
) -> Option<DepNodeIndex> {
|
) -> Option<DepNodeIndex> {
|
||||||
debug!("try_mark_previous_green({:?}) - BEGIN", dep_node);
|
|
||||||
|
|
||||||
#[cfg(not(parallel_compiler))]
|
#[cfg(not(parallel_compiler))]
|
||||||
{
|
{
|
||||||
debug_assert!(!self.dep_node_exists(dep_node));
|
debug_assert!(!self.dep_node_exists(dep_node));
|
||||||
|
@ -772,7 +747,7 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
// Multiple threads can all write the same color here
|
// Multiple threads can all write the same color here
|
||||||
data.colors.insert(prev_dep_node_index, DepNodeColor::Green(dep_node_index));
|
data.colors.insert(prev_dep_node_index, DepNodeColor::Green(dep_node_index));
|
||||||
|
|
||||||
debug!("try_mark_previous_green({:?}) - END - successfully marked as green", dep_node);
|
debug!("successfully marked {dep_node:?} as green");
|
||||||
Some(dep_node_index)
|
Some(dep_node_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,8 @@ pub trait DepContext: Copy {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to force a dep node to execute and see if it's green.
|
/// Try to force a dep node to execute and see if it's green.
|
||||||
|
#[instrument(skip(self), level = "debug")]
|
||||||
fn try_force_from_dep_node(self, dep_node: DepNode<Self::DepKind>) -> bool {
|
fn try_force_from_dep_node(self, dep_node: DepNode<Self::DepKind>) -> bool {
|
||||||
debug!("try_force_from_dep_node({:?}) --- trying to force", dep_node);
|
|
||||||
|
|
||||||
let cb = self.dep_kind_info(dep_node.kind);
|
let cb = self.dep_kind_info(dep_node.kind);
|
||||||
if let Some(f) = cb.force_from_dep_node {
|
if let Some(f) = cb.force_from_dep_node {
|
||||||
f(self, dep_node);
|
f(self, dep_node);
|
||||||
|
|
|
@ -563,6 +563,7 @@ where
|
||||||
Some((result, dep_node_index))
|
Some((result, dep_node_index))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(skip(tcx, result, query), level = "debug")]
|
||||||
fn incremental_verify_ich<CTX, K, V: Debug>(
|
fn incremental_verify_ich<CTX, K, V: Debug>(
|
||||||
tcx: CTX::DepContext,
|
tcx: CTX::DepContext,
|
||||||
result: &V,
|
result: &V,
|
||||||
|
@ -577,12 +578,11 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
|
||||||
dep_node,
|
dep_node,
|
||||||
);
|
);
|
||||||
|
|
||||||
debug!("BEGIN verify_ich({:?})", dep_node);
|
|
||||||
let new_hash = query.hash_result.map_or(Fingerprint::ZERO, |f| {
|
let new_hash = query.hash_result.map_or(Fingerprint::ZERO, |f| {
|
||||||
tcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, result))
|
tcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, result))
|
||||||
});
|
});
|
||||||
|
|
||||||
let old_hash = tcx.dep_graph().prev_fingerprint_of(dep_node);
|
let old_hash = tcx.dep_graph().prev_fingerprint_of(dep_node);
|
||||||
debug!("END verify_ich({:?})", dep_node);
|
|
||||||
|
|
||||||
if Some(new_hash) != old_hash {
|
if Some(new_hash) != old_hash {
|
||||||
incremental_verify_ich_failed(
|
incremental_verify_ich_failed(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue