summaryrefslogtreecommitdiff
path: root/mark.c
diff options
context:
space:
mode:
Diffstat (limited to 'mark.c')
-rw-r--r--mark.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mark.c b/mark.c
index 9f39af5c..f33ec90c 100644
--- a/mark.c
+++ b/mark.c
@@ -1962,9 +1962,15 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr)
/* Test whether any page in the given block is dirty. */
STATIC GC_bool GC_block_was_dirty(struct hblk *h, hdr *hhdr)
{
- word sz = hhdr -> hb_sz;
+ word sz;
ptr_t p;
+# ifdef AO_HAVE_load
+ /* Atomic access is used to avoid racing with GC_realloc. */
+ sz = (word)AO_load((volatile AO_t *)&(hhdr -> hb_sz));
+# else
+ sz = hhdr -> hb_sz;
+# endif
if (sz <= MAXOBJBYTES) {
return GC_page_was_dirty(h);
}