From: Ivan Maidanski Date: Thu, 28 Jul 2016 09:06:42 +0000 (+0300) Subject: Fix tag collision between ENABLE_DISCLAIM and KEEP_BACK_PTRS X-Git-Tag: v7.4.6~261 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ea81358992c920be52ba80823f5fe3cda817dec;p=gc Fix tag collision between ENABLE_DISCLAIM and KEEP_BACK_PTRS (Apply commit 012da3f from 'master' branch.) * fnlz_mlc.c (FINALIZER_CLOSURE_FLAG): New macro (defined to 0x2 in case of KEEP_BACK_PTRS or MAKE_BACK_GRAPH, otherwise to 0x1). * fnlz_mlc.c (GC_finalized_disclaim, GC_finalized_malloc): Use FINALIZER_CLOSURE_FLAG instead of 0x1. --- diff --git a/fnlz_mlc.c b/fnlz_mlc.c index 1305d944..7f8ca84f 100644 --- a/fnlz_mlc.c +++ b/fnlz_mlc.c @@ -26,11 +26,18 @@ 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 */ @@ -39,7 +46,8 @@ STATIC int GC_CALLBACK GC_finalized_disclaim(void *obj) /* 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; @@ -122,7 +130,7 @@ GC_API void GC_CALL GC_register_disclaim_proc(int kind, GC_disclaim_proc proc, 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); } @@ -163,7 +171,7 @@ GC_API void GC_CALL GC_register_disclaim_proc(int kind, GC_disclaim_proc proc, 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; }