4
4
use std:: any:: Any ;
5
5
use std:: borrow:: Cow ;
6
6
use std:: cell:: { Cell , RefCell } ;
7
- use std:: collections:: hash_map:: Entry ;
8
7
use std:: path:: Path ;
9
8
use std:: rc:: Rc ;
10
9
use std:: { fmt, process} ;
@@ -70,12 +69,6 @@ pub struct FrameExtra<'tcx> {
70
69
/// This is used by `MiriMachine::current_span` and `MiriMachine::caller_span`
71
70
pub is_user_relevant : bool ,
72
71
73
- /// We have a cache for the mapping from [`mir::Const`] to resulting [`AllocId`].
74
- /// However, we don't want all frames to always get the same result, so we insert
75
- /// an additional bit of "salt" into the cache key. This salt is fixed per-frame
76
- /// so that within a call, a const will have a stable address.
77
- salt : usize ,
78
-
79
72
/// Data race detector per-frame data.
80
73
pub data_race : Option < data_race:: FrameState > ,
81
74
}
@@ -88,14 +81,12 @@ impl<'tcx> std::fmt::Debug for FrameExtra<'tcx> {
88
81
catch_unwind,
89
82
timing : _,
90
83
is_user_relevant,
91
- salt,
92
84
data_race,
93
85
} = self ;
94
86
f. debug_struct ( "FrameData" )
95
87
. field ( "borrow_tracker" , borrow_tracker)
96
88
. field ( "catch_unwind" , catch_unwind)
97
89
. field ( "is_user_relevant" , is_user_relevant)
98
- . field ( "salt" , salt)
99
90
. field ( "data_race" , data_race)
100
91
. finish ( )
101
92
}
@@ -108,7 +99,6 @@ impl VisitProvenance for FrameExtra<'_> {
108
99
borrow_tracker,
109
100
timing : _,
110
101
is_user_relevant : _,
111
- salt : _,
112
102
data_race : _,
113
103
} = self ;
114
104
@@ -579,11 +569,6 @@ pub struct MiriMachine<'tcx> {
579
569
/// diagnostics.
580
570
pub ( crate ) allocation_spans : RefCell < FxHashMap < AllocId , ( Span , Option < Span > ) > > ,
581
571
582
- /// Maps MIR consts to their evaluated result. We combine the const with a "salt" (`usize`)
583
- /// that is fixed per stack frame; this lets us have sometimes different results for the
584
- /// same const while ensuring consistent results within a single call.
585
- const_cache : RefCell < FxHashMap < ( mir:: Const < ' tcx > , usize ) , OpTy < ' tcx > > > ,
586
-
587
572
/// For each allocation, an offset inside that allocation that was deemed aligned even for
588
573
/// symbolic alignment checks. This cannot be stored in `AllocExtra` since it needs to be
589
574
/// tracked for vtables and function allocations as well as regular allocations.
@@ -764,7 +749,6 @@ impl<'tcx> MiriMachine<'tcx> {
764
749
stack_size,
765
750
collect_leak_backtraces : config. collect_leak_backtraces ,
766
751
allocation_spans : RefCell :: new ( FxHashMap :: default ( ) ) ,
767
- const_cache : RefCell :: new ( FxHashMap :: default ( ) ) ,
768
752
symbolic_alignment : RefCell :: new ( FxHashMap :: default ( ) ) ,
769
753
union_data_ranges : FxHashMap :: default ( ) ,
770
754
pthread_mutex_sanity : Cell :: new ( false ) ,
@@ -942,7 +926,6 @@ impl VisitProvenance for MiriMachine<'_> {
942
926
stack_size: _,
943
927
collect_leak_backtraces: _,
944
928
allocation_spans: _,
945
- const_cache: _,
946
929
symbolic_alignment: _,
947
930
union_data_ranges: _,
948
931
pthread_mutex_sanity: _,
@@ -1579,7 +1562,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
1579
1562
catch_unwind : None ,
1580
1563
timing,
1581
1564
is_user_relevant : ecx. machine . is_user_relevant ( & frame) ,
1582
- salt : ecx. machine . rng . borrow_mut ( ) . random_range ( 0 ..ADDRS_PER_ANON_GLOBAL ) ,
1583
1565
data_race : ecx
1584
1566
. machine
1585
1567
. data_race
@@ -1738,33 +1720,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
1738
1720
interp_ok ( ( ) )
1739
1721
}
1740
1722
1741
- fn eval_mir_constant < F > (
1742
- ecx : & InterpCx < ' tcx , Self > ,
1743
- val : mir:: Const < ' tcx > ,
1744
- span : Span ,
1745
- layout : Option < TyAndLayout < ' tcx > > ,
1746
- eval : F ,
1747
- ) -> InterpResult < ' tcx , OpTy < ' tcx > >
1748
- where
1749
- F : Fn (
1750
- & InterpCx < ' tcx , Self > ,
1751
- mir:: Const < ' tcx > ,
1752
- Span ,
1753
- Option < TyAndLayout < ' tcx > > ,
1754
- ) -> InterpResult < ' tcx , OpTy < ' tcx > > ,
1755
- {
1756
- let frame = ecx. active_thread_stack ( ) . last ( ) . unwrap ( ) ;
1757
- let mut cache = ecx. machine . const_cache . borrow_mut ( ) ;
1758
- match cache. entry ( ( val, frame. extra . salt ) ) {
1759
- Entry :: Vacant ( ve) => {
1760
- let op = eval ( ecx, val, span, layout) ?;
1761
- ve. insert ( op. clone ( ) ) ;
1762
- interp_ok ( op)
1763
- }
1764
- Entry :: Occupied ( oe) => interp_ok ( oe. get ( ) . clone ( ) ) ,
1765
- }
1766
- }
1767
-
1768
1723
fn get_global_alloc_salt (
1769
1724
ecx : & InterpCx < ' tcx , Self > ,
1770
1725
instance : Option < ty:: Instance < ' tcx > > ,
0 commit comments