@@ -191,13 +191,8 @@ pub(crate) fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) {
191191
192192 let mut string_cache = QueryKeyStringCache :: new ( ) ;
193193
194- for_each_query_vtable ! ( ALL , tcx, |query: & QueryVTable <' _, _>| {
195- alloc_self_profile_query_strings_for_query_cache(
196- tcx,
197- query. name,
198- & query. cache,
199- & mut string_cache,
200- ) ;
194+ for_each_query_vtable ! ( ALL , tcx, |query| {
195+ alloc_self_profile_query_strings_for_query_cache( tcx, query, & mut string_cache) ;
201196 } ) ;
202197
203198 tcx. sess . prof . store_query_cache_hits ( ) ;
@@ -208,8 +203,7 @@ pub(crate) fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) {
208203/// the queries via macro magic.
209204fn alloc_self_profile_query_strings_for_query_cache < ' tcx , C > (
210205 tcx : TyCtxt < ' tcx > ,
211- query_name : & ' static str ,
212- query_cache : & C ,
206+ query : & ' tcx QueryVTable < ' tcx , C > ,
213207 string_cache : & mut QueryKeyStringCache ,
214208) where
215209 C : QueryCache ,
@@ -224,14 +218,14 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
224218 if profiler. query_key_recording_enabled ( ) {
225219 let mut query_string_builder = QueryKeyStringBuilder :: new ( profiler, tcx, string_cache) ;
226220
227- let query_name = profiler. get_or_alloc_cached_string ( query_name ) ;
221+ let query_name = profiler. get_or_alloc_cached_string ( query . name ) ;
228222
229223 // Since building the string representation of query keys might
230224 // need to invoke queries itself, we cannot keep the query caches
231225 // locked while doing so. Instead we copy out the
232226 // `(query_key, dep_node_index)` pairs and release the lock again.
233227 let mut query_keys_and_indices = Vec :: new ( ) ;
234- query_cache . for_each ( & mut |k, _, i| query_keys_and_indices. push ( ( * k, i) ) ) ;
228+ query . cache . for_each ( & mut |k, _, i| query_keys_and_indices. push ( ( * k, i) ) ) ;
235229
236230 // Now actually allocate the strings. If allocating the strings
237231 // generates new entries in the query cache, we'll miss them but
@@ -252,14 +246,14 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
252246 }
253247 } else {
254248 // In this branch we don't allocate query keys
255- let query_name = profiler. get_or_alloc_cached_string ( query_name ) ;
249+ let query_name = profiler. get_or_alloc_cached_string ( query . name ) ;
256250 let event_id = event_id_builder. from_label ( query_name) . to_string_id ( ) ;
257251
258252 // FIXME(eddyb) make this O(1) by using a pre-cached query name `EventId`,
259253 // instead of passing the `DepNodeIndex` to `finish_with_query_invocation_id`,
260254 // when recording the event in the first place.
261255 let mut query_invocation_ids = Vec :: new ( ) ;
262- query_cache . for_each ( & mut |_, _, i| {
256+ query . cache . for_each ( & mut |_, _, i| {
263257 query_invocation_ids. push ( i. into ( ) ) ;
264258 } ) ;
265259
0 commit comments