Skip to content

Commit 39879b7

Browse files
committed
suggestion from Gabriel's review
1 parent 3e66d25 commit 39879b7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/gc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,10 @@ FORCE_INLINE int gc_try_setmark_tag(jl_taggedvalue_t *o, uint8_t mark_mode) JL_N
813813
tag = tag | mark_mode;
814814
assert((tag & 0x3) == mark_mode);
815815
}
816+
// XXX: note that marking not only sets the GC bits but also updates the
817+
// page metadata for pool allocated objects.
818+
// The second step is **not** idempotent, so we need a compare exchange here
819+
// (instead of a pair of load&store) to avoid marking an object twice
816820
tag = jl_atomic_exchange_relaxed((_Atomic(uintptr_t)*)&o->header, tag);
817821
verify_val(jl_valueof(o));
818822
return !gc_marked(tag);

0 commit comments

Comments
 (0)