(a cherry-pick of commits
bb8e97c1,
f30c0150 from 'master')
* include/private/gc_priv.h [MANUAL_VDB] (GC_dirty_inner):
Declare GC_INNER function.
* include/private/gc_priv.h (GC_dirty): Define macro (calls
GC_dirty_inner if MANUAL_VDB and GC_incremental.
* mallocx.c [MANUAL_VDB] (GC_dirty): Remove declaration.
* mark.c [MANUAL_VDB && THREADS] (GC_dirty): Likewise.
* stubborn.c [MANUAL_VDB] (GC_dirty): Likewise.
* os_dep.c [MANUAL_VDB] (GC_dirty): Rename to GC_dirty_inner;
add GC_INNER; change argument type from ptr_t to const void*.
/* GC_enable_incremental once more). */
#endif /* !GC_DISABLE_INCREMENTAL */
+#ifdef MANUAL_VDB
+ GC_INNER void GC_dirty_inner(const void *p); /* does not require locking */
+# define GC_dirty(p) (GC_incremental ? GC_dirty_inner(p) : (void)0)
+#else
+# define GC_dirty(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)))
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. */
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(p); /* entire object */
# endif
PUSH_CONTENTS_HDR(r, GC_mark_stack_top, GC_mark_stack_limit,
source, mark_and_push_exit, hhdr, FALSE);
/* Mark the page containing p as dirty. Logically, this dirties the */
/* entire object. */
- void GC_dirty(ptr_t p)
+ GC_INNER void GC_dirty_inner(const void *p)
{
word index = PHT_HASH(p);
async_set_pht_entry_from_index(GC_dirty_pages, index);
/* written, but not yet GC_dirty()ed objects must be referenced */
/* by a stack. */
- void GC_dirty(ptr_t p);
-
GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb)
{
return(GC_malloc(lb));
GC_API void GC_CALL GC_end_stubborn_change(const void *p)
{
- GC_dirty((ptr_t)p);
+ GC_dirty(p); /* entire object */
}
GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)