44use std:: any:: Any ;
55use std:: borrow:: Cow ;
66use std:: cell:: { Cell , RefCell } ;
7- use std:: collections:: hash_map:: Entry ;
87use std:: path:: Path ;
98use std:: rc:: Rc ;
109use std:: { fmt, process} ;
@@ -70,12 +69,6 @@ pub struct FrameExtra<'tcx> {
7069 /// This is used by `MiriMachine::current_span` and `MiriMachine::caller_span`
7170 pub is_user_relevant : bool ,
7271
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-
7972 /// Data race detector per-frame data.
8073 pub data_race : Option < data_race:: FrameState > ,
8174}
@@ -88,14 +81,12 @@ impl<'tcx> std::fmt::Debug for FrameExtra<'tcx> {
8881 catch_unwind,
8982 timing : _,
9083 is_user_relevant,
91- salt,
9284 data_race,
9385 } = self ;
9486 f. debug_struct ( "FrameData" )
9587 . field ( "borrow_tracker" , borrow_tracker)
9688 . field ( "catch_unwind" , catch_unwind)
9789 . field ( "is_user_relevant" , is_user_relevant)
98- . field ( "salt" , salt)
9990 . field ( "data_race" , data_race)
10091 . finish ( )
10192 }
@@ -108,7 +99,6 @@ impl VisitProvenance for FrameExtra<'_> {
10899 borrow_tracker,
109100 timing : _,
110101 is_user_relevant : _,
111- salt : _,
112102 data_race : _,
113103 } = self ;
114104
@@ -578,11 +568,6 @@ pub struct MiriMachine<'tcx> {
578568 /// diagnostics.
579569 pub ( crate ) allocation_spans : RefCell < FxHashMap < AllocId , ( Span , Option < Span > ) > > ,
580570
581- /// Maps MIR consts to their evaluated result. We combine the const with a "salt" (`usize`)
582- /// that is fixed per stack frame; this lets us have sometimes different results for the
583- /// same const while ensuring consistent results within a single call.
584- const_cache : RefCell < FxHashMap < ( mir:: Const < ' tcx > , usize ) , OpTy < ' tcx > > > ,
585-
586571 /// For each allocation, an offset inside that allocation that was deemed aligned even for
587572 /// symbolic alignment checks. This cannot be stored in `AllocExtra` since it needs to be
588573 /// tracked for vtables and function allocations as well as regular allocations.
@@ -764,7 +749,6 @@ impl<'tcx> MiriMachine<'tcx> {
764749 stack_size,
765750 collect_leak_backtraces : config. collect_leak_backtraces ,
766751 allocation_spans : RefCell :: new ( FxHashMap :: default ( ) ) ,
767- const_cache : RefCell :: new ( FxHashMap :: default ( ) ) ,
768752 symbolic_alignment : RefCell :: new ( FxHashMap :: default ( ) ) ,
769753 union_data_ranges : FxHashMap :: default ( ) ,
770754 pthread_mutex_sanity : Cell :: new ( false ) ,
@@ -941,7 +925,6 @@ impl VisitProvenance for MiriMachine<'_> {
941925 stack_size : _,
942926 collect_leak_backtraces : _,
943927 allocation_spans : _,
944- const_cache : _,
945928 symbolic_alignment : _,
946929 union_data_ranges : _,
947930 pthread_mutex_sanity : _,
@@ -1578,7 +1561,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
15781561 catch_unwind : None ,
15791562 timing,
15801563 is_user_relevant : ecx. machine . is_user_relevant ( & frame) ,
1581- salt : ecx. machine . rng . borrow_mut ( ) . random_range ( 0 ..ADDRS_PER_ANON_GLOBAL ) ,
15821564 data_race : ecx
15831565 . machine
15841566 . data_race
@@ -1737,33 +1719,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
17371719 interp_ok ( ( ) )
17381720 }
17391721
1740- fn eval_mir_constant < F > (
1741- ecx : & InterpCx < ' tcx , Self > ,
1742- val : mir:: Const < ' tcx > ,
1743- span : Span ,
1744- layout : Option < TyAndLayout < ' tcx > > ,
1745- eval : F ,
1746- ) -> InterpResult < ' tcx , OpTy < ' tcx > >
1747- where
1748- F : Fn (
1749- & InterpCx < ' tcx , Self > ,
1750- mir:: Const < ' tcx > ,
1751- Span ,
1752- Option < TyAndLayout < ' tcx > > ,
1753- ) -> InterpResult < ' tcx , OpTy < ' tcx > > ,
1754- {
1755- let frame = ecx. active_thread_stack ( ) . last ( ) . unwrap ( ) ;
1756- let mut cache = ecx. machine . const_cache . borrow_mut ( ) ;
1757- match cache. entry ( ( val, frame. extra . salt ) ) {
1758- Entry :: Vacant ( ve) => {
1759- let op = eval ( ecx, val, span, layout) ?;
1760- ve. insert ( op. clone ( ) ) ;
1761- interp_ok ( op)
1762- }
1763- Entry :: Occupied ( oe) => interp_ok ( oe. get ( ) . clone ( ) ) ,
1764- }
1765- }
1766-
17671722 fn get_global_alloc_salt (
17681723 ecx : & InterpCx < ' tcx , Self > ,
17691724 instance : Option < ty:: Instance < ' tcx > > ,
0 commit comments