Skip to content

Commit bde346f

Browse files
authored
gc: fix MEMDEBUG build (#35622)
Sink the assume to the right point, to ensure the compiler doesn't use this information to mis-optimize the code in MEMDEBUG mode.
1 parent 6beec65 commit bde346f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ STATIC_INLINE void gc_setmark_pool_(jl_ptls_t ptls, jl_taggedvalue_t *o,
725725
#ifdef MEMDEBUG
726726
gc_setmark_big(ptls, o, mark_mode);
727727
#else
728+
jl_assume(page);
728729
if (mark_mode == GC_OLD_MARKED) {
729730
ptls->gc_cache.perm_scanned_bytes += page->osize;
730731
jl_atomic_fetch_add_relaxed(&page->nold, 1);
@@ -748,7 +749,7 @@ STATIC_INLINE void gc_setmark_pool_(jl_ptls_t ptls, jl_taggedvalue_t *o,
748749
STATIC_INLINE void gc_setmark_pool(jl_ptls_t ptls, jl_taggedvalue_t *o,
749750
uint8_t mark_mode) JL_NOTSAFEPOINT
750751
{
751-
gc_setmark_pool_(ptls, o, mark_mode, jl_assume(page_metadata(o)));
752+
gc_setmark_pool_(ptls, o, mark_mode, page_metadata(o));
752753
}
753754

754755
STATIC_INLINE void gc_setmark(jl_ptls_t ptls, jl_taggedvalue_t *o,

0 commit comments

Comments
 (0)