From: Ivan Maidanski Date: Tue, 8 May 2018 18:04:55 +0000 (+0300) Subject: Fix missing GC_dirty invocation from debug_end_stubborn_change X-Git-Tag: v8.0.0~193 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=228bb2776633790c562fa7f2d31c60978331036a;p=gc Fix missing GC_dirty invocation from debug_end_stubborn_change GC_debug_end_stubborn_change was no-op unless STUBBORN_ALLOC defined. * dbg_mlc.c (GC_debug_end_stubborn_change): De-duplicate definition; remove hhdr local variable. * dbg_mlc.c [!STUBBORN_ALLOC] (GC_debug_end_stubborn_change): Check p belongs to GC heap; call GC_end_stubborn_change(GC_base(p)). --- diff --git a/dbg_mlc.c b/dbg_mlc.c index 306ae94e..80b1bc9e 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -640,22 +640,6 @@ STATIC void * GC_debug_generic_malloc(size_t lb, int knd, GC_EXTRA_PARAMS) GC_change_stubborn(q); } - GC_API void GC_CALL GC_debug_end_stubborn_change(const void *p) - { - const void * q = GC_base_C(p); - hdr * hhdr; - - if (q == 0) { - ABORT_ARG1("GC_debug_end_stubborn_change: bad arg", ": %p", p); - } - hhdr = HDR(q); - if (hhdr -> hb_obj_kind != STUBBORN) { - ABORT_ARG1("GC_debug_end_stubborn_change: arg not stubborn", - ": %p", p); - } - GC_end_stubborn_change(q); - } - #else /* !STUBBORN_ALLOC */ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_stubborn(size_t lb, @@ -666,11 +650,23 @@ STATIC void * GC_debug_generic_malloc(size_t lb, int knd, GC_EXTRA_PARAMS) GC_API void GC_CALL GC_debug_change_stubborn( const void * p GC_ATTR_UNUSED) {} - - GC_API void GC_CALL GC_debug_end_stubborn_change( - const void * p GC_ATTR_UNUSED) {} #endif /* !STUBBORN_ALLOC */ +GC_API void GC_CALL GC_debug_end_stubborn_change(const void *p) +{ + const void * q = GC_base_C(p); + + if (NULL == q) { + ABORT_ARG1("GC_debug_end_stubborn_change: bad arg", ": %p", p); + } +# ifdef STUBBORN_ALLOC + if (HDR(q) -> hb_obj_kind != STUBBORN) + ABORT_ARG1("GC_debug_end_stubborn_change: arg not stubborn", + ": %p", p); +# endif + GC_end_stubborn_change(q); +} + GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS) {