summaryrefslogtreecommitdiff
path: root/dbg_mlc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-07-01 16:53:15 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-07-01 16:53:15 +0300
commit2e7daad62ee243556b67109535ddfacfb11a0160 (patch)
treecfaaf493c0fe2642721f0b7ec1e8eae9fa8d1f62 /dbg_mlc.c
parentc6107dca026f023f96af3f66f465a0727389ff7c (diff)
downloadbdwgc-2e7daad62ee243556b67109535ddfacfb11a0160.tar.gz
New public API (PTR_STORE_AND_DIRTY) to simplify store-and-dirty operation
* cord/cordbscs.c (CORD_cat_char_star, CORD_cat, CORD_from_fn_inner, CORD_substr_closure): Replace the last store to the heap-allocated object, GC_END_STUBBORN_CHANGE() and GC_reachable_here() with GC_PTR_STORE_AND_DIRTY() call. * cord/tests/de.c (prune_map, add_map, replace_line): Likewise. * include/gc_inline.h (GC_CONS): Likewise. * tests/disclaim_test.c (pair_dct, pair_new): Likewise. * tests/test.c [!VERY_SMALL_CONFIG] (cons): Likewise. * tests/test.c (small_cons, small_cons_uncollectable, reverse_test_inner, mktree): Likewise. * tests/test.c [GC_GCJ_SUPPORT] (gcj_cons): Likewise. * tests/test.c [GC_PTHREADS && !SMALL_CONFIG && !GC_DEBUG] (alloc8bytes): Likewise. * tests/test.c [!NO_TYPED_TEST] (typed_test): Likewise. * tests/test_cpp.cc (main): Likewise. * dbg_mlc.c (GC_debug_ptr_store_and_dirty): Implement. * mallocx.c (GC_ptr_store_and_dirty): Likewise. * include/gc.h (GC_PTR_STORE_AND_DIRTY): New public macro. * include/gc.h (GC_debug_ptr_store_and_dirty, GC_ptr_store_and_dirty): Declare new public API function; add comment. * tests/test.c (reverse_test_inner): Remove tmp local variable. * tests/test.c (mktree): Remove right_left local variable.
Diffstat (limited to 'dbg_mlc.c')
-rw-r--r--dbg_mlc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dbg_mlc.c b/dbg_mlc.c
index 04716623..50eda33f 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -630,6 +630,13 @@ GC_API void GC_CALL GC_debug_end_stubborn_change(const void *p)
GC_end_stubborn_change(q);
}
+GC_API void GC_CALL GC_debug_ptr_store_and_dirty(void *p, const void *q)
+{
+ *(void **)GC_is_visible(p) = GC_is_valid_displacement((void *)q);
+ GC_debug_end_stubborn_change(p);
+ REACHABLE_AFTER_DIRTY(q);
+}
+
GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_atomic(size_t lb,
GC_EXTRA_PARAMS)
{