delim cont repair to avoid chains of meta-cont references

svn: r4713
This commit is contained in:
Matthew Flatt 2006-10-30 12:19:46 +00:00
parent cc711703af
commit 81ba60fb27
3 changed files with 33 additions and 4 deletions

View File

@ -4543,6 +4543,12 @@ internal_call_cc (int argc, Scheme_Object *argv[])
when calling `cont' composably (i.e., when supplying a resume). */
cont->prompt_stack_start = stack_start;
/* Zero out any local variable that shouldn't be saved by the
continuation. The meta-continuation for the prompt is an
especially important one to zero out (otherwise we build up
chains). */
prompt_cont = NULL;
if (scheme_setjmpup_relative(&cont->buf, cont, stack_start, sub_cont)) {
/* We arrive here when the continuation is applied */
Scheme_Object *result, *extra_marks;

View File

@ -1010,6 +1010,27 @@ static void print_tagged_value(const char *prefix,
sprintf(buffer, "[%d=%s%s%s%s%s%s]",
state, run, sus, kill, clean, all, deq);
len2 = strlen(buffer);
t2 = (char *)scheme_malloc_atomic(len + len2 + 1);
memcpy(t2, type, len);
memcpy(t2 + len, buffer, len2 + 1);
len += len2;
type = t2;
} else if (!scheme_strncmp(type, "#<continuation", 13)) {
char buffer[256];
char *t2;
int len2;
sprintf(buffer, "[%s%.100s]",
(((Scheme_Cont *)v)->composable
? "delim;"
: ""),
(((Scheme_Cont *)v)->prompt_tag
? (SCHEME_CDR(((Scheme_Cont *)v)->prompt_tag)
? SCHEME_SYM_VAL(SCHEME_CDR(((Scheme_Cont *)v)->prompt_tag))
: "<anonymous>")
: "NULL"));
len2 = strlen(buffer);
t2 = (char *)scheme_malloc_atomic(len + len2 + 1);
memcpy(t2, type, len);

View File

@ -6625,6 +6625,7 @@ static void prepare_thread_for_GC(Scheme_Object *t)
int stackpos;
segpos = ((long)pos >> SCHEME_LOG_MARK_SEGMENT_SIZE);
seg = p->cont_mark_stack_segments[segpos];
if (seg) {
stackpos = ((long)pos & SCHEME_MARK_SEGMENT_MASK);
seg[stackpos].key = NULL;
seg[stackpos].val = NULL;
@ -6632,6 +6633,7 @@ static void prepare_thread_for_GC(Scheme_Object *t)
}
}
}
}
if (p->values_buffer)
memset(p->values_buffer, 0, sizeof(Scheme_Object*) * p->values_buffer_size);