Skip to content

Commit 7564f51

Browse files
committed
Move call to initialize_collection back to initialization
Foreign thread adoption can cause additional calls to `jl_init_thread_heap()` with a `ptls` that has `tid` 0. Thus we cannot use that condition to ensure that `initialize_collection` is called only once. Move the call back to `init.c`.
1 parent 76737d3 commit 7564f51

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,9 @@ JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel)
806806

807807
jl_ptls_t ptls = jl_init_threadtls(0);
808808

809+
#ifdef MMTK_GC
810+
initialize_collection((void *)ptls);
811+
#endif
809812
#pragma GCC diagnostic push
810813
#if defined(_COMPILER_GCC_) && __GNUC__ >= 12
811814
#pragma GCC diagnostic ignored "-Wdangling-pointer"

src/mmtk-gc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ void jl_init_thread_heap(jl_ptls_t ptls)
266266

267267
MMTk_Mutator mmtk_mutator = bind_mutator((void *)ptls, ptls->tid);
268268
ptls->mmtk_mutator_ptr = ((MMTkMutatorContext*)mmtk_mutator);
269-
270-
if (ptls->tid == 0)
271-
initialize_collection((void *)ptls);
272269
}
273270

274271
// System-wide initialization

0 commit comments

Comments
 (0)