From bfd14bd90765349e6542cb77206dabe6f11e7c83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 15 Apr 2018 16:01:38 +0200 Subject: [PATCH] Make use of thread-safe arenas --- src/librustc/hir/map/mod.rs | 6 +++--- src/librustc/infer/mod.rs | 6 +++--- src/librustc/ty/context.rs | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 1e348e3a31c..b88185c3154 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -32,7 +32,7 @@ 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 @@ fn is_body_owner(self, node_id: NodeId) -> bool { pub struct Forest { krate: Crate, pub dep_graph: DepGraph, - inlined_bodies: TypedArena + inlined_bodies: SyncTypedArena } impl Forest { @@ -227,7 +227,7 @@ pub fn new(krate: Crate, dep_graph: &DepGraph) -> Forest { Forest { krate, dep_graph: dep_graph.clone(), - inlined_bodies: TypedArena::new() + inlined_bodies: SyncTypedArena::new() } } diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 84bf9cc84e7..40cc43c3ca6 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -37,7 +37,7 @@ 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 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { /// 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>>, } @@ -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, } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 9da83199ec9..fea01725769 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -57,7 +57,7 @@ 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 @@ 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 @@ pub fn new() -> GlobalArenas<'tcx> { 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( &self, - arena: &'tcx DroplessArena, + arena: &'tcx SyncDroplessArena, f: F ) -> R where -- 2.44.0