summaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gc.c b/gc.c
index fc7ec675..a58b8260 100644
--- a/gc.c
+++ b/gc.c
@@ -745,9 +745,6 @@ NOINLINE static void prepare_finals(void)
for (f = final_list; f; f = f->next) {
if (!f->reachable) {
-#if CONFIG_GEN_GC
- f->obj->t.gen = 0;
-#endif
mark_obj(f->obj);
}
mark_obj(f->fun);
@@ -789,8 +786,11 @@ static val call_finalizers_impl(val ctx,
val obj = found->obj;
funcall1(found->fun, obj);
#if CONFIG_GEN_GC
- if (--obj->t.fincount == 0 && inprogress && obj->t.gen == 0) {
+ if (--obj->t.fincount == 0 && inprogress &&
+ !full_gc && !found->reachable)
+ {
if (freshobj_idx < FRESHOBJ_VEC_SIZE) {
+ obj->t.gen = 0;
freshobj[freshobj_idx++] = obj;
} else {
full_gc = 1;