diff options
author | Andy Wingo <wingo@pobox.com> | 2010-02-24 17:43:02 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-02-24 17:43:02 +0100 |
commit | 9a1c6f1f0c6b07725a240160b79acc54303d7891 (patch) | |
tree | aa210143b30c8b190ea88de831684359837d7c56 /libguile/vm.c | |
parent | 078014374c066f03975bd0ef008877c5236c75ec (diff) | |
download | guile-9a1c6f1f0c6b07725a240160b79acc54303d7891.tar.gz |
rewind the dynamic state when entering a partial continuation
* libguile/control.c (cont_objcode):
* libguile/vm-i-system.c (partial-cont-call):
* libguile/vm.c (vm_reinstate_partial_continuation): Don't keep the
"external winds" in a partial continuation, as they aren't logically
part of the continuation. Reinstate the "internal winds" when entering
a partial continuation. Things seem to work!
Diffstat (limited to 'libguile/vm.c')
-rw-r--r-- | libguile/vm.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libguile/vm.c b/libguile/vm.c index a5f457013..6fecd600b 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -230,7 +230,7 @@ vm_abort (SCM vm, size_t n, scm_t_int64 vm_cookie) static void vm_reinstate_partial_continuation (SCM vm, SCM cont, SCM intwinds, - SCM extwinds, size_t n, SCM *argv) + size_t n, SCM *argv) { struct scm_vm *vp; struct scm_vm_cont *cp; @@ -277,6 +277,15 @@ vm_reinstate_partial_continuation (SCM vm, SCM cont, SCM intwinds, } vp->sp++; *vp->sp = scm_from_size_t (n); + + /* Finally, rewind the dynamic state. */ + { + long delta = 0; + SCM newwinds = scm_i_dynwinds (); + for (; scm_is_pair (intwinds); intwinds = scm_cdr (intwinds), delta--) + newwinds = scm_cons (scm_car (intwinds), newwinds); + scm_dowinds (newwinds, delta); + } } |