diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-12-31 06:45:48 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-12-31 06:45:48 -0800 |
commit | ee8addba7324e8bd66f107360051a6f200203dc5 (patch) | |
tree | 8f1a8579937b0fc86a0838cca4be9d842ebda96a /gc.c | |
parent | bf7675efa96490f8c950b494bd42657391e03b4c (diff) | |
download | txr-ee8addba7324e8bd66f107360051a6f200203dc5.tar.gz txr-ee8addba7324e8bd66f107360051a6f200203dc5.tar.bz2 txr-ee8addba7324e8bd66f107360051a6f200203dc5.zip |
gc: fix unnecessary full gc request in finalization.
* gc.c (call_finalizers_impl): Objects are only added to
freshobj if they are in the zero generation. We should skip
that entire block of code if the object isn't in that
generation. Not only is it wasteful to execute that code for
the mature generation, but the logic falsely sets the full_gc
flag whenever processing a non-gen-0 object!
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -787,7 +787,7 @@ static val call_finalizers_impl(val ctx, val obj = found->obj; funcall1(found->fun, obj); #if CONFIG_GEN_GC - if (inprogress) { + if (inprogress && obj->t.gen == 0) { for (dup = 0, i = freshobj_idx_start; i < freshobj_idx; i++) { if (freshobj[i] == obj) { dup = 1; @@ -796,7 +796,7 @@ static val call_finalizers_impl(val ctx, } if (!dup) { - if (freshobj_idx < FRESHOBJ_VEC_SIZE && obj->t.gen == 0) { + if (freshobj_idx < FRESHOBJ_VEC_SIZE) { freshobj[freshobj_idx++] = obj; } else { full_gc = 1; |