summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/control.c12
-rw-r--r--libguile/control.h10
-rw-r--r--libguile/eval.c7
-rw-r--r--libguile/vm-i-system.c16
4 files changed, 26 insertions, 19 deletions
diff --git a/libguile/control.c b/libguile/control.c
index 5ca625254..c3ad5407b 100644
--- a/libguile/control.c
+++ b/libguile/control.c
@@ -32,8 +32,8 @@ SCM scm_sys_default_prompt_tag;
SCM
-scm_c_make_prompt (SCM vm, SCM k, scm_t_uint8 escape_only_p,
- scm_t_int64 vm_cookie)
+scm_c_make_prompt (SCM k, SCM *fp, SCM *sp, scm_t_uint8 *abort_ip,
+ scm_t_uint8 escape_only_p, scm_t_int64 vm_cookie)
{
scm_t_bits tag;
SCM ret;
@@ -45,9 +45,9 @@ scm_c_make_prompt (SCM vm, SCM k, scm_t_uint8 escape_only_p,
ret = scm_words (tag, 5);
regs = scm_gc_malloc_pointerless (sizeof (*regs), "prompt registers");
- regs->fp = SCM_VM_DATA (vm)->fp;
- regs->sp = SCM_VM_DATA (vm)->sp;
- regs->ip = SCM_VM_DATA (vm)->ip;
+ regs->fp = fp;
+ regs->sp = sp;
+ regs->ip = abort_ip;
regs->cookie = vm_cookie;
SCM_SET_CELL_OBJECT (ret, 1, k);
@@ -190,7 +190,7 @@ reify_partial_continuation (SCM vm, SCM prompt, SCM extwinds,
return ret;
}
-SCM
+void
scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv, scm_t_int64 cookie)
{
SCM cont, winds, prompt = SCM_BOOL_F;
diff --git a/libguile/control.h b/libguile/control.h
index 19e841eda..806a8eef0 100644
--- a/libguile/control.h
+++ b/libguile/control.h
@@ -45,12 +45,14 @@ struct scm_prompt_registers
SCM_INTERNAL SCM scm_sys_default_prompt_tag;
-SCM_INTERNAL SCM scm_c_make_prompt (SCM vm, SCM k, scm_t_uint8 escape_only_p,
- scm_t_int64 cookie);
+SCM_INTERNAL SCM scm_c_make_prompt (SCM k, SCM *fp, SCM *sp,
+ scm_t_uint8 *abort_ip,
+ scm_t_uint8 escape_only_p,
+ scm_t_int64 vm_cookie);
SCM_INTERNAL SCM scm_i_prompt_pop_abort_args_x (SCM prompt);
-SCM_INTERNAL SCM scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv,
- scm_t_int64 cookie) SCM_NORETURN;
+SCM_INTERNAL void scm_c_abort (SCM vm, SCM tag, size_t n, SCM *argv,
+ scm_t_int64 cookie) SCM_NORETURN;
SCM_INTERNAL SCM scm_at_abort (SCM tag, SCM args) SCM_NORETURN;
diff --git a/libguile/eval.c b/libguile/eval.c
index dff0372a2..1dc2bc4cd 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -427,9 +427,12 @@ eval (SCM x, SCM env)
case SCM_M_PROMPT:
{
- SCM prompt, handler, res;
+ SCM vm, prompt, handler, res;
- prompt = scm_c_make_prompt (scm_the_vm (), eval (CAR (mx), env), 0, -1);
+ vm = scm_the_vm ();
+ prompt = scm_c_make_prompt (eval (CAR (mx), env), SCM_VM_DATA (vm)->fp,
+ SCM_VM_DATA (vm)->sp, SCM_VM_DATA (vm)->ip,
+ 0, -1);
handler = eval (CDDR (mx), env);
scm_i_set_dynwinds (scm_cons (prompt, scm_i_dynwinds ()));
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index 56df7274e..262bb876d 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -1479,19 +1479,21 @@ VM_DEFINE_INSTRUCTION (83, prompt, "prompt", 4, 2, 0)
POP (k);
SYNC_REGISTER ();
- /* Push the prompt onto the dynamic stack. The setjmp itself has to be local
- to this procedure. */
- /* FIXME: do more error checking */
- prompt = scm_c_make_prompt (vm, k, escape_only_p, vm_cookie);
+ /* Push the prompt onto the dynamic stack. */
+ prompt = scm_c_make_prompt (k, fp, sp, ip + offset, escape_only_p, vm_cookie);
scm_i_set_dynwinds (scm_cons (prompt, scm_i_dynwinds ()));
if (SCM_PROMPT_SETJMP (prompt))
{
/* The prompt exited nonlocally. Cache the regs back from the vp, and go
to the handler.
+
+ Note, at this point, we must assume that any variable local to
+ vm_engine that can be assigned *has* been assigned. So we need to pull
+ all our state back from the ip/fp/sp.
*/
- CACHE_REGISTER (); /* Really we only need SP. FP and IP should be
- unmodified. */
- ip += offset;
+ CACHE_REGISTER ();
+ program = SCM_FRAME_PROGRAM (fp);
+ CACHE_PROGRAM ();
NEXT;
}