about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/interpret/machine.rs8
-rw-r--r--src/librustc_mir/interpret/terminator.rs20
2 files changed, 5 insertions, 23 deletions
diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs
index 0ddd0962ba5..82899d43257 100644
--- a/src/librustc_mir/interpret/machine.rs
+++ b/src/librustc_mir/interpret/machine.rs
@@ -141,7 +141,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
     /// Returns either the mir to use for the call, or `None` if execution should
     /// just proceed (which usually means this hook did all the work that the
     /// called function should usually have done). In the latter case, it is
-    /// this hook's responsibility to call `goto_block(ret)` to advance the instruction pointer!
+    /// this hook's responsibility to advance the instruction pointer!
     /// (This is to support functions like `__rust_maybe_catch_panic` that neither find a MIR
     /// nor just jump to `ret`, but instead push their own stack frame.)
     /// Passing `dest`and `ret` in the same `Option` proved very annoying when only one of them
@@ -155,7 +155,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
         unwind: Option<mir::BasicBlock>
     ) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>>;
 
-    /// Execute `fn_val`.  it is the hook's responsibility to advance the instruction
+    /// Execute `fn_val`.  It is the hook's responsibility to advance the instruction
     /// pointer as appropriate.
     fn call_extra_fn(
         ecx: &mut InterpCx<'mir, 'tcx, Self>,
@@ -165,8 +165,8 @@ pub trait Machine<'mir, 'tcx>: Sized {
         ret: Option<mir::BasicBlock>,
     ) -> InterpResult<'tcx>;
 
-    /// Directly process an intrinsic without pushing a stack frame.
-    /// If this returns successfully, the engine will take care of jumping to the next block.
+    /// Directly process an intrinsic without pushing a stack frame. It is the hook's
+    /// responsibility to advance the instruction pointer as appropriate.
     fn call_intrinsic(
         ecx: &mut InterpCx<'mir, 'tcx, Self>,
         span: Span,
diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs
index f61fe7b5e38..ad4613bf5b3 100644
--- a/src/librustc_mir/interpret/terminator.rs
+++ b/src/librustc_mir/interpret/terminator.rs
@@ -254,25 +254,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
         match instance.def {
             ty::InstanceDef::Intrinsic(..) => {
                 assert!(caller_abi == Abi::RustIntrinsic || caller_abi == Abi::PlatformIntrinsic);
-
-                let old_stack = self.cur_frame();
-                let old_bb = self.frame().block;
-                M::call_intrinsic(self, span, instance, args, dest, ret, unwind)?;
-                // No stack frame gets pushed, the main loop will just act as if the
-                // call completed.
-                if ret.is_some() {
-                    self.return_to_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)
-                    debug_assert!(self.cur_frame() != old_stack || self.frame().block != old_bb);
-                }
-                if let Some(dest) = dest {
-                    self.dump_place(*dest)
-                }
-                Ok(())
+                return M::call_intrinsic(self, span, instance, args, dest, ret, unwind);
             }
             ty::InstanceDef::VtableShim(..) |
             ty::InstanceDef::ReifyShim(..) |