Skip to content

Commit

Permalink
Fix the logic for scanning tasks in the Julia GC.
Browse files Browse the repository at this point in the history
This fixes the test that tries to avoid scanning the stack of the
current thread twice.
  • Loading branch information
rbehrends committed Jun 17, 2020
1 parent 816a3f5 commit b22355a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/julia_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ static jl_datatype_t * datatype_largebag;
static UInt StackAlignBags;
static Bag * GapStackBottom;
static jl_ptls_t JuliaTLS, SaveTLS;
static jl_task_t * MainTask;
static size_t max_pool_obj_size;
static UInt YoungRef;
static int FullGC;
Expand Down Expand Up @@ -583,6 +584,9 @@ static void GapRootScanner(int full)
// current_task != root_task.
char * stackend = (char *)jl_task_stack_buffer(task, &size, &tid);
stackend += size;
// We record the main task so that GapTaskScanner() will not scan
// it again.
MainTask = task;
// The following test overrides the stackend if the following two
// conditions hold:
//
Expand Down Expand Up @@ -646,7 +650,10 @@ static void GapTaskScanner(jl_task_t * task, int root_task)
if (tag->bits.gc & 2)
rescan = 0;
}
if (stack && tid < 0) {
// We only scan the task stack if there is a valid task stack and
// if the task is not the one that we already scanned in
// GapRootScanner().
if (stack && task != MainTask) {
if (task->copy_stack) {
// We know which part of the task stack is actually used,
// so we shorten the range we have to scan.
Expand Down

0 comments on commit b22355a

Please sign in to comment.