11use byteorder:: { ReadBytesExt , WriteBytesExt , LittleEndian , BigEndian } ;
2- use std:: collections:: { btree_map, BTreeMap , HashMap , HashSet , VecDeque } ;
2+ use std:: collections:: { btree_map, BTreeMap , VecDeque } ;
33use std:: { ptr, io} ;
44
55use rustc:: ty:: Instance ;
66use rustc:: ty:: maps:: TyCtxtAt ;
77use rustc:: ty:: layout:: { self , Align , TargetDataLayout } ;
88use syntax:: ast:: Mutability ;
99
10+ use rustc_data_structures:: fx:: { FxHashSet , FxHashMap } ;
1011use rustc:: mir:: interpret:: { MemoryPointer , AllocId , Allocation , AccessKind , UndefMask , Value , Pointer ,
1112 EvalResult , PrimVal , EvalErrorKind } ;
1213
@@ -33,15 +34,15 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx>> {
3334 pub data : M :: MemoryData ,
3435
3536 /// Helps guarantee that stack allocations aren't deallocated via `rust_deallocate`
36- alloc_kind : HashMap < AllocId , MemoryKind < M :: MemoryKinds > > ,
37+ alloc_kind : FxHashMap < AllocId , MemoryKind < M :: MemoryKinds > > ,
3738
3839 /// Actual memory allocations (arbitrary bytes, may contain pointers into other allocations).
39- alloc_map : HashMap < AllocId , Allocation > ,
40+ alloc_map : FxHashMap < AllocId , Allocation > ,
4041
4142 /// Actual memory allocations (arbitrary bytes, may contain pointers into other allocations).
4243 ///
4344 /// Stores statics while they are being processed, before they are interned and thus frozen
44- uninitialized_statics : HashMap < AllocId , Allocation > ,
45+ uninitialized_statics : FxHashMap < AllocId , Allocation > ,
4546
4647 /// The current stack frame. Used to check accesses against locks.
4748 pub cur_frame : usize ,
@@ -53,9 +54,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
5354 pub fn new ( tcx : TyCtxtAt < ' a , ' tcx , ' tcx > , data : M :: MemoryData ) -> Self {
5455 Memory {
5556 data,
56- alloc_kind : HashMap :: new ( ) ,
57- alloc_map : HashMap :: new ( ) ,
58- uninitialized_statics : HashMap :: new ( ) ,
57+ alloc_kind : FxHashMap :: default ( ) ,
58+ alloc_map : FxHashMap :: default ( ) ,
59+ uninitialized_statics : FxHashMap :: default ( ) ,
5960 tcx,
6061 cur_frame : usize:: max_value ( ) ,
6162 }
@@ -338,7 +339,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
338339 allocs. sort ( ) ;
339340 allocs. dedup ( ) ;
340341 let mut allocs_to_print = VecDeque :: from ( allocs) ;
341- let mut allocs_seen = HashSet :: new ( ) ;
342+ let mut allocs_seen = FxHashSet :: default ( ) ;
342343
343344 while let Some ( id) = allocs_to_print. pop_front ( ) {
344345 let mut msg = format ! ( "Alloc {:<5} " , format!( "{}:" , id) ) ;
0 commit comments