1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix bug restoring a JIT continuation from the interpreter

* libguile/vm.c (push_interrupt_frame, compose_continuation): In places
  where we push on synthetic frames before possibly going back to mcode,
  make sure that the return mcode will trampoline back to the
  interpreter.  Fixes compose-continuation from the interpreter to
  partial continuations with mcode.
This commit is contained in:
Andy Wingo 2020-02-19 16:53:44 +01:00
parent 18e9366142
commit cc30168878

View file

@ -1051,6 +1051,11 @@ push_interrupt_frame (scm_thread *thread, uint8_t *mra)
size_t old_frame_size = frame_locals_count (thread);
SCM proc = scm_i_async_pop (thread);
#if ENABLE_JIT
if (!mra)
mra = scm_jit_return_to_interpreter_trampoline;
#endif
/* Reserve space for frame and callee. */
alloc_frame (thread, old_frame_size + frame_overhead + 1);
@ -1191,6 +1196,12 @@ compose_continuation (scm_thread *thread, SCM cont)
if (SCM_UNLIKELY (! SCM_VM_CONT_REWINDABLE_P (cont)))
scm_wrong_type_arg_msg (NULL, 0, cont, "resumable continuation");
#if ENABLE_JIT
if (!SCM_FRAME_MACHINE_RETURN_ADDRESS (vp->fp))
SCM_FRAME_SET_MACHINE_RETURN_ADDRESS
(vp->fp, scm_jit_return_to_interpreter_trampoline);
#endif
nargs = frame_locals_count (thread) - 1;
args = alloca (nargs * sizeof (*args));
memcpy (args, vp->sp, nargs * sizeof (*args));