fix problem with multiple captures of the same continuation

--- a bug introduced when enabling full continuations
     to escape past continuation barriers in v5.0.1
 Closes PR 11409
This commit is contained in:
Matthew Flatt 2010-11-09 16:46:25 -07:00
parent 7ff8ce61db
commit a0a414465d
2 changed files with 16 additions and 3 deletions

View File

@ -1836,6 +1836,19 @@
((car x) (lambda () x))
(pair? (x)))))
;; Check shared escape continuation of nested call/cc:
(let ([ch (make-channel)])
(thread
(lambda ()
(channel-put
ch
(call/cc
(lambda (escape)
(call/cc
(lambda (escape1)
(escape1 3))))))))
(sync ch))
(arity-test call/cc 1 2)
(arity-test call/ec 1 1)
(err/rt-test (call/cc 4))

View File

@ -6181,7 +6181,7 @@ internal_call_cc (int argc, Scheme_Object *argv[])
&& (sub_cont->prompt_tag == prompt_tag)
&& (sub_cont->barrier_prompt == effective_barrier_prompt)
&& (((Scheme_Escaping_Cont *)sub_cont->escape_cont)->myerr == p->error_buf)) {
/* Whether sub_cont turns out to be the same continuaiton, we can use
/* Whether sub_cont turns out to be the same continuation, we can use
its escape continuation, because jumping to the escape continuation
triggers the same C-level clean-up actions, same `dynamic-wind's, and
crosses the same continuation barriers. */
@ -6230,10 +6230,10 @@ internal_call_cc (int argc, Scheme_Object *argv[])
cont = MALLOC_ONE_TAGGED(Scheme_Cont);
cont->so.type = scheme_cont_type;
cont->buf.cont = sub_cont;
sub_cont = sub_cont->buf.cont;
cont->escape_cont = sub_cont->escape_cont;
sub_cont = sub_cont->buf.cont;
/* This mark stack won't be restored, but it may be
used by `continuation-marks'. */
cont->ss.cont_mark_stack = MZ_CONT_MARK_STACK;