Add miri trampoline, fix handling of intrinsic return
This commit is contained in:
parent
5553476d49
commit
b06c83c200
2 changed files with 13 additions and 1 deletions
|
@ -97,3 +97,6 @@ pub unsafe extern "C" fn __rust_start_panic(payload: usize) -> u32 {
|
||||||
let payload = payload as *mut &mut dyn BoxMeUp;
|
let payload = payload as *mut &mut dyn BoxMeUp;
|
||||||
imp::panic(Box::from_raw((*payload).box_me_up()))
|
imp::panic(Box::from_raw((*payload).box_me_up()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(miri)]
|
||||||
|
pub fn miri_panic_trampoline() {}
|
||||||
|
|
|
@ -264,10 +264,19 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
|
|
||||||
match instance.def {
|
match instance.def {
|
||||||
ty::InstanceDef::Intrinsic(..) => {
|
ty::InstanceDef::Intrinsic(..) => {
|
||||||
|
let old_stack = self.cur_frame();
|
||||||
M::call_intrinsic(self, span, instance, args, dest)?;
|
M::call_intrinsic(self, span, instance, args, dest)?;
|
||||||
// No stack frame gets pushed, the main loop will just act as if the
|
// No stack frame gets pushed, the main loop will just act as if the
|
||||||
// call completed.
|
// 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 {
|
if let Some(dest) = dest {
|
||||||
self.dump_place(*dest)
|
self.dump_place(*dest)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue