]> git.lizzy.rs Git - rust.git/commitdiff
Have worker-local GlobalArenas
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Mon, 22 Jan 2018 13:31:23 +0000 (14:31 +0100)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Fri, 1 Jun 2018 12:57:08 +0000 (14:57 +0200)
src/librustc/ty/context.rs

index 0facbc6922aff9674fae202c98ad3797ccdb2928..27cc9514e65bf2d54a0e741136a59f0a0d084fca 100644 (file)
@@ -58,7 +58,7 @@
                                            StableVec};
 use arena::{TypedArena, SyncDroplessArena};
 use rustc_data_structures::indexed_vec::IndexVec;
-use rustc_data_structures::sync::{Lrc, Lock};
+use rustc_data_structures::sync::{Lrc, Lock, WorkerLocal};
 use std::any::Any;
 use std::borrow::Borrow;
 use std::cmp::Ordering;
 use hir;
 
 pub struct AllArenas<'tcx> {
-    pub global: GlobalArenas<'tcx>,
+    pub global: WorkerLocal<GlobalArenas<'tcx>>,
     pub interner: SyncDroplessArena,
 }
 
 impl<'tcx> AllArenas<'tcx> {
     pub fn new() -> Self {
         AllArenas {
-            global: GlobalArenas::new(),
+            global: WorkerLocal::new(|_| GlobalArenas::new()),
             interner: SyncDroplessArena::new(),
         }
     }
@@ -854,7 +854,7 @@ fn deref(&self) -> &Self::Target {
 }
 
 pub struct GlobalCtxt<'tcx> {
-    global_arenas: &'tcx GlobalArenas<'tcx>,
+    global_arenas: &'tcx WorkerLocal<GlobalArenas<'tcx>>,
     global_interners: CtxtInterners<'tcx>,
 
     cstore: &'tcx CrateStoreDyn,