From 829820e45884d5c6857c58d1d19472f05d0fce4e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 28 Feb 2012 14:30:25 -0700 Subject: [PATCH] fix problem with continuations A tail call to a continuation could trigger a GC at a bad time while checking whether an escape variant of the contination is valid. --- src/racket/src/eval.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/racket/src/eval.c b/src/racket/src/eval.c index 4bf80a9505..3d8b344173 100644 --- a/src/racket/src/eval.c +++ b/src/racket/src/eval.c @@ -1482,6 +1482,10 @@ Scheme_Object *scheme_jump_to_continuation(Scheme_Object *obj, int num_rands, Sc Scheme_Prompt *prompt, *barrier_prompt; int common_depth; + /* Since scheme_escape_continuation_ok() may allocate... */ + if (rands == p->tail_buffer) + make_tail_buffer_safe(); + c = (Scheme_Cont *)obj; if (can_ec @@ -1493,9 +1497,6 @@ Scheme_Object *scheme_jump_to_continuation(Scheme_Object *obj, int num_rands, Sc GC_CAN_IGNORE Scheme_Object **vals; int i; - if (rands == p->tail_buffer) - make_tail_buffer_safe(); - vals = MALLOC_N(Scheme_Object *, num_rands); for (i = num_rands; i--; ) { vals[i] = rands[i];