STATIC int GC_finalized_kind = 0;
+#if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH)
+ /* The first bit is already used for a debug purpose. */
+# define FINALIZER_CLOSURE_FLAG 0x2
+#else
+# define FINALIZER_CLOSURE_FLAG 0x1
+#endif
+
STATIC int GC_CALLBACK GC_finalized_disclaim(void *obj)
{
word fc_word = *(word *)obj;
- if ((fc_word & 1) != 0) {
+ if ((fc_word & FINALIZER_CLOSURE_FLAG) != 0) {
/* The disclaim function may be passed fragments from the */
/* free-list, on which it should not run finalization. */
/* To recognize this case, we use the fact that the first word */
/* which does not use the first word for storing finalization */
/* info, GC_reclaim_with_finalization must be extended to clear */
/* fragments so that the assumption holds for the selected word. */
- const struct GC_finalizer_closure *fc = (void *)(fc_word & ~(word)1);
+ const struct GC_finalizer_closure *fc
+ = (void *)(fc_word & ~(word)FINALIZER_CLOSURE_FLAG);
(*fc->proc)((word *)obj + 1, fc->cd);
}
return 0;
return NULL;
GC_ASSERT(GC_size(op) >= lb);
}
- *(word *)op = (word)fclos | 1;
+ *(word *)op = (word)fclos | FINALIZER_CLOSURE_FLAG;
return GC_clear_stack((word *)op + 1);
}
result = (void *)my_entry;
*my_fl = next;
obj_link(result) = 0;
- *(word *)result = (word)fclos | 1;
+ *(word *)result = (word)fclos | FINALIZER_CLOSURE_FLAG;
GC_PREFETCH_FOR_WRITE(next);
return (word *)result + 1;
}