Skip to content

Commit bfd14bd

Browse files
committed
Make use of thread-safe arenas
1 parent 19d44f2 commit bfd14bd

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/librustc/hir/map/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use hir::print::Nested;
3232
use hir::svh::Svh;
3333
use util::nodemap::{DefIdMap, FxHashMap};
3434

35-
use arena::TypedArena;
35+
use arena::SyncTypedArena;
3636
use std::io;
3737
use ty::TyCtxt;
3838

@@ -219,15 +219,15 @@ impl<'hir> MapEntry<'hir> {
219219
pub struct Forest {
220220
krate: Crate,
221221
pub dep_graph: DepGraph,
222-
inlined_bodies: TypedArena<Body>
222+
inlined_bodies: SyncTypedArena<Body>
223223
}
224224

225225
impl Forest {
226226
pub fn new(krate: Crate, dep_graph: &DepGraph) -> Forest {
227227
Forest {
228228
krate,
229229
dep_graph: dep_graph.clone(),
230-
inlined_bodies: TypedArena::new()
230+
inlined_bodies: SyncTypedArena::new()
231231
}
232232
}
233233

src/librustc/infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use errors::DiagnosticBuilder;
3737
use syntax_pos::{self, Span};
3838
use syntax_pos::symbol::InternedString;
3939
use util::nodemap::FxHashMap;
40-
use arena::DroplessArena;
40+
use arena::SyncDroplessArena;
4141

4242
use self::combine::CombineFields;
4343
use self::higher_ranked::HrMatchResult;
@@ -407,15 +407,15 @@ impl fmt::Display for FixupError {
407407
/// F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>).
408408
pub struct InferCtxtBuilder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
409409
global_tcx: TyCtxt<'a, 'gcx, 'gcx>,
410-
arena: DroplessArena,
410+
arena: SyncDroplessArena,
411411
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
412412
}
413413

414414
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx> {
415415
pub fn infer_ctxt(self) -> InferCtxtBuilder<'a, 'gcx, 'tcx> {
416416
InferCtxtBuilder {
417417
global_tcx: self,
418-
arena: DroplessArena::new(),
418+
arena: SyncDroplessArena::new(),
419419
fresh_tables: None,
420420

421421
}

src/librustc/ty/context.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use rustc_data_structures::accumulate_vec::AccumulateVec;
5757
use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap,
5858
StableHasher, StableHasherResult,
5959
StableVec};
60-
use arena::{TypedArena, DroplessArena};
60+
use arena::{TypedArena, SyncDroplessArena};
6161
use rustc_data_structures::indexed_vec::IndexVec;
6262
use rustc_data_structures::sync::{Lrc, Lock};
6363
use std::any::Any;
@@ -82,14 +82,14 @@ use hir;
8282

8383
pub struct AllArenas<'tcx> {
8484
pub global: GlobalArenas<'tcx>,
85-
pub interner: DroplessArena,
85+
pub interner: SyncDroplessArena,
8686
}
8787

8888
impl<'tcx> AllArenas<'tcx> {
8989
pub fn new() -> Self {
9090
AllArenas {
9191
global: GlobalArenas::new(),
92-
interner: DroplessArena::new(),
92+
interner: SyncDroplessArena::new(),
9393
}
9494
}
9595
}
@@ -129,7 +129,7 @@ type InternedSet<'tcx, T> = Lock<FxHashSet<Interned<'tcx, T>>>;
129129

130130
pub struct CtxtInterners<'tcx> {
131131
/// The arena that types, regions, etc are allocated from
132-
arena: &'tcx DroplessArena,
132+
arena: &'tcx SyncDroplessArena,
133133

134134
/// Specifically use a speedy hash algorithm for these hash sets,
135135
/// they're accessed quite often.
@@ -146,7 +146,7 @@ pub struct CtxtInterners<'tcx> {
146146
}
147147

148148
impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
149-
fn new(arena: &'tcx DroplessArena) -> CtxtInterners<'tcx> {
149+
fn new(arena: &'tcx SyncDroplessArena) -> CtxtInterners<'tcx> {
150150
CtxtInterners {
151151
arena,
152152
type_: Default::default(),
@@ -1554,7 +1554,7 @@ impl<'gcx: 'tcx, 'tcx> GlobalCtxt<'gcx> {
15541554
/// Call the closure with a local `TyCtxt` using the given arena.
15551555
pub fn enter_local<F, R>(
15561556
&self,
1557-
arena: &'tcx DroplessArena,
1557+
arena: &'tcx SyncDroplessArena,
15581558
f: F
15591559
) -> R
15601560
where

0 commit comments

Comments
 (0)