From 68f8d632228adf07dc0bf4b3c194913471fae0de Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 15 Sep 2015 09:32:19 -0600 Subject: [PATCH] fix problem with traversing closures for GC This bug is an old one, in a sense, because travesing fields in a closure could have moved the prefix with earlier versions of the collector. It shows up now because we're changing fields one indirection closer. --- racket/src/racket/src/mzclpf_post.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/racket/src/racket/src/mzclpf_post.inc b/racket/src/racket/src/mzclpf_post.inc index 7fb3e2b4c5..6d92d6eaac 100644 --- a/racket/src/racket/src/mzclpf_post.inc +++ b/racket/src/racket/src/mzclpf_post.inc @@ -10,13 +10,16 @@ if (data) { /* GLOBAL ASSUMPTION: prefix is at the end of a closure */ Scheme_Prefix *pf = (Scheme_Prefix *)c->vals[closure_size - 1]; - + if (pf) { - /* Since pf hasn't been marked, we don't need a GC_resolve(): */ - int *use_bits = PREFIX_TO_USE_BITS(pf); + int *use_bits; uintptr_t map; int mark_stxes; + /* pf might have been marked via fields: */ + pf = (Scheme_Prefix *)GC_resolve2(pf, gc); + use_bits = PREFIX_TO_USE_BITS(pf); + if (!pf->next_final) { /* We're the first to look at this prefix... */ /* Add it to the chain of prefixes to finish after