From 123f724c4712793d9fa885e5e15b8174e491f5b5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 17 Jul 2015 02:10:04 -0600 Subject: [PATCH] fix GC problem with chains of ephemerons A recent GC change (included with the set-of-scopes expander) allows the GCs marking procedure to recur directly to a limited depth, instead of always pushing pointers onto a stack. Direct recursion is not cmopatible with ephemeron-resolution process, so switch to no-recur mode. This problem was uncovered by an existing test. --- racket/src/racket/gc2/weak.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/racket/src/racket/gc2/weak.c b/racket/src/racket/gc2/weak.c index 94e9df4886..f6954989a9 100644 --- a/racket/src/racket/gc2/weak.c +++ b/racket/src/racket/gc2/weak.c @@ -313,6 +313,8 @@ static int mark_ready_ephemerons(GCTYPE *gc) GC_Ephemeron *waiting = NULL, *next, *eph; int did_one = 0; + GC_mark_no_recur(gc, 1); + for (eph = gc->ephemerons; eph; eph = next) { next = eph->next; if (is_marked(gc, eph->key)) { @@ -326,6 +328,8 @@ static int mark_ready_ephemerons(GCTYPE *gc) } gc->ephemerons = waiting; + GC_mark_no_recur(gc, 0); + return did_one; }