summaryrefslogtreecommitdiff
path: root/mallocx.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 /mallocx.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 'mallocx.c')
-rw-r--r--mallocx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mallocx.c b/mallocx.c
index 7f7f0966..5cbb333a 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -211,7 +211,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
lb_rounded = GRANULES_TO_BYTES(lg);
n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded);
init = GC_obj_kinds[k].ok_init;
- if (EXPECT(GC_have_errors, FALSE))
+ if (EXPECT(get_have_errors(), FALSE))
GC_print_all_errors();
GC_INVOKE_FINALIZERS();
GC_DBG_COLLECT_AT_MALLOC(lb);
@@ -331,7 +331,7 @@ GC_API void GC_CALL GC_generic_malloc_many(size_t lb, int k, void **result)
GC_ASSERT(k < MAXOBJKINDS);
lw = BYTES_TO_WORDS(lb);
lg = BYTES_TO_GRANULES(lb);
- if (EXPECT(GC_have_errors, FALSE))
+ if (EXPECT(get_have_errors(), FALSE))
GC_print_all_errors();
GC_INVOKE_FINALIZERS();
GC_DBG_COLLECT_AT_MALLOC(lb);