1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 15:40:19 +02:00

make call/cc capture and restore the vm stacks

* libguile/continuations.c (scm_make_continuation): Capture VM
  continuations as well, as their stack is outside the C stack.
  (copy_stack): Reinstate VM stacks with the C stack.

* libguile/continuations.h (scm_t_contregs): Add a pointer for VM stacks.
  A binary-incompatible change -- hopefully not too many people were
  messing around with this struct, though.

* libguile/vm-engine.c (vm_run): Add a note about possibly maintaining a
  stack of vms.

* libguile/vm.c (struct scm_vm_cont): New struct, distinct from scm_vm.
  (vm_cont_mark, vm_cont_free, capture_vm_cont, reinstate_vm_cont):
  Reorder some code, and fix some bad assumptions about what part of the
  stack to copy; obviously this code was never used.

* libguile/vm.h:
* libguile/vm.c (scm_vm_capture_continuations)
  (scm_vm_reinstate_continuations): New public functions, used by
  continuations.c.
This commit is contained in:
Andy Wingo 2008-09-24 17:04:14 +02:00
parent 7bbed5181c
commit bfffd2583c
5 changed files with 84 additions and 34 deletions

View file

@ -82,7 +82,12 @@ vm_run (SCM vm, SCM program, SCM args)
wind_data.fp = vp->fp;
wind_data.this_frame = vp->this_frame;
scm_dynwind_unwind_handler (vm_reset_stack, &wind_data, 0);
/* could do this if we reified all vm stacks -- for now, don't bother changing
*the-vm*
if (scm_fluid_ref (scm_the_vm_fluid) != vm)
scm_dynwind_fluid (scm_the_vm_fluid, vm);
*/
#ifdef HAVE_LABELS_AS_VALUES
/* Jump table */