Move Sharded maps into each QueryCache impl

This commit is contained in:
Mark Rousskov 2022-02-19 22:44:19 -05:00
parent 3b348d932a
commit 9deed6f74e
8 changed files with 53 additions and 122 deletions

View file

@ -4,7 +4,7 @@ use rustc_data_structures::profiling::SelfProfiler;
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::DefPathData;
use rustc_middle::ty::{TyCtxt, WithOptConstParam};
use rustc_query_system::query::{QueryCache, QueryCacheStore};
use rustc_query_system::query::QueryCache;
use std::fmt::Debug;
use std::io::Write;
@ -229,7 +229,7 @@ where
fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
tcx: TyCtxt<'tcx>,
query_name: &'static str,
query_cache: &QueryCacheStore<C>,
query_cache: &C,
string_cache: &mut QueryKeyStringCache,
) where
C: QueryCache,
@ -251,7 +251,7 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
// locked while doing so. Instead we copy out the
// `(query_key, dep_node_index)` pairs and release the lock again.
let mut query_keys_and_indices = Vec::new();
query_cache.iter_results(&mut |k, _, i| query_keys_and_indices.push((k.clone(), i)));
query_cache.iter(&mut |k, _, i| query_keys_and_indices.push((k.clone(), i)));
// Now actually allocate the strings. If allocating the strings
// generates new entries in the query cache, we'll miss them but
@ -276,7 +276,7 @@ fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
let event_id = event_id_builder.from_label(query_name).to_string_id();
let mut query_invocation_ids = Vec::new();
query_cache.iter_results(&mut |_, _, i| {
query_cache.iter(&mut |_, _, i| {
query_invocation_ids.push(i.into());
});