@@ -19,7 +19,6 @@ use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
1919use rustc_session:: Session ;
2020use rustc_span:: Symbol ;
2121use rustc_span:: def_id:: LocalDefId ;
22- use tracing:: instrument;
2322#[ cfg( debug_assertions) ]
2423use { super :: debug:: EdgeFilter , std:: env} ;
2524
@@ -739,6 +738,7 @@ impl DepGraphData {
739738 tcx. sess . used_features . lock ( ) . insert ( * symbol, dep_node_index. as_u32 ( ) ) ;
740739 }
741740 QuerySideEffect :: CreateDef { parent, data } => {
741+ tracing:: trace!( "SIDE-EFFECT create_def_raw({parent:?}, {data:?})" ) ;
742742 tcx. untracked ( ) . definitions . write ( ) . create_def ( * parent, * data) ;
743743 }
744744 }
@@ -775,6 +775,10 @@ impl DepGraphData {
775775 } ;
776776
777777 let value_fingerprint = value_fingerprint. unwrap_or ( Fingerprint :: ZERO ) ;
778+ //tracing::trace!(
779+ // "alloc_and_color_node {key:?} is {}",
780+ // if is_green { "GREEN" } else { "RED" }
781+ //);
778782
779783 let dep_node_index = self . current . encoder . send_and_color (
780784 prev_index,
@@ -892,27 +896,40 @@ impl DepGraphData {
892896 }
893897
894898 /// Try to mark a dep-node which existed in the previous compilation session as green.
895- #[ instrument( skip( self , tcx, prev_dep_node_index, frame) , level = "debug" ) ]
896899 fn try_mark_previous_green < ' tcx > (
897900 & self ,
898901 tcx : TyCtxt < ' tcx > ,
899902 prev_dep_node_index : SerializedDepNodeIndex ,
900903 frame : Option < & MarkFrame < ' _ > > ,
901904 ) -> Option < DepNodeIndex > {
905+ let _span = tracing:: trace_span!(
906+ "try_mark_previous_green" ,
907+ dep_node = ?self . previous. index_to_node( prev_dep_node_index) ,
908+ ) ;
909+ let _span = _span. enter ( ) ;
910+
902911 let frame = MarkFrame { index : prev_dep_node_index, parent : frame } ;
903912
904913 // We never try to mark eval_always nodes as green
905914 debug_assert ! ( !tcx. is_eval_always( self . previous. index_to_node( prev_dep_node_index) . kind) ) ;
906915
907916 for parent_dep_node_index in self . previous . edge_targets_from ( prev_dep_node_index) {
917+ tracing:: trace!( "EXAMINE {:?}" , self . previous. index_to_node( parent_dep_node_index) , ) ;
908918 match self . colors . get ( parent_dep_node_index) {
909919 // This dependency has been marked as green before, we are still ok and can
910920 // continue checking the remaining dependencies.
911921 DepNodeColor :: Green ( _) => continue ,
912922
913923 // This dependency's result is different to the previous compilation session. We
914924 // cannot mark this dep_node as green, so stop checking.
915- DepNodeColor :: Red => return None ,
925+ DepNodeColor :: Red => {
926+ tracing:: trace!(
927+ "RECOMPUTE {:?} BECAUSE KNOWN RED {:?}" ,
928+ self . previous. index_to_node( prev_dep_node_index) ,
929+ self . previous. index_to_node( parent_dep_node_index) ,
930+ ) ;
931+ return None ;
932+ }
916933
917934 // We still need to determine this dependency's colour.
918935 DepNodeColor :: Unknown => { }
@@ -929,12 +946,24 @@ impl DepGraphData {
929946
930947 // We failed to mark it green, so we try to force the query.
931948 if !tcx. try_force_from_dep_node ( * parent_dep_node, parent_dep_node_index, & frame) {
949+ tracing:: trace!(
950+ "RECOMPUTE {:?} BECAUSE UNFORCEABLE {:?}" ,
951+ self . previous. index_to_node( prev_dep_node_index) ,
952+ parent_dep_node,
953+ ) ;
932954 return None ;
933955 }
934956
935957 match self . colors . get ( parent_dep_node_index) {
936958 DepNodeColor :: Green ( _) => continue ,
937- DepNodeColor :: Red => return None ,
959+ DepNodeColor :: Red => {
960+ tracing:: trace!(
961+ "RECOMPUTE {:?} BECAUSE NEWLY RED {:?}" ,
962+ self . previous. index_to_node( prev_dep_node_index) ,
963+ parent_dep_node,
964+ ) ;
965+ return None ;
966+ }
938967 DepNodeColor :: Unknown => { }
939968 }
940969
0 commit comments