1
1
use byteorder:: { ReadBytesExt , WriteBytesExt , LittleEndian , BigEndian } ;
2
- use std:: collections:: { btree_map, BTreeMap , HashMap , HashSet , VecDeque } ;
2
+ use std:: collections:: { btree_map, BTreeMap , VecDeque } ;
3
3
use std:: { ptr, io} ;
4
4
5
5
use rustc:: ty:: Instance ;
6
6
use rustc:: ty:: maps:: TyCtxtAt ;
7
7
use rustc:: ty:: layout:: { self , Align , TargetDataLayout } ;
8
8
use syntax:: ast:: Mutability ;
9
9
10
+ use rustc_data_structures:: fx:: { FxHashSet , FxHashMap } ;
10
11
use rustc:: mir:: interpret:: { MemoryPointer , AllocId , Allocation , AccessKind , UndefMask , Value , Pointer ,
11
12
EvalResult , PrimVal , EvalErrorKind } ;
12
13
@@ -33,15 +34,15 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx>> {
33
34
pub data : M :: MemoryData ,
34
35
35
36
/// 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 > > ,
37
38
38
39
/// Actual memory allocations (arbitrary bytes, may contain pointers into other allocations).
39
- alloc_map : HashMap < AllocId , Allocation > ,
40
+ alloc_map : FxHashMap < AllocId , Allocation > ,
40
41
41
42
/// Actual memory allocations (arbitrary bytes, may contain pointers into other allocations).
42
43
///
43
44
/// 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 > ,
45
46
46
47
/// The current stack frame. Used to check accesses against locks.
47
48
pub cur_frame : usize ,
@@ -53,9 +54,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
53
54
pub fn new ( tcx : TyCtxtAt < ' a , ' tcx , ' tcx > , data : M :: MemoryData ) -> Self {
54
55
Memory {
55
56
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 ( ) ,
59
60
tcx,
60
61
cur_frame : usize:: max_value ( ) ,
61
62
}
@@ -338,7 +339,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
338
339
allocs. sort ( ) ;
339
340
allocs. dedup ( ) ;
340
341
let mut allocs_to_print = VecDeque :: from ( allocs) ;
341
- let mut allocs_seen = HashSet :: new ( ) ;
342
+ let mut allocs_seen = FxHashSet :: default ( ) ;
342
343
343
344
while let Some ( id) = allocs_to_print. pop_front ( ) {
344
345
let mut msg = format ! ( "Alloc {:<5} " , format!( "{}:" , id) ) ;
0 commit comments