summaryrefslogtreecommitdiff
path: root/blacklst.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-09-26 10:12:06 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-09-26 10:12:06 +0300
commitcdc201f402616f89d478d868b44c8ff1b7462e55 (patch)
treecd3b1a2c8174bad70a8cf045158d98a60a582d3b /blacklst.c
parent0c0e4cd0b90569e5aae726743f1f636724c2f4a4 (diff)
downloadbdwgc-cdc201f402616f89d478d868b44c8ff1b7462e55.tar.gz
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).
Diffstat (limited to 'blacklst.c')
-rw-r--r--blacklst.c16
1 files changed, 14 insertions, 2 deletions
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);
}
}