* disclaim.c, include/gc_disclaim.h: Fix prototype.
* include/private/gc_priv.h, mark.c: Avoid missing initializer warning.
* mark.c: Fix type of a size_t variable in GC_reclaim_block.
* misc.c: Initialize ok_mark_unconditionally.
* reclaim.c: Tweak and avoid unused label warning.
* tests/disclaim_bench.c, tests/disclaim_test.c: Remove or
conditionalize unused variables.
/* Low level interface for reclaim callbacks. */
-int GC_register_disclaim_proc(int kind,
- int (*proc)(void *obj, void *cd), void *cd,
- int mark_unconditionally)
+void GC_register_disclaim_proc(int kind,
+ int (*proc)(void *obj, void *cd), void *cd,
+ int mark_unconditionally)
{
GC_obj_kinds[kind].ok_disclaim_proc = proc;
GC_obj_kinds[kind].ok_disclaim_cd = cd;
/* will be protected from collection if "mark_from_all" is non-zero, */
/* but at the expense that long chains of objects will take many cycles */
/* to reclaim. */
-int GC_register_disclaim_proc(int kind,
- int (*proc)(void *obj, void *cd), void *cd,
- int mark_from_all);
+void GC_register_disclaim_proc(int kind,
+ int (*proc)(void *obj, void *cd), void *cd,
+ int mark_from_all);
/* The finalizer closure used by GC_finalized_malloc. */
struct GC_finalizer_closure {
/* is reclaimed, but must also tolerate being */
/* called with object from freelist. Non-zero */
/* exit prevents object from being reclaimed. */
+# define OK_DISCLAIM_INITZ FALSE, NULL, NULL
+# else
+# define OK_DISCLAIM_INITZ
# endif
} GC_obj_kinds[MAXOBJKINDS];
/* It's done here, since we need to deal with mark descriptors. */
GC_INNER struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
/* PTRFREE */ { &GC_aobjfreelist[0], 0 /* filled in dynamically */,
- 0 | GC_DS_LENGTH, FALSE, FALSE },
+ 0 | GC_DS_LENGTH, FALSE, FALSE,
+ OK_DISCLAIM_INITZ },
/* NORMAL */ { &GC_objfreelist[0], 0,
0 | GC_DS_LENGTH, /* Adjusted in GC_init for EXTRA_BYTES */
- TRUE /* add length to descr */, TRUE },
+ TRUE /* add length to descr */, TRUE,
+ OK_DISCLAIM_INITZ },
/* UNCOLLECTABLE */
{ &GC_uobjfreelist[0], 0,
- 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE },
+ 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE,
+ OK_DISCLAIM_INITZ },
# ifdef ATOMIC_UNCOLLECTABLE
/* AUNCOLLECTABLE */
{ &GC_auobjfreelist[0], 0,
- 0 | GC_DS_LENGTH, FALSE /* add length to descr */, FALSE },
+ 0 | GC_DS_LENGTH, FALSE /* add length to descr */, FALSE,
+ OK_DISCLAIM_INITZ },
# endif
# ifdef STUBBORN_ALLOC
/*STUBBORN*/ { (void **)&GC_sobjfreelist[0], 0,
- 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE },
+ 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE,
+ OK_DISCLAIM_INITZ },
# endif
};
/* first word. */
void GC_push_unconditionally(struct hblk *h, hdr *hhdr)
{
- int sz = hhdr -> hb_sz;
- int descr = hhdr -> hb_descr;
+ size_t sz = hhdr -> hb_sz;
+ word descr = hhdr -> hb_descr;
ptr_t p;
ptr_t lim;
mse * GC_mark_stack_top_reg;
GC_obj_kinds[result].ok_descriptor = descr;
GC_obj_kinds[result].ok_relocate_descr = adjust;
GC_obj_kinds[result].ok_init = clear;
+# ifdef MARK_UNCONDITIONALLY
+ GC_obj_kinds[result].ok_mark_unconditionally = 0;
+# endif
# ifdef ENABLE_DISCLAIM
GC_obj_kinds[result].ok_disclaim_proc = 0;
GC_obj_kinds[result].ok_disclaim_cd = 0;
# ifdef ENABLE_DISCLAIM
if (EXPECT(hhdr->hb_flags & HAS_DISCLAIM, 0)) {
struct obj_kind *ok = &GC_obj_kinds[hhdr->hb_obj_kind];
- int resurrect;
- resurrect = (*ok->ok_disclaim_proc)(hbp, ok->ok_disclaim_cd);
- if (resurrect) {
+ if ((*ok->ok_disclaim_proc)(hbp, ok->ok_disclaim_cd)) {
+ /* Not disclaimed => resurrect the object. */
set_mark_bit_from_hdr(hhdr, 0);
/* excuse me, */ goto in_use;
}
GC_freehblk(hbp);
}
} else {
+# ifdef ENABLE_DISCLAIM
in_use:
+# endif
if (hhdr -> hb_descr != 0) {
GC_composite_in_use += sz;
} else {
int main(int argc, char **argv)
{
int i;
- int repeat;
int model;
testobj_t *keep_arr;
double t;
int main()
{
+#if THREAD_CNT > 1
pthread_t th[THREAD_CNT];
int i;
+#endif
+
GC_init();
GC_init_finalized_malloc();
#if THREAD_CNT > 1