From 3f75e8d231f3bafbe737c46f8d3777be97416f76 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 16 Mar 2017 14:07:36 +0000 Subject: [PATCH] Mark objects when collector cooperates When the collector cooperates for a mutator it needs to mark any heap-collected objects that are stored within the mutator's data object. This prevents problems where these objects (which are essentially per-thread global roots) are incorrectly collected. --- gc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gc.c b/gc.c index e45ec057..a77b2482 100644 --- a/gc.c +++ b/gc.c @@ -1696,6 +1696,15 @@ void gc_wait_handshake() //for (i = 0; i < m->gc_num_args; i++) { // gc_mark_gray(m, m->gc_args[i]); //} + if (m->scm_thread_obj) { + gc_mark_gray(m, m->scm_thread_obj); + } + if (m->exception_handler_stack) { + gc_mark_gray(m, m->exception_handler_stack); + } + if (m->param_objs) { + gc_mark_gray(m, m->param_objs); + } // Also, mark everything the collector moved to the heap for (i = 0; i < buf_len; i++) { gc_mark_gray(m, m->moveBuf[i]);