diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2016-07-28 12:06:42 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2016-07-28 12:06:42 +0300 |
commit | 012da3f159076fadf828a023786c41aea8537fd4 (patch) | |
tree | 496238899e64a7ca747029a8ccfb9d95bd9a8ab8 | |
parent | b5d5c4363242461181b36f9fe565d9685c8bc6ad (diff) | |
download | bdwgc-012da3f159076fadf828a023786c41aea8537fd4.tar.gz |
Fix tag collision between ENABLE_DISCLAIM and KEEP_BACK_PTRS
* fnlz_mlc.c (FINALIZER_CLOSURE_FLAG): New macro (defined to 0x2 in
case 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.
-rw-r--r-- | fnlz_mlc.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -21,11 +21,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 */ @@ -34,7 +41,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; @@ -84,7 +92,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_finalized_malloc(size_t lb, 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; } |