diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 07:56:25 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 07:56:25 -0700 |
commit | dfd1680302962c29521770c512e8ed1ddfb640b1 (patch) | |
tree | 661e13301a83a486c39e3af2d09725aae65cab32 | |
parent | 91d4184615878babd7c8c3675418c5421b5e663c (diff) | |
download | txr-dfd1680302962c29521770c512e8ed1ddfb640b1.tar.gz txr-dfd1680302962c29521770c512e8ed1ddfb640b1.tar.bz2 txr-dfd1680302962c29521770c512e8ed1ddfb640b1.zip |
Small optimization in finalization.
* gc.c (prepare_finals): In the second pass, only mark
objects that were identified in the first pass as unreachable.
Reachable ones don't require a redundant call to mark_obj.
Also, objects identified as unreachable can be moved to
gen 0. This is something like what the mark_makefresh hack was
trying to do. It only does anything in a full GC pass, because
in an incremental pass, anything identified as unreachable is
necessarily gen 0. It can help prevent some objects that
are revived by finalization from sliding back to gen 1
and hanging around.
-rw-r--r-- | gc.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -623,7 +623,12 @@ static void prepare_finals(void) f->reachable = is_reachable(f->obj); for (f = final_list; f; f = f->next) { - mark_obj(f->obj); + if (!f->reachable) { +#if CONFIG_GEN_GC + f->obj->t.gen = 0; +#endif + mark_obj(f->obj); + } mark_obj(f->fun); } } |