@@ -129,6 +129,11 @@ void jl_parallel_gc_threadfun(void *arg)
129129
130130 // initialize this thread (set tid and create heap)
131131 jl_ptls_t ptls = jl_init_threadtls (targ -> tid );
132+ void * stack_lo , * stack_hi ;
133+ jl_init_stack_limits (0 , & stack_lo , & stack_hi );
134+ // warning: this changes `jl_current_task`, so be careful not to call that from this function
135+ jl_task_t * ct = jl_init_root_task (ptls , stack_lo , stack_hi );
136+ JL_GC_PROMISE_ROOTED (ct );
132137 (void )jl_atomic_fetch_add_relaxed (& nrunning , -1 );
133138 // wait for all threads
134139 jl_gc_state_set (ptls , JL_GC_STATE_WAITING , JL_GC_STATE_UNSAFE );
@@ -158,6 +163,11 @@ void jl_concurrent_gc_threadfun(void *arg)
158163
159164 // initialize this thread (set tid and create heap)
160165 jl_ptls_t ptls = jl_init_threadtls (targ -> tid );
166+ void * stack_lo , * stack_hi ;
167+ jl_init_stack_limits (0 , & stack_lo , & stack_hi );
168+ // warning: this changes `jl_current_task`, so be careful not to call that from this function
169+ jl_task_t * ct = jl_init_root_task (ptls , stack_lo , stack_hi );
170+ JL_GC_PROMISE_ROOTED (ct );
161171 (void )jl_atomic_fetch_add_relaxed (& nrunning , -1 );
162172 // wait for all threads
163173 jl_gc_state_set (ptls , JL_GC_STATE_WAITING , JL_GC_STATE_UNSAFE );
0 commit comments