Skip to content

Commit cbd9222

Browse files
author
Vytautas Astrauskas
committed
Move stack access methods in the Machine implementations out of the enforce_ method group.
1 parent d41f8bf commit cbd9222

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

src/librustc_mir/const_eval/machine.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,6 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
190190
false
191191
}
192192

193-
#[inline(always)]
194-
fn stack(
195-
ecx: &'a InterpCx<'mir, 'tcx, Self>,
196-
) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] {
197-
&ecx.machine.stack
198-
}
199-
200-
#[inline(always)]
201-
fn stack_mut(
202-
ecx: &'a mut InterpCx<'mir, 'tcx, Self>,
203-
) -> &'a mut Vec<Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>> {
204-
&mut ecx.machine.stack
205-
}
206-
207193
#[inline(always)]
208194
fn enforce_validity(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
209195
false // for now, we don't enforce validity
@@ -367,6 +353,20 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
367353
Ok(frame)
368354
}
369355

356+
#[inline(always)]
357+
fn stack(
358+
ecx: &'a InterpCx<'mir, 'tcx, Self>,
359+
) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] {
360+
&ecx.machine.stack
361+
}
362+
363+
#[inline(always)]
364+
fn stack_mut(
365+
ecx: &'a mut InterpCx<'mir, 'tcx, Self>,
366+
) -> &'a mut Vec<Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>> {
367+
&mut ecx.machine.stack
368+
}
369+
370370
fn before_access_global(
371371
memory_extra: &MemoryExtra,
372372
alloc_id: AllocId,

src/librustc_mir/transform/const_prop.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,6 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx>
187187
false
188188
}
189189

190-
#[inline(always)]
191-
fn stack(
192-
ecx: &'a InterpCx<'mir, 'tcx, Self>,
193-
) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] {
194-
&ecx.machine.stack
195-
}
196-
197-
#[inline(always)]
198-
fn stack_mut(
199-
ecx: &'a mut InterpCx<'mir, 'tcx, Self>,
200-
) -> &'a mut Vec<Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>> {
201-
&mut ecx.machine.stack
202-
}
203-
204190
#[inline(always)]
205191
fn enforce_validity(_ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
206192
false
@@ -319,6 +305,20 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx>
319305
) -> InterpResult<'tcx, Frame<'mir, 'tcx>> {
320306
Ok(frame)
321307
}
308+
309+
#[inline(always)]
310+
fn stack(
311+
ecx: &'a InterpCx<'mir, 'tcx, Self>,
312+
) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] {
313+
&ecx.machine.stack
314+
}
315+
316+
#[inline(always)]
317+
fn stack_mut(
318+
ecx: &'a mut InterpCx<'mir, 'tcx, Self>,
319+
) -> &'a mut Vec<Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>> {
320+
&mut ecx.machine.stack
321+
}
322322
}
323323

324324
/// Finds optimization opportunities on the MIR.

0 commit comments

Comments
 (0)