11use rustc_data_structures:: fingerprint:: Fingerprint ;
22use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
33use rustc_data_structures:: profiling:: QueryInvocationId ;
4+ use rustc_data_structures:: profiling:: SelfProfilerRef ;
45use rustc_data_structures:: sharded:: { self , Sharded } ;
56use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
67use rustc_data_structures:: steal:: Steal ;
@@ -241,6 +242,7 @@ impl<K: DepKind> DepGraph<K> {
241242
242243 // Intern the new `DepNode`.
243244 let ( dep_node_index, prev_and_color) = data. current . intern_node (
245+ dcx. profiler ( ) ,
244246 & data. previous ,
245247 key,
246248 edges,
@@ -271,7 +273,12 @@ impl<K: DepKind> DepGraph<K> {
271273
272274 /// Executes something within an "anonymous" task, that is, a task the
273275 /// `DepNode` of which is determined by the list of inputs it read from.
274- pub fn with_anon_task < OP , R > ( & self , dep_kind : K , op : OP ) -> ( R , DepNodeIndex )
276+ pub fn with_anon_task < Ctxt : DepContext < DepKind = K > , OP , R > (
277+ & self ,
278+ cx : Ctxt ,
279+ dep_kind : K ,
280+ op : OP ,
281+ ) -> ( R , DepNodeIndex )
275282 where
276283 OP : FnOnce ( ) -> R ,
277284 {
@@ -298,8 +305,12 @@ impl<K: DepKind> DepGraph<K> {
298305 hash : data. current . anon_id_seed . combine ( hasher. finish ( ) ) . into ( ) ,
299306 } ;
300307
301- let dep_node_index =
302- data. current . intern_new_node ( target_dep_node, task_deps. reads , Fingerprint :: ZERO ) ;
308+ let dep_node_index = data. current . intern_new_node (
309+ cx. profiler ( ) ,
310+ target_dep_node,
311+ task_deps. reads ,
312+ Fingerprint :: ZERO ,
313+ ) ;
303314
304315 ( result, dep_node_index)
305316 } else {
@@ -628,8 +639,11 @@ impl<K: DepKind> DepGraph<K> {
628639
629640 // We allocating an entry for the node in the current dependency graph and
630641 // adding all the appropriate edges imported from the previous graph
631- let dep_node_index =
632- data. current . promote_node_and_deps_to_current ( & data. previous , prev_dep_node_index) ;
642+ let dep_node_index = data. current . promote_node_and_deps_to_current (
643+ tcx. dep_context ( ) . profiler ( ) ,
644+ & data. previous ,
645+ prev_dep_node_index,
646+ ) ;
633647
634648 // ... emitting any stored diagnostic ...
635649
@@ -943,14 +957,16 @@ impl<K: DepKind> CurrentDepGraph<K> {
943957 /// Assumes that this is a node that has no equivalent in the previous dep-graph.
944958 fn intern_new_node (
945959 & self ,
960+ profiler : & SelfProfilerRef ,
946961 key : DepNode < K > ,
947962 edges : EdgesVec ,
948963 current_fingerprint : Fingerprint ,
949964 ) -> DepNodeIndex {
950965 match self . new_node_to_index . get_shard_by_value ( & key) . lock ( ) . entry ( key) {
951966 Entry :: Occupied ( entry) => * entry. get ( ) ,
952967 Entry :: Vacant ( entry) => {
953- let dep_node_index = self . encoder . borrow ( ) . send ( key, current_fingerprint, edges) ;
968+ let dep_node_index =
969+ self . encoder . borrow ( ) . send ( profiler, key, current_fingerprint, edges) ;
954970 entry. insert ( dep_node_index) ;
955971 #[ cfg( debug_assertions) ]
956972 self . record_edge ( dep_node_index, key) ;
@@ -961,6 +977,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
961977
962978 fn intern_node (
963979 & self ,
980+ profiler : & SelfProfilerRef ,
964981 prev_graph : & PreviousDepGraph < K > ,
965982 key : DepNode < K > ,
966983 edges : EdgesVec ,
@@ -985,7 +1002,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
9851002 Some ( dep_node_index) => dep_node_index,
9861003 None => {
9871004 let dep_node_index =
988- self . encoder . borrow ( ) . send ( key, fingerprint, edges) ;
1005+ self . encoder . borrow ( ) . send ( profiler , key, fingerprint, edges) ;
9891006 prev_index_to_index[ prev_index] = Some ( dep_node_index) ;
9901007 dep_node_index
9911008 }
@@ -1007,7 +1024,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
10071024 Some ( dep_node_index) => dep_node_index,
10081025 None => {
10091026 let dep_node_index =
1010- self . encoder . borrow ( ) . send ( key, fingerprint, edges) ;
1027+ self . encoder . borrow ( ) . send ( profiler , key, fingerprint, edges) ;
10111028 prev_index_to_index[ prev_index] = Some ( dep_node_index) ;
10121029 dep_node_index
10131030 }
@@ -1032,7 +1049,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
10321049 Some ( dep_node_index) => dep_node_index,
10331050 None => {
10341051 let dep_node_index =
1035- self . encoder . borrow ( ) . send ( key, Fingerprint :: ZERO , edges) ;
1052+ self . encoder . borrow ( ) . send ( profiler , key, Fingerprint :: ZERO , edges) ;
10361053 prev_index_to_index[ prev_index] = Some ( dep_node_index) ;
10371054 dep_node_index
10381055 }
@@ -1050,14 +1067,15 @@ impl<K: DepKind> CurrentDepGraph<K> {
10501067 let fingerprint = fingerprint. unwrap_or ( Fingerprint :: ZERO ) ;
10511068
10521069 // This is a new node: it didn't exist in the previous compilation session.
1053- let dep_node_index = self . intern_new_node ( key, edges, fingerprint) ;
1070+ let dep_node_index = self . intern_new_node ( profiler , key, edges, fingerprint) ;
10541071
10551072 ( dep_node_index, None )
10561073 }
10571074 }
10581075
10591076 fn promote_node_and_deps_to_current (
10601077 & self ,
1078+ profiler : & SelfProfilerRef ,
10611079 prev_graph : & PreviousDepGraph < K > ,
10621080 prev_index : SerializedDepNodeIndex ,
10631081 ) -> DepNodeIndex {
@@ -1070,6 +1088,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
10701088 None => {
10711089 let key = prev_graph. index_to_node ( prev_index) ;
10721090 let dep_node_index = self . encoder . borrow ( ) . send (
1091+ profiler,
10731092 key,
10741093 prev_graph. fingerprint_by_index ( prev_index) ,
10751094 prev_graph
0 commit comments