summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2020-02-19 16:53:44 +0100
committerAndy Wingo <wingo@pobox.com>2020-02-19 16:53:44 +0100
commitcc30168878972652ddde4489351b76dc53f20142 (patch)
tree00d985b17df48c20eb80380059892bbcc16a73d0
parent18e9366142c74172fd9fcc10f21688d94249f505 (diff)
downloadguile-cc30168878972652ddde4489351b76dc53f20142.tar.gz
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.
-rw-r--r--libguile/vm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libguile/vm.c b/libguile/vm.c
index ab6a6295e..b20c6eb5f 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -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));