diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-07-01 16:53:15 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-07-01 16:53:15 +0300 |
commit | 2e7daad62ee243556b67109535ddfacfb11a0160 (patch) | |
tree | cfaaf493c0fe2642721f0b7ec1e8eae9fa8d1f62 /include/gc.h | |
parent | c6107dca026f023f96af3f66f465a0727389ff7c (diff) | |
download | bdwgc-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 'include/gc.h')
-rw-r--r-- | include/gc.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/gc.h b/include/gc.h index cfe9f6bf..fd3e4266 100644 --- a/include/gc.h +++ b/include/gc.h @@ -960,6 +960,7 @@ GC_API /* 'realloc' attr */ GC_ATTR_ALLOC_SIZE(2) void * GC_CALL # define GC_REGISTER_FINALIZER_UNREACHABLE(p, f, d, of, od) \ GC_debug_register_finalizer_unreachable(p, f, d, of, od) # define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p) +# define GC_PTR_STORE_AND_DIRTY(p, q) GC_debug_ptr_store_and_dirty(p, q) # define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \ GC_general_register_disappearing_link(link, \ GC_base((/* no const */ void *)(obj))) @@ -986,6 +987,7 @@ GC_API /* 'realloc' attr */ GC_ATTR_ALLOC_SIZE(2) void * GC_CALL # define GC_REGISTER_FINALIZER_UNREACHABLE(p, f, d, of, od) \ GC_register_finalizer_unreachable(p, f, d, of, od) # define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p) +# define GC_PTR_STORE_AND_DIRTY(p, q) GC_ptr_store_and_dirty(p, q) # define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \ GC_general_register_disappearing_link(link, obj) # define GC_REGISTER_LONG_LINK(link, obj) \ @@ -1635,6 +1637,14 @@ GC_API void GC_CALL GC_dump_finalization(void); # define GC_PTR_STORE(p, q) (*(void **)(p) = (void *)(q)) #endif +/* GC_PTR_STORE_AND_DIRTY(p,q) is equivalent to GC_PTR_STORE(p,q) */ +/* followed by GC_END_STUBBORN_CHANGE(p) and GC_reachable_here(q) */ +/* (assuming p and q do not have side effects). */ +GC_API void GC_CALL GC_ptr_store_and_dirty(void * /* p */, + const void * /* q */); +GC_API void GC_CALL GC_debug_ptr_store_and_dirty(void * /* p */, + const void * /* q */); + /* Functions called to report pointer checking errors */ GC_API void (GC_CALLBACK * GC_same_obj_print_proc)(void * /* p */, void * /* q */); |