Make use of thread-safe arenas
This commit is contained in:
parent
19d44f2d24
commit
bfd14bd907
3 changed files with 12 additions and 12 deletions
|
|
@ -32,7 +32,7 @@ use hir::print::Nested;
|
|||
use hir::svh::Svh;
|
||||
use util::nodemap::{DefIdMap, FxHashMap};
|
||||
|
||||
use arena::TypedArena;
|
||||
use arena::SyncTypedArena;
|
||||
use std::io;
|
||||
use ty::TyCtxt;
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ impl<'hir> MapEntry<'hir> {
|
|||
pub struct Forest {
|
||||
krate: Crate,
|
||||
pub dep_graph: DepGraph,
|
||||
inlined_bodies: TypedArena<Body>
|
||||
inlined_bodies: SyncTypedArena<Body>
|
||||
}
|
||||
|
||||
impl Forest {
|
||||
|
|
@ -227,7 +227,7 @@ impl Forest {
|
|||
Forest {
|
||||
krate,
|
||||
dep_graph: dep_graph.clone(),
|
||||
inlined_bodies: TypedArena::new()
|
||||
inlined_bodies: SyncTypedArena::new()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ use errors::DiagnosticBuilder;
|
|||
use syntax_pos::{self, Span};
|
||||
use syntax_pos::symbol::InternedString;
|
||||
use util::nodemap::FxHashMap;
|
||||
use arena::DroplessArena;
|
||||
use arena::SyncDroplessArena;
|
||||
|
||||
use self::combine::CombineFields;
|
||||
use self::higher_ranked::HrMatchResult;
|
||||
|
|
@ -407,7 +407,7 @@ impl fmt::Display for FixupError {
|
|||
/// F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>).
|
||||
pub struct InferCtxtBuilder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
global_tcx: TyCtxt<'a, 'gcx, 'gcx>,
|
||||
arena: DroplessArena,
|
||||
arena: SyncDroplessArena,
|
||||
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
|
||||
}
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx> {
|
|||
pub fn infer_ctxt(self) -> InferCtxtBuilder<'a, 'gcx, 'tcx> {
|
||||
InferCtxtBuilder {
|
||||
global_tcx: self,
|
||||
arena: DroplessArena::new(),
|
||||
arena: SyncDroplessArena::new(),
|
||||
fresh_tables: None,
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ use rustc_data_structures::accumulate_vec::AccumulateVec;
|
|||
use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap,
|
||||
StableHasher, StableHasherResult,
|
||||
StableVec};
|
||||
use arena::{TypedArena, DroplessArena};
|
||||
use arena::{TypedArena, SyncDroplessArena};
|
||||
use rustc_data_structures::indexed_vec::IndexVec;
|
||||
use rustc_data_structures::sync::{Lrc, Lock};
|
||||
use std::any::Any;
|
||||
|
|
@ -82,14 +82,14 @@ use hir;
|
|||
|
||||
pub struct AllArenas<'tcx> {
|
||||
pub global: GlobalArenas<'tcx>,
|
||||
pub interner: DroplessArena,
|
||||
pub interner: SyncDroplessArena,
|
||||
}
|
||||
|
||||
impl<'tcx> AllArenas<'tcx> {
|
||||
pub fn new() -> Self {
|
||||
AllArenas {
|
||||
global: GlobalArenas::new(),
|
||||
interner: DroplessArena::new(),
|
||||
interner: SyncDroplessArena::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ type InternedSet<'tcx, T> = Lock<FxHashSet<Interned<'tcx, T>>>;
|
|||
|
||||
pub struct CtxtInterners<'tcx> {
|
||||
/// The arena that types, regions, etc are allocated from
|
||||
arena: &'tcx DroplessArena,
|
||||
arena: &'tcx SyncDroplessArena,
|
||||
|
||||
/// Specifically use a speedy hash algorithm for these hash sets,
|
||||
/// they're accessed quite often.
|
||||
|
|
@ -146,7 +146,7 @@ pub struct CtxtInterners<'tcx> {
|
|||
}
|
||||
|
||||
impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
|
||||
fn new(arena: &'tcx DroplessArena) -> CtxtInterners<'tcx> {
|
||||
fn new(arena: &'tcx SyncDroplessArena) -> CtxtInterners<'tcx> {
|
||||
CtxtInterners {
|
||||
arena,
|
||||
type_: Default::default(),
|
||||
|
|
@ -1554,7 +1554,7 @@ impl<'gcx: 'tcx, 'tcx> GlobalCtxt<'gcx> {
|
|||
/// Call the closure with a local `TyCtxt` using the given arena.
|
||||
pub fn enter_local<F, R>(
|
||||
&self,
|
||||
arena: &'tcx DroplessArena,
|
||||
arena: &'tcx SyncDroplessArena,
|
||||
f: F
|
||||
) -> R
|
||||
where
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue