From cdc201f402616f89d478d868b44c8ff1b7462e55 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 26 Sep 2018 10:12:06 +0300 Subject: Use AO_or in async_set_pht_entry_from_index if available * blacklst.c (backlist_set_pht_entry_from_index): New macro; move comment from gc_priv.h. * blacklst.c (GC_add_to_black_list_normal, GC_add_to_black_list_stack): Use backlist_set_pht_entry_from_index() instead of set_pht_entry_from_index_concurrent(). * include/private/gc_priv.h (set_pht_entry_from_index): Add outermost parentheses; cast result to void. * include/private/gc_priv.h [THREADS] (set_pht_entry_from_index_concurrent): Define only if AO_HAVE_or; update comment. * include/private/gc_priv.h [THREADS] (GC_acquire_dirty_lock, GC_release_dirty_lock): Define to no-op if set_pht_entry_from_index_concurrent is defined. * include/private/gc_priv.h [THREADS && set_pht_entry_from_index_concurrent] (GC_fault_handler_lock): Do not declare. * os_dep.c [!GC_DISABLE_INCREMENTAL && THREADS && set_pht_entry_from_index_concurrent] (async_set_pht_entry_from_index): Redirect to set_pht_entry_from_index_concurrent; do not define GC_fault_handler_lock variable. * os_dep.c [!GC_DISABLE_INCREMENTAL && THREADS && !set_pht_entry_from_index_concurrent && AO_HAVE_test_and_set_acquire] (async_set_pht_entry_from_index): Remove GC_ATTR_NO_SANITIZE_THREAD (because AO_HAVE_or should be defined in case of TSan). --- blacklst.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'blacklst.c') diff --git a/blacklst.c b/blacklst.c index 452a340d..31511ae1 100644 --- a/blacklst.c +++ b/blacklst.c @@ -175,6 +175,18 @@ GC_INNER void GC_unpromote_black_lists(void) GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl); } +#if defined(set_pht_entry_from_index_concurrent) && defined(PARALLEL_MARK) \ + && defined(THREAD_SANITIZER) +# define backlist_set_pht_entry_from_index(db, index) \ + set_pht_entry_from_index_concurrent(db, index) +#else + /* It is safe to set a bit in a blacklist even without */ + /* synchronization, the only drawback is that we might have */ + /* to redo blacklisting sometimes. */ +# define backlist_set_pht_entry_from_index(bl, index) \ + set_pht_entry_from_index(bl, index) +#endif + /* P is not a valid pointer reference, but it falls inside */ /* the plausible heap bounds. */ /* Add it to the normal incomplete black list if appropriate. */ @@ -193,7 +205,7 @@ GC_INNER void GC_unpromote_black_lists(void) GC_print_blacklisted_ptr(p, source, "normal"); } # endif - set_pht_entry_from_index_concurrent(GC_incomplete_normal_bl, index); + backlist_set_pht_entry_from_index(GC_incomplete_normal_bl, index); } /* else this is probably just an interior pointer to an allocated */ /* object, and isn't worth black listing. */ } @@ -214,7 +226,7 @@ GC_INNER void GC_unpromote_black_lists(void) GC_print_blacklisted_ptr(p, source, "stack"); } # endif - set_pht_entry_from_index_concurrent(GC_incomplete_stack_bl, index); + backlist_set_pht_entry_from_index(GC_incomplete_stack_bl, index); } } -- cgit v1.2.1