summaryrefslogtreecommitdiff
path: root/allchblk.c
diff options
context:
space:
mode:
authorPetter Urkedal <urkedal@nbi.dk>2007-07-01 13:48:00 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-09-30 17:34:38 +0400
commit6c1a9244581cdceaf39c7321e524b1ef5a099980 (patch)
tree69789d0b45c46224f4675f0d37b6386251193d3e /allchblk.c
parentafbc74ab7f0fb3f19d18294083cbcf68a6200e58 (diff)
downloadbdwgc-6c1a9244581cdceaf39c7321e524b1ef5a099980.tar.gz
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.
Diffstat (limited to 'allchblk.c')
-rw-r--r--allchblk.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/allchblk.c b/allchblk.c
index 77e036a9..fbe6dd7e 100644
--- a/allchblk.c
+++ b/allchblk.c
@@ -225,6 +225,12 @@ static GC_bool setup_header(hdr * hhdr, struct hblk *block, size_t byte_sz,
# ifndef MARK_BIT_PER_OBJ
size_t granules;
# endif
+# ifdef ENABLE_DISCLAIM
+ if (GC_obj_kinds[kind].ok_disclaim_proc)
+ flags |= HAS_DISCLAIM;
+ if (GC_obj_kinds[kind].ok_mark_unconditionally)
+ flags |= MARK_UNCONDITIONALLY;
+# endif
/* Set size, kind and mark proc fields */
hhdr -> hb_sz = byte_sz;