summaryrefslogtreecommitdiff
path: root/libguile/continuations.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-02-08 22:59:25 +0100
committerAndy Wingo <wingo@pobox.com>2010-02-08 22:59:25 +0100
commitd8873dfe4754daf031a6709738bd31afa8edb443 (patch)
treedbad856934bd9069258d0db8e010f9a9a556ef69 /libguile/continuations.h
parent269479e31f70d40a82b75be87c1b2a7363c85696 (diff)
downloadguile-d8873dfe4754daf031a6709738bd31afa8edb443.tar.gz
continuations return multiple values on the stack
* libguile/vm.h (struct scm_vm_cont): Instead of saving the "IP", save "RA" and "MVRA". That is, save singly-valued and multiply-valued return addresses, so that we can return multiple values on the stack. (scm_i_vm_reinstate_continuation): Remove. * libguile/vm.c (vm_capture_continuation): Rename from capture_vm_cont, and change the prototype so we can capture the RA and MVRA, and so that tail calls to call/cc can capture a continuation without the call/cc application frame. (vm_return_to_continuation): Rename from reinstate_vm_cont, and take arguments to return to the continuation. Handles returning to single or multiple-value RA. (scm_i_vm_capture_continuation): Change to invoke vm_capture_continuation. Kept around for the benefit of make-stack. * libguile/vm-i-system.c (continuation-call): Handle reinstatement of the VM stack, with arguments. (call/cc, tail-call/cc): Adapt to new vm_capture_continuation prototype. tail-call/cc captures tail continuations. * libguile/stacks.c (scm_make_stack): Update for scm_vm_cont structure change. * libguile/continuations.h (struct scm_contregs): Remove throw_value member, which was used to return a value to a continuation. (scm_i_check_continuation): New internal function, checks that a continuation may be reinstated. (scm_i_reinstate_continuation): Replaces scm_i_continuation_call; just reinstates the C stack. (scm_i_contregs_vm, scm_i_contregs_vm_cont): New internal accessors. * libguile/continuations.c (scm_i_make_continuation): Return SCM_UNDEFINED if we are returning again. (grow_stack, copy_stack_and_call, scm_dynthrow): Remove extra arg, as vm opcodes handle value returns. (copy_stack): No need to instate VM continuation. (scm_i_reinstate_continuation): Adapt.
Diffstat (limited to 'libguile/continuations.h')
-rw-r--r--libguile/continuations.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/libguile/continuations.h b/libguile/continuations.h
index a9d2feee0..e0a455632 100644
--- a/libguile/continuations.h
+++ b/libguile/continuations.h
@@ -44,7 +44,6 @@
typedef struct
{
- SCM throw_value;
scm_i_jmp_buf jmpbuf;
SCM dynenv;
#ifdef __ia64__
@@ -73,9 +72,14 @@ typedef struct
SCM_INTERNAL SCM scm_i_make_continuation (int *first, SCM vm, SCM vm_cont);
+SCM_INTERNAL void scm_i_check_continuation (SCM cont);
+SCM_INTERNAL void scm_i_reinstate_continuation (SCM cont);
+
SCM_INTERNAL SCM scm_i_call_with_current_continuation (SCM proc);
+
SCM_INTERNAL SCM scm_i_continuation_to_frame (SCM cont);
-SCM_INTERNAL void scm_i_continuation_call (SCM cont, size_t n, SCM *argv);
+SCM_INTERNAL SCM scm_i_contregs_vm (SCM contregs);
+SCM_INTERNAL SCM scm_i_contregs_vm_cont (SCM contregs);
SCM_API void *scm_c_with_continuation_barrier (void *(*func)(void*), void *);
SCM_API SCM scm_with_continuation_barrier (SCM proc);