Skip to content

Commit 8df38a5

Browse files
committed
Revert "Don't use exchange in the hot path of the GC (#50021)"
This reverts commit 0a2d6fc.
1 parent ffe1a07 commit 8df38a5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/gc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ STATIC_INLINE void gc_queue_big_marked(jl_ptls_t ptls, bigval_t *hdr,
799799
FORCE_INLINE int gc_try_setmark_tag(jl_taggedvalue_t *o, uint8_t mark_mode) JL_NOTSAFEPOINT
800800
{
801801
assert(gc_marked(mark_mode));
802-
uintptr_t tag = jl_atomic_load_relaxed((_Atomic(uintptr_t)*)&o->header);
802+
uintptr_t tag = o->header;
803803
if (gc_marked(tag))
804804
return 0;
805805
if (mark_reset_age) {
@@ -813,9 +813,9 @@ 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-
jl_atomic_store_relaxed((_Atomic(uintptr_t)*)&o->header, tag); //xchg here was slower than
817-
verify_val(jl_valueof(o)); //potentially redoing work because of a stale tag.
818-
return 1;
816+
tag = jl_atomic_exchange_relaxed((_Atomic(uintptr_t)*)&o->header, tag);
817+
verify_val(jl_valueof(o));
818+
return !gc_marked(tag);
819819
}
820820

821821
// This function should be called exactly once during marking for each big

0 commit comments

Comments
 (0)