diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-05-05 18:49:12 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-05-05 18:49:12 -0700 |
commit | 95eabc1fe0847e2ed9d94a7e0e7059a4d99041c0 (patch) | |
tree | eec54a223b5c4f130413d77a9027ad1194bb0c9f /stdlib/struct.tl | |
parent | a716f7122cb5a17257b62e53bdceec0233222c18 (diff) | |
download | txr-95eabc1fe0847e2ed9d94a7e0e7059a4d99041c0.tar.gz txr-95eabc1fe0847e2ed9d94a7e0e7059a4d99041c0.tar.bz2 txr-95eabc1fe0847e2ed9d94a7e0e7059a4d99041c0.zip |
hash: some streamlining in weak table processing.
* gc.c (mark_obj_norec): New function. Just marks
an object reachable without recursing over its
sub-objects.
(gc_mark_norec): New function.
* gc.h (gc_mark_norec): Declared.
* hash.c (do_weak_tables): Cache the table, mask and
vector pointer in a local variable, since these pointers
are not expected to change across function calls, and
can go into registers.
When visiting an entry that should be reachable, we
mark that entry immediately, and also use the new
gc_mark_norec function to mark the chain cons cell
reachable. I.e. we mark the chain backbone cons,
and that cons' car field, that being the entry.
Thus by the time we march through the chain, we
have marked all of it. Thus, the table entries don't
have to be iterated and marked any more. We use
gc_mark_norec to mark the table, and explicitly mark
its two special slots. The upshot of all this is that
we don't have to make an extra pass over the table,
and the chains, to mark things; we combine the marking
with the expunging of weak values.
Diffstat (limited to 'stdlib/struct.tl')
0 files changed, 0 insertions, 0 deletions