Skip to content

Commit

Permalink
analyzer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Diogo Netto committed Sep 8, 2022
1 parent a690320 commit 97127d8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2542,18 +2542,20 @@ void gc_drain_all_queues(jl_ptls_t ptls, jl_gc_markqueue_t *mq) JL_NOTSAFEPOINT
}
}

void gc_mark_entry_seq(jl_ptls_t ptls)
int8_t gc_mark_entry_seq(jl_ptls_t ptls) JL_NOTSAFEPOINT
{
uint8_t state0 = jl_atomic_load_relaxed(&ptls->gc_state);
if (jl_options.parallel_marking) {
jl_atomic_fetch_add(&nworkers_marking, 1);
jl_atomic_exchange(&ptls->gc_state, JL_GC_STATE_PARALLEL);
state0 = jl_atomic_exchange(&ptls->gc_state, JL_GC_STATE_PARALLEL);
}
return state0;
}

void gc_mark_exit_seq(jl_ptls_t ptls)
void gc_mark_exit_seq(jl_ptls_t ptls, int8_t state0) JL_NOTSAFEPOINT
{
if (jl_options.parallel_marking) {
jl_atomic_store_release(&ptls->gc_state, JL_GC_STATE_WAITING);
jl_atomic_store_release(&ptls->gc_state, state0);
jl_atomic_fetch_add(&nworkers_marking, -1);
}
}
Expand All @@ -2564,22 +2566,22 @@ void gc_mark_exit_seq(jl_ptls_t ptls)
// makes it easier to implement parallel marking via work-stealing
void gc_mark_loop(jl_ptls_t ptls)
{
gc_mark_entry_seq(ptls);
int8_t state0 = gc_mark_entry_seq(ptls);
gc_mark_loop_(ptls, &ptls->mark_queue);
gc_drain_own_chunkqueue(ptls, &ptls->mark_queue);
gc_drain_all_queues(ptls, &ptls->mark_queue);
gc_mark_exit_seq(ptls);
gc_mark_exit_seq(ptls, state0);
}

// Mark-loop wrapper. Call workers for parallel marking and mark
STATIC_INLINE void gc_mark_loop_master(jl_ptls_t ptls)
{
gc_mark_entry_seq(ptls);
int8_t state0 = gc_mark_entry_seq(ptls);
gc_wake_workers(ptls);
gc_mark_loop_(ptls, &ptls->mark_queue);
gc_drain_own_chunkqueue(ptls, &ptls->mark_queue);
gc_drain_all_queues(ptls, &ptls->mark_queue);
gc_mark_exit_seq(ptls);
gc_mark_exit_seq(ptls, state0);
}

static void gc_premark(jl_ptls_t ptls2)
Expand Down

0 comments on commit 97127d8

Please sign in to comment.