Skip to content

Commit 689c711

Browse files
committed
remove cur_frame from memory (validation is gone, new validation will not need it)
1 parent 7483ea8 commit 689c711

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

src/librustc_mir/interpret/eval_context.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,6 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
604604
}
605605
}
606606

607-
self.memory.cur_frame = self.cur_frame();
608-
609607
if self.stack.len() > self.stack_limit {
610608
err!(StackFrameLimitReached)
611609
} else {
@@ -619,10 +617,6 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
619617
let frame = self.stack.pop().expect(
620618
"tried to pop a stack frame, but there were none",
621619
);
622-
if !self.stack.is_empty() {
623-
// TODO: Is this the correct time to start considering these accesses as originating from the returned-to stack frame?
624-
self.memory.cur_frame = self.cur_frame();
625-
}
626620
match frame.return_to_block {
627621
StackPopCleanup::MarkStatic(mutable) => {
628622
if let Place::Ptr(MemPlace { ptr, .. }) = frame.return_place {

src/librustc_mir/interpret/memory.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx>> {
4343
/// Actual memory allocations (arbitrary bytes, may contain pointers into other allocations).
4444
alloc_map: FxHashMap<AllocId, Allocation>,
4545

46-
/// The current stack frame. Used to check accesses against locks.
47-
pub cur_frame: usize,
48-
4946
pub tcx: TyCtxtAt<'a, 'tcx, 'tcx>,
5047
}
5148

@@ -63,14 +60,12 @@ impl<'a, 'mir, 'tcx, M> PartialEq for Memory<'a, 'mir, 'tcx, M>
6360
data,
6461
alloc_kind,
6562
alloc_map,
66-
cur_frame,
6763
tcx: _,
6864
} = self;
6965

7066
*data == other.data
7167
&& *alloc_kind == other.alloc_kind
7268
&& *alloc_map == other.alloc_map
73-
&& *cur_frame == other.cur_frame
7469
}
7570
}
7671

@@ -83,12 +78,10 @@ impl<'a, 'mir, 'tcx, M> Hash for Memory<'a, 'mir, 'tcx, M>
8378
data,
8479
alloc_kind: _,
8580
alloc_map: _,
86-
cur_frame,
8781
tcx: _,
8882
} = self;
8983

9084
data.hash(state);
91-
cur_frame.hash(state);
9285

9386
// We ignore some fields which don't change between evaluation steps.
9487

@@ -114,7 +107,6 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
114107
alloc_kind: FxHashMap::default(),
115108
alloc_map: FxHashMap::default(),
116109
tcx,
117-
cur_frame: usize::max_value(),
118110
}
119111
}
120112

0 commit comments

Comments
 (0)