Add miri trampoline, fix handling of intrinsic return

This commit is contained in:
Aaron Hill 2019-10-29 21:03:30 -04:00
parent 5553476d49
commit b06c83c200
No known key found for this signature in database
GPG Key ID: B4087E510E98B164
2 changed files with 13 additions and 1 deletions

View File

@ -97,3 +97,6 @@
let payload = payload as *mut &mut dyn BoxMeUp;
imp::panic(Box::from_raw((*payload).box_me_up()))
}
#[cfg(miri)]
pub fn miri_panic_trampoline() {}

View File

@ -264,10 +264,19 @@ fn eval_fn_call(
match instance.def {
ty::InstanceDef::Intrinsic(..) => {
let old_stack = self.cur_frame();
M::call_intrinsic(self, span, instance, args, dest)?;
// No stack frame gets pushed, the main loop will just act as if the
// call completed.
self.goto_block(ret)?;
if ret.is_some() {
self.goto_block(ret)?;
} else {
// If this intrinsic call doesn't have a ret block,
// then the intrinsic implementation should have
// changed the stack frame (otherwise, we'll end
// up trying to execute this intrinsic call again)
assert!(self.cur_frame() != old_stack);
}
if let Some(dest) = dest {
self.dump_place(*dest)
}