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;
op = GC_malloc_kind(lb + sizeof(word), GC_finalized_kind);
if (EXPECT(NULL == op, FALSE))
return NULL;
- *op = (word)fclos | 1;
+ *op = (word)fclos | FINALIZER_CLOSURE_FLAG;
return op + 1;
}