Miri terminator handling: only do progress sanity check for 'Call' terminator

This commit is contained in:
Ralf Jung 2020-04-04 15:53:47 +02:00
parent e6cef04457
commit a524a9af91
2 changed files with 5 additions and 5 deletions

View File

@ -279,13 +279,8 @@ fn terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> InterpResult<'tc
self.tcx.span = terminator.source_info.span; self.tcx.span = terminator.source_info.span;
self.memory.tcx.span = terminator.source_info.span; self.memory.tcx.span = terminator.source_info.span;
let old_stack = self.cur_frame();
let old_bb = self.frame().block;
self.eval_terminator(terminator)?; self.eval_terminator(terminator)?;
if !self.stack.is_empty() { if !self.stack.is_empty() {
// This should change *something*
assert!(self.cur_frame() != old_stack || self.frame().block != old_bb);
if let Some(block) = self.frame().block { if let Some(block) = self.frame().block {
info!("// executing {:?}", block); info!("// executing {:?}", block);
} }

View File

@ -52,6 +52,8 @@ pub(super) fn eval_terminator(
} }
Call { ref func, ref args, destination, ref cleanup, .. } => { Call { ref func, ref args, destination, ref cleanup, .. } => {
let old_stack = self.cur_frame();
let old_bb = self.frame().block;
let func = self.eval_operand(func, None)?; let func = self.eval_operand(func, None)?;
let (fn_val, abi) = match func.layout.ty.kind { let (fn_val, abi) = match func.layout.ty.kind {
ty::FnPtr(sig) => { ty::FnPtr(sig) => {
@ -72,6 +74,9 @@ pub(super) fn eval_terminator(
None => None, None => None,
}; };
self.eval_fn_call(fn_val, abi, &args[..], ret, *cleanup)?; self.eval_fn_call(fn_val, abi, &args[..], ret, *cleanup)?;
// Sanity-check that `eval_fn_call` either pushed a new frame or
// did a jump to another block.
assert!(self.cur_frame() != old_stack || self.frame().block != old_bb);
} }
Drop { location, target, unwind } => { Drop { location, target, unwind } => {