@@ -53,7 +53,7 @@ use smallvec::SmallVec;
5353use rustc_data_structures:: stable_hasher:: { HashStable , hash_stable_hashmap,
5454 StableHasher , StableHasherResult ,
5555 StableVec } ;
56- use arena:: { TypedArena , SyncDroplessArena } ;
56+ use arena:: SyncDroplessArena ;
5757use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
5858use rustc_data_structures:: sync:: { Lrc , Lock , WorkerLocal } ;
5959use std:: any:: Any ;
@@ -79,37 +79,18 @@ use syntax_pos::Span;
7979
8080use crate :: hir;
8181
82- pub struct AllArenas < ' tcx > {
83- pub global : WorkerLocal < GlobalArenas < ' tcx > > ,
82+ pub struct AllArenas {
8483 pub interner : SyncDroplessArena ,
8584}
8685
87- impl < ' tcx > AllArenas < ' tcx > {
86+ impl AllArenas {
8887 pub fn new ( ) -> Self {
8988 AllArenas {
90- global : WorkerLocal :: new ( |_| GlobalArenas :: default ( ) ) ,
9189 interner : SyncDroplessArena :: default ( ) ,
9290 }
9391 }
9492}
9593
96- /// Internal storage
97- #[ derive( Default ) ]
98- pub struct GlobalArenas < ' tcx > {
99- // internings
100- layout : TypedArena < LayoutDetails > ,
101-
102- // references
103- generics : TypedArena < ty:: Generics > ,
104- trait_def : TypedArena < ty:: TraitDef > ,
105- adt_def : TypedArena < ty:: AdtDef > ,
106- steal_mir : TypedArena < Steal < Body < ' tcx > > > ,
107- mir : TypedArena < Body < ' tcx > > ,
108- tables : TypedArena < ty:: TypeckTables < ' tcx > > ,
109- /// miri allocations
110- const_allocs : TypedArena < interpret:: Allocation > ,
111- }
112-
11394type InternedSet < ' tcx , T > = Lock < FxHashMap < Interned < ' tcx , T > , ( ) > > ;
11495
11596pub struct CtxtInterners < ' tcx > {
@@ -1043,7 +1024,7 @@ impl<'gcx> Deref for TyCtxt<'_, 'gcx, '_> {
10431024
10441025pub struct GlobalCtxt < ' tcx > {
10451026 pub arena : WorkerLocal < Arena < ' tcx > > ,
1046- global_arenas : & ' tcx WorkerLocal < GlobalArenas < ' tcx > > ,
1027+
10471028 global_interners : CtxtInterners < ' tcx > ,
10481029
10491030 cstore : & ' tcx CrateStoreDyn ,
@@ -1150,24 +1131,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
11501131 & self . hir_map
11511132 }
11521133
1153- pub fn alloc_generics ( self , generics : ty:: Generics ) -> & ' gcx ty:: Generics {
1154- self . global_arenas . generics . alloc ( generics)
1155- }
1156-
11571134 pub fn alloc_steal_mir ( self , mir : Body < ' gcx > ) -> & ' gcx Steal < Body < ' gcx > > {
1158- self . global_arenas . steal_mir . alloc ( Steal :: new ( mir) )
1159- }
1160-
1161- pub fn alloc_mir ( self , mir : Body < ' gcx > ) -> & ' gcx Body < ' gcx > {
1162- self . global_arenas . mir . alloc ( mir)
1163- }
1164-
1165- pub fn alloc_tables ( self , tables : ty:: TypeckTables < ' gcx > ) -> & ' gcx ty:: TypeckTables < ' gcx > {
1166- self . global_arenas . tables . alloc ( tables)
1167- }
1168-
1169- pub fn alloc_trait_def ( self , def : ty:: TraitDef ) -> & ' gcx ty:: TraitDef {
1170- self . global_arenas . trait_def . alloc ( def)
1135+ self . arena . alloc ( Steal :: new ( mir) )
11711136 }
11721137
11731138 pub fn alloc_adt_def ( self ,
@@ -1177,12 +1142,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
11771142 repr : ReprOptions )
11781143 -> & ' gcx ty:: AdtDef {
11791144 let def = ty:: AdtDef :: new ( self , did, kind, variants, repr) ;
1180- self . global_arenas . adt_def . alloc ( def)
1145+ self . arena . alloc ( def)
11811146 }
11821147
11831148 pub fn intern_const_alloc ( self , alloc : Allocation ) -> & ' gcx Allocation {
11841149 self . allocation_interner . borrow_mut ( ) . intern ( alloc, |alloc| {
1185- self . global_arenas . const_allocs . alloc ( alloc)
1150+ self . arena . alloc ( alloc)
11861151 } )
11871152 }
11881153
@@ -1196,13 +1161,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
11961161
11971162 pub fn intern_stability ( self , stab : attr:: Stability ) -> & ' gcx attr:: Stability {
11981163 self . stability_interner . borrow_mut ( ) . intern ( stab, |stab| {
1199- self . global_interners . arena . alloc ( stab)
1164+ self . arena . alloc ( stab)
12001165 } )
12011166 }
12021167
12031168 pub fn intern_layout ( self , layout : LayoutDetails ) -> & ' gcx LayoutDetails {
12041169 self . layout_interner . borrow_mut ( ) . intern ( layout, |layout| {
1205- self . global_arenas . layout . alloc ( layout)
1170+ self . arena . alloc ( layout)
12061171 } )
12071172 }
12081173
@@ -1250,7 +1215,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
12501215 cstore : & ' tcx CrateStoreDyn ,
12511216 local_providers : ty:: query:: Providers < ' tcx > ,
12521217 extern_providers : ty:: query:: Providers < ' tcx > ,
1253- arenas : & ' tcx AllArenas < ' tcx > ,
1218+ arenas : & ' tcx AllArenas ,
12541219 resolutions : ty:: Resolutions ,
12551220 hir : hir_map:: Map < ' tcx > ,
12561221 on_disk_query_result_cache : query:: OnDiskCache < ' tcx > ,
@@ -1319,7 +1284,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
13191284 sess : s,
13201285 cstore,
13211286 arena : WorkerLocal :: new ( |_| Arena :: default ( ) ) ,
1322- global_arenas : & arenas. global ,
13231287 global_interners : interners,
13241288 dep_graph,
13251289 common,
0 commit comments