]> granicus.if.org Git - gc/commitdiff
Hide and rename GC_dirty to GC_dirty_async[_inner]
authorIvan Maidanski <ivmai@mail.ru>
Thu, 17 May 2018 08:14:51 +0000 (11:14 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 17 May 2018 08:15:40 +0000 (11:15 +0300)
(code refactoring)

Also, do not call GC_dirty_async_inner unless GC_incremental.

* include/private/gc_priv.h [MANUAL_VDB] (GC_dirty_async_inner):
Declare GC_INNER function.
* include/private/gc_priv.h (GC_dirty_async): New macro (calls
GC_dirty_async_inner if MANUAL_VDB and GC_incremental.
* mallocx.c [MANUAL_VDB] (GC_dirty): Remove declaration.
* mark.c [MANUAL_VDB && THREADS] (GC_dirty): Likewise.
* mallocx.c (GC_end_stubborn_change): Remove GC_ATTR_UNUSED; call
GC_dirty_async (unconditionally) instead of GC_dirty.
* mark.c [THREADS] (GC_mark_and_push_stack): Call GC_dirty_async
instead of GC_dirty.
* os_dep.c [MANUAL_VDB] (GC_dirty): Rename to GC_dirty_async_inner;
add GC_INNER; change argument type from ptr_t to const void*.

include/private/gc_priv.h
mallocx.c
mark.c
os_dep.c

index 9c9783344c564b0dc08691f22a1bac9fb3058f2f..f5a555b5e3710052f7e9474003befa15f645ec5d 100644 (file)
@@ -2180,6 +2180,14 @@ GC_EXTERN GC_bool GC_print_back_height;
                 /* GC_enable_incremental once more).                    */
 #endif /* !GC_DISABLE_INCREMENTAL */
 
+#ifdef MANUAL_VDB
+  GC_INNER void GC_dirty_async_inner(const void *p);
+# define GC_dirty_async(p) \
+                (GC_incremental ? GC_dirty_async_inner(p) : (void)0)
+#else
+# define GC_dirty_async(p) (void)(p)
+#endif
+
 /* Same as GC_base but excepts and returns a pointer to const object.   */
 #define GC_base_C(p) ((const void *)GC_base((/* no const */ void *)(p)))
 
index f9376836afe82444613d2d89c619708b33254d5a..b4ee570cb617ba4ba602cce62b40448b733c1487 100644 (file)
--- a/mallocx.c
+++ b/mallocx.c
@@ -611,13 +611,7 @@ GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)
   /* Empty. */
 }
 
-#if defined(MANUAL_VDB)
-  void GC_dirty(ptr_t p);
-#endif
-
-GC_API void GC_CALL GC_end_stubborn_change(const void *p GC_ATTR_UNUSED)
+GC_API void GC_CALL GC_end_stubborn_change(const void *p)
 {
-# ifdef MANUAL_VDB
-    GC_dirty((ptr_t)p);
-# endif
+  GC_dirty_async(p); /* entire object */
 }
diff --git a/mark.c b/mark.c
index 29104656887256a81d81a6a73fcfb0bd3d057a74..bf0f65f28dc6abac4c5617e993ac2b10a4dcb253 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -1463,10 +1463,6 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj,
     return mark_stack_ptr;
 }
 
-#if defined(MANUAL_VDB) && defined(THREADS)
-  void GC_dirty(ptr_t p);
-#endif
-
 /* Mark and push (i.e. gray) a single object p onto the main    */
 /* mark stack.  Consider p to be valid if it is an interior     */
 /* pointer.                                                     */
@@ -1497,10 +1493,10 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj,
         GC_ADD_TO_BLACK_LIST_NORMAL(p, source);
         return;
     }
-#   if defined(MANUAL_VDB) && defined(THREADS)
+#   ifdef THREADS
       /* Pointer is on the stack.  We may have dirtied the object       */
-      /* it points to, but not yet have called GC_dirty();              */
-      GC_dirty(p);      /* Implicitly affects entire object.            */
+      /* it points to, but have not called GC_dirty yet.                */
+      GC_dirty_async(p); /* entire object */
 #   endif
     PUSH_CONTENTS_HDR(r, GC_mark_stack_top, GC_mark_stack_limit,
                       source, hhdr, FALSE);
index 8e7e67fdfeeec4f8f008346c7225071927f21a47..b5c99f177fd3b505b207b688c0b07577ef99ff8e 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3040,7 +3040,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
 
   /* Mark the page containing p as dirty.  Logically, this dirties the  */
   /* entire object.                                                     */
-  void GC_dirty(ptr_t p)
+  GC_INNER void GC_dirty_async_inner(const void *p)
   {
     word index = PHT_HASH(p);
     async_set_pht_entry_from_index(GC_dirty_pages, index);