summaryrefslogtreecommitdiff
path: root/libguile/eval.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-12-12 20:55:08 +0100
committerAndy Wingo <wingo@pobox.com>2016-12-12 21:13:00 +0100
commit6dd87f4d8c764360c8d22c03f65603ea8b8c9e78 (patch)
tree6a502663cd206f0b4a46f61e8eb090ba4bd2e78b /libguile/eval.c
parentbf4a97898beac167e8b4f565ce4c7540bed24685 (diff)
downloadguile-6dd87f4d8c764360c8d22c03f65603ea8b8c9e78.tar.gz
Add suspendable-continuation?
* doc/ref/api-control.texi (Prompt Primitives): Document suspendable-continuation?. * libguile/control.c (scm_suspendable_continuation_p): New procedure. (scm_init_ice_9_control): New extension procedure, defines suspendable-continuation?. (scm_init_control): Register scm_init_ice_9_control. * libguile/eval.c (eval): * libguile/throw.c (catch): * libguile/continuations.c (scm_i_make_continuation): Restore resumable prompt cookie after continuation invocation. * libguile/vm.c (scm_call_n): Arrange to set resumable_prompt_cookie during invocation of VM. * libguile/vm.h (struct scm_vm): Add resumable_prompt_cookie member. * module/ice-9/control.scm: Export suspendable-continuation?. * test-suite/tests/control.test ("suspendable-continuation?"): New test.
Diffstat (limited to 'libguile/eval.c')
-rw-r--r--libguile/eval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libguile/eval.c b/libguile/eval.c
index 87e6eacbf..93788ebfc 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -425,6 +425,7 @@ eval (SCM x, SCM env)
struct scm_vm *vp;
SCM k, handler, res;
scm_i_jmp_buf registers;
+ const void *prev_cookie;
scm_t_ptrdiff saved_stack_depth;
k = EVAL1 (CAR (mx), env);
@@ -442,9 +443,11 @@ eval (SCM x, SCM env)
vp->ip,
&registers);
+ prev_cookie = vp->resumable_prompt_cookie;
if (SCM_I_SETJMP (registers))
{
/* The prompt exited nonlocally. */
+ vp->resumable_prompt_cookie = prev_cookie;
scm_gc_after_nonlocal_exit ();
proc = handler;
args = scm_i_prompt_pop_abort_args_x (vp, saved_stack_depth);