]> granicus.if.org Git - gc/commit
Add disclaim callbacks for efficient finalization.
authorPetter Urkedal <urkedal@nbi.dk>
Sun, 1 Jul 2007 11:48:00 +0000 (13:48 +0200)
committerPetter Urkedal <paurkedal@gmail.com>
Mon, 19 Sep 2011 07:03:00 +0000 (09:03 +0200)
commit2c3e3b127e63e900aa1688553ec23b2ae158bb62
tree1793ba1fe521d2c2ab4efa0026c03dcaff02e04e
parentba8ef9e85b2dcd1ebfaf27ed436826faa286d759
Add disclaim callbacks for efficient finalization.

Importing gc-20070403-disclaim-1.0.patch.

* configure.ac: Add --disable-disclaim option and set ENABLE_DISCLAIM macro
and conditional accordingly.
* include/include.am, Makefile.am Add sources disclaim.c and
include/gc_disclaim.h.
* Makefile.direct: Ditto and define ENABLE_DISCLAIM.

* include/private/gc_priv.h (obj_kind): Add ok_mark_unconditionally,
ok_disclaim_proc and ok_disclaim_cd.
* misc.c (GC_new_kind_inner): Initialize them.
* include/private/gc_priv.h (hblkhdr): Add HAS_DISCLAIM and
MARK_UNCONDITIONALLY flags.
* allchblk.c (setup_header): Set HAS_DISCLAIM and MARK_UNCONDITIONALLY flags
as indicated by the object kind.

* reclaim.c: Main adjustments to support the disclaim callbacks.
* mark.c (GC_push_unconditionally, GC_push_next_marked_uncollecable):
Unconditionally mark from objects in blocks flagged MARK_UNCONDITIONALLY.
This preserves links reachable from the finalizer when using the the
finalized object kind.

* disclaim.c: Add file with support functions for disclaim callbacks and
implementation of the "finalized" object kind.
* include/gc_disclaim.h: Add file providing the corresponding API.
* include/private/thread_local_alloc.h (thread_local_freelists): Add
finalized_freelists.
* thread_local_alloc.c: Initialize them.

* tests/tests.am, tests/disclaim_test.c, tests/disclaim_bench.c: Add
disclaim-related tests.
16 files changed:
Makefile.am
Makefile.direct
allchblk.c
configure.ac
disclaim.c [new file with mode: 0644]
include/gc_disclaim.h [new file with mode: 0644]
include/include.am
include/private/gc_priv.h
include/private/thread_local_alloc.h
mark.c
misc.c
reclaim.c
tests/disclaim_bench.c [new file with mode: 0644]
tests/disclaim_test.c [new file with mode: 0644]
tests/tests.am
thread_local_alloc.c