Skip to content

Commit 99cc3e8

Browse files
committed
Try without CtxtInterners
1 parent 8b9c4b9 commit 99cc3e8

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

compiler/rustc_middle/src/ty/context.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ use rustc_data_structures::fx::FxHashMap;
2323
use rustc_data_structures::intern::Interned;
2424
use rustc_data_structures::jobserver::Proxy;
2525
use rustc_data_structures::profiling::SelfProfilerRef;
26-
use rustc_data_structures::sharded::IntoPointer;
26+
use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
2727
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2828
use rustc_data_structures::steal::Steal;
2929
use rustc_data_structures::sync::{
30-
self, DynSend, DynSync, FreezeReadGuard, Lock, RwLock, SyncTable, WorkerLocal,
30+
self, DynSend, DynSync, FreezeReadGuard, Lock, RwLock, WorkerLocal,
3131
};
3232
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, MultiSpan};
3333
use rustc_hir::def::DefKind;
@@ -132,7 +132,7 @@ impl<'tcx> rustc_type_ir::inherent::Span<TyCtxt<'tcx>> for Span {
132132
}
133133
}
134134

135-
type InternedSet<'tcx, T> = SyncTable<InternedInSet<'tcx, T>, ()>;
135+
type InternedSet<'tcx, T> = ShardedHashMap<InternedInSet<'tcx, T>, ()>;
136136

137137
pub struct CtxtInterners<'tcx> {
138138
/// The arena that types, regions, etc. are allocated from.
@@ -1804,7 +1804,6 @@ macro_rules! sty_debug_print {
18041804
mod inner {
18051805
use crate::ty::{self, TyCtxt};
18061806
use crate::ty::context::InternedInSet;
1807-
use rustc_data_structures::sync::collect::pin;
18081807

18091808
#[derive(Copy, Clone)]
18101809
struct DebugStat {
@@ -1825,11 +1824,11 @@ macro_rules! sty_debug_print {
18251824
};
18261825
$(let mut $variant = total;)*
18271826

1828-
pin(|pin| {
1827+
for shard in tcx.interners.type_.lock_shards() {
18291828
// It seems that ordering doesn't affect anything here.
18301829
#[allow(rustc::potential_query_instability)]
1831-
let types = tcx.interners.type_.read(pin);
1832-
for (&InternedInSet(t), _) in types.iter() {
1830+
let types = shard.iter();
1831+
for &(InternedInSet(t), ()) in types {
18331832
let variant = match t.internee {
18341833
ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) |
18351834
ty::Float(..) | ty::Str | ty::Never => continue,
@@ -1847,7 +1846,7 @@ macro_rules! sty_debug_print {
18471846
if ct { total.ct_infer += 1; variant.ct_infer += 1 }
18481847
if lt && ty && ct { total.all_infer += 1; variant.all_infer += 1 }
18491848
}
1850-
});
1849+
}
18511850
writeln!(fmt, "Ty interner total ty lt ct all")?;
18521851
$(writeln!(fmt, " {:18}: {uses:6} {usespc:4.1}%, \
18531852
{ty:4.1}% {lt:5.1}% {ct:4.1}% {all:4.1}%",

0 commit comments

Comments
 (0)