Add back Machine::before_terminator(...) method
Added it back because it's used by Miri, but in the compiler itself, it will not do anything (just return `Ok(())`.
This commit is contained in:
parent
08de246cd7
commit
172662dede
@ -561,6 +561,11 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
||||
throw_unsup_format!("pointer arithmetic or comparison is not supported at compile-time");
|
||||
}
|
||||
|
||||
// Not used here, but used by Miri (see `src/tools/miri/src/machine.rs`).
|
||||
fn before_terminator(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn increment_const_eval_counter(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
// The step limit has already been hit in a previous call to `increment_const_eval_counter`.
|
||||
if ecx.machine.steps_remaining == 0 {
|
||||
|
@ -243,6 +243,12 @@ pub trait Machine<'mir, 'tcx>: Sized {
|
||||
ecx.stack_mut()[frame].locals[local].access_mut()
|
||||
}
|
||||
|
||||
/// Called before a basic block terminator is executed.
|
||||
#[inline]
|
||||
fn before_terminator(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Called when the interpreter encounters a `StatementKind::ConstEvalCounter` instruction.
|
||||
/// You can use this to detect long or endlessly running programs.
|
||||
#[inline]
|
||||
|
@ -62,6 +62,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
M::before_terminator(self)?;
|
||||
|
||||
let terminator = basic_block.terminator();
|
||||
self.terminator(terminator)?;
|
||||
Ok(true)
|
||||
|
Loading…
x
Reference in New Issue
Block a user