diff options
author | Andy Wingo <wingo@pobox.com> | 2010-02-08 22:59:25 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-02-08 22:59:25 +0100 |
commit | d8873dfe4754daf031a6709738bd31afa8edb443 (patch) | |
tree | dbad856934bd9069258d0db8e010f9a9a556ef69 /libguile/vm.h | |
parent | 269479e31f70d40a82b75be87c1b2a7363c85696 (diff) | |
download | guile-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/vm.h')
-rw-r--r-- | libguile/vm.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libguile/vm.h b/libguile/vm.h index 8540356aa..17445ea51 100644 --- a/libguile/vm.h +++ b/libguile/vm.h @@ -87,9 +87,9 @@ SCM_API SCM scm_vm_trace_level (SCM vm); SCM_API SCM scm_set_vm_trace_level_x (SCM vm, SCM level); struct scm_vm_cont { - scm_t_uint8 *ip; SCM *sp; SCM *fp; + scm_t_uint8 *ra, *mvra; scm_t_ptrdiff stack_size; SCM *stack_base; scm_t_ptrdiff reloc; @@ -98,13 +98,11 @@ struct scm_vm_cont { #define SCM_VM_CONT_P(OBJ) (SCM_NIMP (OBJ) && SCM_TYP7 (OBJ) == scm_tc7_vm_cont) #define SCM_VM_CONT_DATA(CONT) ((struct scm_vm_cont *) SCM_CELL_WORD_1 (CONT)) -SCM_INTERNAL SCM scm_i_vm_capture_continuation (SCM vm); -SCM_INTERNAL void scm_i_vm_reinstate_continuation (SCM vm, SCM cont); - SCM_API SCM scm_load_compiled_with_vm (SCM file); SCM_INTERNAL void scm_i_vm_print (SCM x, SCM port, scm_print_state *pstate); +SCM_INTERNAL SCM scm_i_vm_capture_continuation (SCM vm); SCM_INTERNAL void scm_i_vm_cont_print (SCM x, SCM port, scm_print_state *pstate); SCM_INTERNAL void scm_bootstrap_vm (void); |