src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp

changeset 3328
6d7d0790074d
parent 3294
bca17e38de00
child 3900
d2a62e0f25eb
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Fri Dec 09 06:46:57 2011 -0800
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Fri Dec 09 19:28:34 2011 -0800
     1.3 @@ -1,6 +1,6 @@
     1.4  
     1.5  /*
     1.6 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
     1.7 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
     1.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9   *
    1.10   * This code is free software; you can redistribute it and/or modify it
    1.11 @@ -129,6 +129,8 @@
    1.12      for (; /* break */; ) {
    1.13        // This will block until there is a task to be gotten.
    1.14        GCTask* task = manager()->get_task(which());
    1.15 +      // Record if this is an idle task for later use.
    1.16 +      bool is_idle_task = task->is_idle_task();
    1.17        // In case the update is costly
    1.18        if (PrintGCTaskTimeStamps) {
    1.19          timer.update();
    1.20 @@ -137,9 +139,13 @@
    1.21        jlong entry_time = timer.ticks();
    1.22        char* name = task->name();
    1.23  
    1.24 +      // If this is the barrier task, it can be destroyed
    1.25 +      // by the GC task manager once the do_it() executes.
    1.26        task->do_it(manager(), which());
    1.27  
    1.28 -      if (!task->is_idle_task()) {
    1.29 +      // Use the saved value of is_idle_task because references
    1.30 +      // using "task" are not reliable for the barrier task.
    1.31 +      if (!is_idle_task) {
    1.32          manager()->note_completion(which());
    1.33  
    1.34          if (PrintGCTaskTimeStamps) {

mercurial