Skip to content

Commit c8543de

Browse files
committed
Merge branch 'master' into update-upstream-43bf2c8
2 parents 8d0d8b5 + fdef6b1 commit c8543de

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/mmtk-gc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ void jl_gc_init(void)
350350
max_heap_size = uv_get_free_memory() * 70 / 100;
351351
}
352352

353+
// Assert that the number of stock GC threads is 0; MMTK uses the number of threads in jl_options.ngcthreads
354+
assert(jl_n_gcthreads == 0);
353355

354356
// Check that the julia_copy_stack rust feature has been defined when the COPY_STACK has been defined
355357
int copy_stacks;

src/threading.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,12 @@ void jl_init_threading(void)
694694
}
695695
int16_t ngcthreads = jl_n_markthreads + jl_n_sweepthreads;
696696

697+
#ifdef MMTK_GC
698+
// MMTk gets the number of GC threads from jl_options.ngcthreads, and spawn its GC threads.
699+
// So we just set ngcthreads to 0 here to avoid spawning any GC threads in Julia.
700+
ngcthreads = 0;
701+
#endif
702+
697703
jl_all_tls_states_size = nthreads + nthreadsi + ngcthreads;
698704
jl_n_threads_per_pool = (int*)malloc_s(2 * sizeof(int));
699705
jl_n_threads_per_pool[0] = nthreadsi;
@@ -711,11 +717,6 @@ void jl_start_threads(void)
711717
{
712718
int nthreads = jl_atomic_load_relaxed(&jl_n_threads);
713719
int ngcthreads = jl_n_gcthreads;
714-
#ifdef MMTK_GC
715-
// MMTk gets the number of GC threads from jl_options.ngcthreads, and spawn its GC threads.
716-
// So we just set ngcthreads to 0 here to avoid spawning any GC threads in Julia.
717-
ngcthreads = 0;
718-
#endif
719720
int cpumasksize = uv_cpumask_size();
720721
char *cp;
721722
int i, exclusive;

0 commit comments

Comments
 (0)