fix interaction of delimited continuations and stack overflow
Closes PR 12702, 12704 Merge to 5.3
This commit is contained in:
parent
2ad41bb669
commit
ff378d12ce
|
@ -144,6 +144,20 @@
|
|||
|
||||
(test (void) go 100000))
|
||||
|
||||
;; ----------------------------------------
|
||||
;; A GC test:
|
||||
|
||||
(require racket/control)
|
||||
|
||||
(let ()
|
||||
(define (loop n)
|
||||
(shift s (if (zero? n)
|
||||
(void)
|
||||
(loop (sub1 n)))))
|
||||
(define (overflow-prompt-go)
|
||||
(reset (loop 50000)))
|
||||
(test (void) overflow-prompt-go))
|
||||
|
||||
;; ----------------------------------------
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -414,6 +414,18 @@ scheme_handle_stack_overflow(Scheme_Object *(*k)(void))
|
|||
overflow = p->overflow;
|
||||
p->overflow = overflow->prev;
|
||||
p->error_buf = overflow->jmp->savebuf;
|
||||
if (p->meta_prompt) {
|
||||
/* When unwinding a stack overflow, we need to fix up
|
||||
the meta prompt to have the restored stack base.
|
||||
(When overflow happens with a meta prompt in place,
|
||||
no fixup is needed, because the overflow is detected
|
||||
at the point where the meta-prompt's base would be used.) */
|
||||
Scheme_Prompt *meta_prompt;
|
||||
meta_prompt = MALLOC_ONE_TAGGED(Scheme_Prompt);
|
||||
memcpy(meta_prompt, p->meta_prompt, sizeof(Scheme_Prompt));
|
||||
meta_prompt->stack_boundary = p->stack_start;
|
||||
p->meta_prompt = meta_prompt;
|
||||
}
|
||||
if (!overflow->jmp->captured) /* reset if not captured in a continuation */
|
||||
scheme_reset_jmpup_buf(&overflow->jmp->cont);
|
||||
if (!scheme_overflow_reply) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user