@@ -32,6 +32,7 @@ use middle::lang_items;
32
32
use middle:: resolve_lifetime:: { self , ObjectLifetimeDefault } ;
33
33
use middle:: stability;
34
34
use mir:: { self , Mir , interpret} ;
35
+ use mir:: interpret:: Allocation ;
35
36
use ty:: subst:: { Kind , Substs , Subst } ;
36
37
use ty:: ReprOptions ;
37
38
use ty:: Instance ;
@@ -914,6 +915,9 @@ pub struct GlobalCtxt<'tcx> {
914
915
915
916
stability_interner : Lock < FxHashSet < & ' tcx attr:: Stability > > ,
916
917
918
+ /// Stores the value of constants (and deduplicates the actual memory)
919
+ allocation_interner : Lock < FxHashSet < & ' tcx Allocation > > ,
920
+
917
921
pub interpret_interner : InterpretInterner < ' tcx > ,
918
922
919
923
layout_interner : Lock < FxHashSet < & ' tcx LayoutDetails > > ,
@@ -937,9 +941,6 @@ pub struct InterpretInterner<'tcx> {
937
941
938
942
#[ derive( Debug , Default ) ]
939
943
struct InterpretInternerInner < ' tcx > {
940
- /// Stores the value of constants (and deduplicates the actual memory)
941
- allocs : FxHashSet < & ' tcx interpret:: Allocation > ,
942
-
943
944
/// Allows obtaining function instance handles via a unique identifier
944
945
functions : FxHashMap < interpret:: AllocId , Instance < ' tcx > > ,
945
946
@@ -1104,9 +1105,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1104
1105
1105
1106
pub fn intern_const_alloc (
1106
1107
self ,
1107
- alloc : interpret :: Allocation ,
1108
- ) -> & ' gcx interpret :: Allocation {
1109
- let allocs = & mut self . interpret_interner . inner . borrow_mut ( ) . allocs ;
1108
+ alloc : Allocation ,
1109
+ ) -> & ' gcx Allocation {
1110
+ let allocs = & mut self . allocation_interner . borrow_mut ( ) ;
1110
1111
if let Some ( alloc) = allocs. get ( & alloc) {
1111
1112
return alloc;
1112
1113
}
@@ -1277,6 +1278,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1277
1278
data_layout,
1278
1279
layout_interner : Lock :: new ( FxHashSet ( ) ) ,
1279
1280
stability_interner : Lock :: new ( FxHashSet ( ) ) ,
1281
+ allocation_interner : Lock :: new ( FxHashSet ( ) ) ,
1280
1282
interpret_interner : Default :: default ( ) ,
1281
1283
tx_to_llvm_workers : Lock :: new ( tx) ,
1282
1284
output_filenames : Arc :: new ( output_filenames. clone ( ) ) ,
@@ -2007,7 +2009,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
2007
2009
println ! ( "Substs interner: #{}" , self . interners. substs. borrow( ) . len( ) ) ;
2008
2010
println ! ( "Region interner: #{}" , self . interners. region. borrow( ) . len( ) ) ;
2009
2011
println ! ( "Stability interner: #{}" , self . stability_interner. borrow( ) . len( ) ) ;
2010
- println ! ( "Interpret interner: #{}" , self . interpret_interner . inner . borrow( ) . allocs . len( ) ) ;
2012
+ println ! ( "Allocation interner: #{}" , self . allocation_interner . borrow( ) . len( ) ) ;
2011
2013
println ! ( "Layout interner: #{}" , self . layout_interner. borrow( ) . len( ) ) ;
2012
2014
}
2013
2015
}
0 commit comments