@@ -53,7 +53,7 @@ use smallvec::SmallVec;
53
53
use rustc_data_structures:: stable_hasher:: { HashStable , hash_stable_hashmap,
54
54
StableHasher , StableHasherResult ,
55
55
StableVec } ;
56
- use arena:: { TypedArena , SyncDroplessArena } ;
56
+ use arena:: SyncDroplessArena ;
57
57
use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
58
58
use rustc_data_structures:: sync:: { Lrc , Lock , WorkerLocal } ;
59
59
use std:: any:: Any ;
@@ -79,37 +79,18 @@ use syntax_pos::Span;
79
79
80
80
use crate :: hir;
81
81
82
- pub struct AllArenas < ' tcx > {
83
- pub global : WorkerLocal < GlobalArenas < ' tcx > > ,
82
+ pub struct AllArenas {
84
83
pub interner : SyncDroplessArena ,
85
84
}
86
85
87
- impl < ' tcx > AllArenas < ' tcx > {
86
+ impl AllArenas {
88
87
pub fn new ( ) -> Self {
89
88
AllArenas {
90
- global : WorkerLocal :: new ( |_| GlobalArenas :: default ( ) ) ,
91
89
interner : SyncDroplessArena :: default ( ) ,
92
90
}
93
91
}
94
92
}
95
93
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
-
113
94
type InternedSet < ' tcx , T > = Lock < FxHashMap < Interned < ' tcx , T > , ( ) > > ;
114
95
115
96
pub struct CtxtInterners < ' tcx > {
@@ -1043,7 +1024,7 @@ impl<'gcx> Deref for TyCtxt<'_, 'gcx, '_> {
1043
1024
1044
1025
pub struct GlobalCtxt < ' tcx > {
1045
1026
pub arena : WorkerLocal < Arena < ' tcx > > ,
1046
- global_arenas : & ' tcx WorkerLocal < GlobalArenas < ' tcx > > ,
1027
+
1047
1028
global_interners : CtxtInterners < ' tcx > ,
1048
1029
1049
1030
cstore : & ' tcx CrateStoreDyn ,
@@ -1150,24 +1131,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1150
1131
& self . hir_map
1151
1132
}
1152
1133
1153
- pub fn alloc_generics ( self , generics : ty:: Generics ) -> & ' gcx ty:: Generics {
1154
- self . global_arenas . generics . alloc ( generics)
1155
- }
1156
-
1157
1134
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) )
1171
1136
}
1172
1137
1173
1138
pub fn alloc_adt_def ( self ,
@@ -1177,12 +1142,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1177
1142
repr : ReprOptions )
1178
1143
-> & ' gcx ty:: AdtDef {
1179
1144
let def = ty:: AdtDef :: new ( self , did, kind, variants, repr) ;
1180
- self . global_arenas . adt_def . alloc ( def)
1145
+ self . arena . alloc ( def)
1181
1146
}
1182
1147
1183
1148
pub fn intern_const_alloc ( self , alloc : Allocation ) -> & ' gcx Allocation {
1184
1149
self . allocation_interner . borrow_mut ( ) . intern ( alloc, |alloc| {
1185
- self . global_arenas . const_allocs . alloc ( alloc)
1150
+ self . arena . alloc ( alloc)
1186
1151
} )
1187
1152
}
1188
1153
@@ -1196,13 +1161,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1196
1161
1197
1162
pub fn intern_stability ( self , stab : attr:: Stability ) -> & ' gcx attr:: Stability {
1198
1163
self . stability_interner . borrow_mut ( ) . intern ( stab, |stab| {
1199
- self . global_interners . arena . alloc ( stab)
1164
+ self . arena . alloc ( stab)
1200
1165
} )
1201
1166
}
1202
1167
1203
1168
pub fn intern_layout ( self , layout : LayoutDetails ) -> & ' gcx LayoutDetails {
1204
1169
self . layout_interner . borrow_mut ( ) . intern ( layout, |layout| {
1205
- self . global_arenas . layout . alloc ( layout)
1170
+ self . arena . alloc ( layout)
1206
1171
} )
1207
1172
}
1208
1173
@@ -1250,7 +1215,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1250
1215
cstore : & ' tcx CrateStoreDyn ,
1251
1216
local_providers : ty:: query:: Providers < ' tcx > ,
1252
1217
extern_providers : ty:: query:: Providers < ' tcx > ,
1253
- arenas : & ' tcx AllArenas < ' tcx > ,
1218
+ arenas : & ' tcx AllArenas ,
1254
1219
resolutions : ty:: Resolutions ,
1255
1220
hir : hir_map:: Map < ' tcx > ,
1256
1221
on_disk_query_result_cache : query:: OnDiskCache < ' tcx > ,
@@ -1319,7 +1284,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1319
1284
sess : s,
1320
1285
cstore,
1321
1286
arena : WorkerLocal :: new ( |_| Arena :: default ( ) ) ,
1322
- global_arenas : & arenas. global ,
1323
1287
global_interners : interners,
1324
1288
dep_graph,
1325
1289
common,
0 commit comments