]> granicus.if.org Git - gc/commitdiff
Fix missing GC_dirty invocation from debug_end_stubborn_change
authorIvan Maidanski <ivmai@mail.ru>
Tue, 8 May 2018 18:04:55 +0000 (21:04 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 17 Jul 2018 07:29:27 +0000 (10:29 +0300)
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)).

dbg_mlc.c

index 145a42e1b35a64b73871f274a7ebaf29d40d20a8..f9560657767ab55ff6ca5cb1214e11bc86c22b4a 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -608,22 +608,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
     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,
@@ -634,11 +618,23 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
 
   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)
 {