Skip to content

Commit

Permalink
no need to check whether mq_master is nil in the GC work-stealing loop (
Browse files Browse the repository at this point in the history
JuliaLang#53899)

This is not needed after JuliaLang#53355.
  • Loading branch information
d-netto authored Mar 30, 2024
1 parent d10a0fb commit 24ff6f4
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2976,11 +2976,10 @@ JL_EXTENSION NOINLINE void gc_mark_loop_serial(jl_ptls_t ptls)

void gc_mark_and_steal(jl_ptls_t ptls)
{
jl_gc_markqueue_t *mq = &ptls->mark_queue;
jl_gc_markqueue_t *mq_master = NULL;
int master_tid = jl_atomic_load(&gc_master_tid);
assert(master_tid != -1);
mq_master = &gc_all_tls_states[master_tid]->mark_queue;
jl_gc_markqueue_t *mq = &ptls->mark_queue;
jl_gc_markqueue_t *mq_master = &gc_all_tls_states[master_tid]->mark_queue;
void *new_obj;
jl_gc_chunk_t c;
pop : {
Expand Down Expand Up @@ -3024,12 +3023,10 @@ void gc_mark_and_steal(jl_ptls_t ptls)
}
}
// Try to steal chunk from master thread
if (mq_master != NULL) {
c = gc_chunkqueue_steal_from(mq_master);
if (c.cid != GC_empty_chunk) {
gc_mark_chunk(ptls, mq, &c);
goto pop;
}
c = gc_chunkqueue_steal_from(mq_master);
if (c.cid != GC_empty_chunk) {
gc_mark_chunk(ptls, mq, &c);
goto pop;
}
// Try to steal pointer from random GC thread
for (int i = 0; i < 4 * jl_n_markthreads; i++) {
Expand All @@ -3047,11 +3044,9 @@ void gc_mark_and_steal(jl_ptls_t ptls)
goto mark;
}
// Try to steal pointer from master thread
if (mq_master != NULL) {
new_obj = gc_ptr_queue_steal_from(mq_master);
if (new_obj != NULL)
goto mark;
}
new_obj = gc_ptr_queue_steal_from(mq_master);
if (new_obj != NULL)
goto mark;
}
}

Expand Down

0 comments on commit 24ff6f4

Please sign in to comment.