summaryrefslogtreecommitdiff
path: root/dbg_mlc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-04-01 00:40:12 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-04-01 00:41:21 +0300
commitdbcff3bb14748e6798700f094ccb2771b7160160 (patch)
tree28c4673f75e3fcb5e34f634dc4a191fdf57f65ba /dbg_mlc.c
parent0eb8d2f95c7a683338b9e3c2b55c84aa5edb4bf7 (diff)
downloadbdwgc-dbcff3bb14748e6798700f094ccb2771b7160160.tar.gz
Eliminate data race reported by TSan in GC_have_errors
* alloc.c (GC_gcollect): Replace read of GC_have_errors with get_have_errors() call. * malloc.c (GC_generic_malloc): Likewise. * mallocx.c (GC_generic_malloc_ignore_off_page, GC_generic_malloc_many): Likewise. * reclaim.c (GC_print_all_errors): Likewise. * dbg_mlc.c [!SHORT_DBG_HDRS] (GC_debug_free, GC_add_smashed): Replace GC_have_errors=TRUE with GC_SET_HAVE_ERRORS(). * reclaim.c (GC_add_leaked): Likewise. * include/private/gc_priv.h [AO_HAVE_store] (GC_have_errors): Change type from GC_bool to volatile AO_t; refine comment. * reclaim.c [AO_HAVE_store] (GC_have_errors): Likewise. * include/private/gc_priv.h (GC_SET_HAVE_ERRORS, get_have_errors): Define macro.
Diffstat (limited to 'dbg_mlc.c')
-rw-r--r--dbg_mlc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dbg_mlc.c b/dbg_mlc.c
index bb5c5e66..73ab496a 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -782,7 +782,7 @@ GC_API void GC_CALL GC_debug_free(void * p)
ptr_t clobbered = GC_check_annotated_obj((oh *)base);
word sz = GC_size(base);
if (clobbered != 0) {
- GC_have_errors = TRUE;
+ GC_SET_HAVE_ERRORS(); /* no "release" barrier is needed */
if (((oh *)base) -> oh_sz == sz) {
GC_print_smashed_obj(
"GC_debug_free: found previously deallocated (?) object at",
@@ -795,7 +795,7 @@ GC_API void GC_CALL GC_debug_free(void * p)
}
/* Invalidate size (mark the object as deallocated) */
((oh *)base) -> oh_sz = sz;
-# endif /* SHORT_DBG_HDRS */
+# endif /* !SHORT_DBG_HDRS */
}
if (GC_find_leak
# ifndef SHORT_DBG_HDRS
@@ -947,7 +947,7 @@ STATIC void GC_add_smashed(ptr_t smashed)
if (GC_n_smashed < MAX_SMASHED - 1) ++GC_n_smashed;
/* In case of overflow, we keep the first MAX_SMASHED-1 */
/* entries plus the last one. */
- GC_have_errors = TRUE;
+ GC_SET_HAVE_ERRORS();
}
/* Print all objects on the list. Clear the list. */