Skip to content

Commit

Permalink
suggestion from Gabriel's review
Browse files Browse the repository at this point in the history
  • Loading branch information
d-netto committed Jul 18, 2023
1 parent 3e66d25 commit 39879b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ FORCE_INLINE int gc_try_setmark_tag(jl_taggedvalue_t *o, uint8_t mark_mode) JL_N
tag = tag | mark_mode;
assert((tag & 0x3) == mark_mode);
}
// XXX: note that marking not only sets the GC bits but also updates the
// page metadata for pool allocated objects.
// The second step is **not** idempotent, so we need a compare exchange here
// (instead of a pair of load&store) to avoid marking an object twice
tag = jl_atomic_exchange_relaxed((_Atomic(uintptr_t)*)&o->header, tag);
verify_val(jl_valueof(o));
return !gc_marked(tag);
Expand Down

0 comments on commit 39879b7

Please sign in to comment.