hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp
author ehelin
Wed, 02 Jul 2014 11:05:10 +0200
changeset 25366 8b8061f353ee
parent 25350 6423a57e5451
child 25490 59f226da8d81
permissions -rw-r--r--
8048895: Back out JDK-8027915 Reviewed-by: mgerdin, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 24092
diff changeset
     2
 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5076
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5076
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5076
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    26
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    27
#include "code/codeCache.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    28
#include "gc_implementation/parallelScavenge/pcTasks.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    29
#include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
    30
#include "gc_implementation/shared/gcTimer.hpp"
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
    31
#include "gc_implementation/shared/gcTraceTime.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    32
#include "gc_interface/collectedHeap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    33
#include "memory/universe.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    34
#include "oops/objArrayKlass.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    35
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    36
#include "oops/oop.pcgc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    37
#include "prims/jvmtiExport.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    38
#include "runtime/fprofiler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    39
#include "runtime/jniHandles.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    40
#include "runtime/thread.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    41
#include "runtime/vmThread.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6762
diff changeset
    42
#include "services/management.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 24092
diff changeset
    44
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 24092
diff changeset
    45
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// ThreadRootsMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  assert(Universe::heap()->is_gc_active(), "called outside gc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
    55
  NOT_PRODUCT(GCTraceTime tm("ThreadRootsMarkingTask",
25350
6423a57e5451 8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents: 24424
diff changeset
    56
    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  ParCompactionManager* cm =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    ParCompactionManager::gc_thread_compaction_manager(which);
14582
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    59
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
14582
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    61
  CLDToOopClosure mark_and_push_from_clds(&mark_and_push_closure, true);
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1407
diff changeset
    62
  CodeBlobToOopClosure mark_and_push_in_blobs(&mark_and_push_closure, /*do_marking=*/ true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  if (_java_thread != NULL)
14582
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    65
    _java_thread->oops_do(
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    66
        &mark_and_push_closure,
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    67
        &mark_and_push_from_clds,
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    68
        &mark_and_push_in_blobs);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  if (_vm_thread != NULL)
14582
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    71
    _vm_thread->oops_do(
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    72
        &mark_and_push_closure,
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    73
        &mark_and_push_from_clds,
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
    74
        &mark_and_push_in_blobs);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  // Do the real work
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
    77
  cm->follow_marking_stacks();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  assert(Universe::heap()->is_gc_active(), "called outside gc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
    84
  NOT_PRODUCT(GCTraceTime tm("MarkFromRootsTask",
25350
6423a57e5451 8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents: 24424
diff changeset
    85
    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  ParCompactionManager* cm =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    ParCompactionManager::gc_thread_compaction_manager(which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11174
diff changeset
    89
  PSParallelCompact::FollowKlassClosure follow_klass_closure(&mark_and_push_closure);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  switch (_root_type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    case universe:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
      Universe::oops_do(&mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    case jni_handles:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      JNIHandles::oops_do(&mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    case threads:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
      ResourceMark rm;
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1407
diff changeset
   103
      CodeBlobToOopClosure each_active_code_blob(&mark_and_push_closure, /*do_marking=*/ true);
14582
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
   104
      CLDToOopClosure mark_and_push_from_cld(&mark_and_push_closure);
490bb6c0df7c 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents: 13952
diff changeset
   105
      Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    case object_synchronizer:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      ObjectSynchronizer::oops_do(&mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    case flat_profiler:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
      FlatProfiler::oops_do(&mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    case management:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
      Management::oops_do(&mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    case jvmti:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
      JvmtiExport::oops_do(&mark_and_push_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    case system_dictionary:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      SystemDictionary::always_strong_oops_do(&mark_and_push_closure);
17844
28ca9179db98 8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents: 17370
diff changeset
   127
      break;
28ca9179db98 8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents: 17370
diff changeset
   128
28ca9179db98 8015268: NPG: 2.5% regression in young GC times on CRM Sales Opty
stefank
parents: 17370
diff changeset
   129
    case class_loader_data:
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11174
diff changeset
   130
      ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, &follow_klass_closure, true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
3908
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1407
diff changeset
   133
    case code_cache:
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1407
diff changeset
   134
      // Do not treat nmethods as strong roots for mark/sweep, since we can unload them.
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1407
diff changeset
   135
      //CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(&mark_and_push_closure));
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1407
diff changeset
   136
      break;
24b55ad4c228 6863023: need non-perm oops in code cache for JSR 292
jrose
parents: 1407
diff changeset
   137
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
      fatal("Unknown root type");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  // Do the real work
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   143
  cm->follow_marking_stacks();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
// RefProcTaskProxy
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
void RefProcTaskProxy::do_it(GCTaskManager* manager, uint which)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  assert(Universe::heap()->is_gc_active(), "called outside gc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
   155
  NOT_PRODUCT(GCTraceTime tm("RefProcTask",
25350
6423a57e5451 8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents: 24424
diff changeset
   156
    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  ParCompactionManager* cm =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    ParCompactionManager::gc_thread_compaction_manager(which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  PSParallelCompact::FollowStackClosure follow_stack_closure(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  _rp_task.work(_work_id, *PSParallelCompact::is_alive_closure(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
                mark_and_push_closure, follow_stack_closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
// RefProcTaskExecutor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
void RefProcTaskExecutor::execute(ProcessTask& task)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  ParallelScavengeHeap* heap = PSParallelCompact::gc_heap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  uint parallel_gc_threads = heap->gc_task_manager()->workers();
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   173
  uint active_gc_threads = heap->gc_task_manager()->active_workers();
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   174
  RegionTaskQueueSet* qset = ParCompactionManager::region_array();
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   175
  ParallelTaskTerminator terminator(active_gc_threads, qset);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  GCTaskQueue* q = GCTaskQueue::create();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  for(uint i=0; i<parallel_gc_threads; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    q->enqueue(new RefProcTaskProxy(task, i));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  if (task.marks_oops_alive()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    if (parallel_gc_threads>1) {
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   182
      for (uint j=0; j<active_gc_threads; j++) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
        q->enqueue(new StealMarkingTask(&terminator));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  PSParallelCompact::gc_task_manager()->execute_and_wait(q);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
void RefProcTaskExecutor::execute(EnqueueTask& task)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
{
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  ParallelScavengeHeap* heap = PSParallelCompact::gc_heap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  uint parallel_gc_threads = heap->gc_task_manager()->workers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  GCTaskQueue* q = GCTaskQueue::create();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  for(uint i=0; i<parallel_gc_threads; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    q->enqueue(new RefEnqueueTaskProxy(task, i));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  PSParallelCompact::gc_task_manager()->execute_and_wait(q);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
// StealMarkingTask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
StealMarkingTask::StealMarkingTask(ParallelTaskTerminator* t) :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  _terminator(t) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
void StealMarkingTask::do_it(GCTaskManager* manager, uint which) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  assert(Universe::heap()->is_gc_active(), "called outside gc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
   211
  NOT_PRODUCT(GCTraceTime tm("StealMarkingTask",
25350
6423a57e5451 8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents: 24424
diff changeset
   212
    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  ParCompactionManager* cm =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    ParCompactionManager::gc_thread_compaction_manager(which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  oop obj = NULL;
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   219
  ObjArrayTask task;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  int random_seed = 17;
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   221
  do {
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   222
    while (ParCompactionManager::steal_objarray(which, &random_seed, task)) {
17370
59a0620561fa 8003557: NPG: Klass* const k should be const Klass* k.
minqi
parents: 14582
diff changeset
   223
      ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass();
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   224
      k->oop_follow_contents(cm, task.obj(), task.index());
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   225
      cm->follow_marking_stacks();
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   226
    }
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   227
    while (ParCompactionManager::steal(which, &random_seed, obj)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
      obj->follow_contents(cm);
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   229
      cm->follow_marking_stacks();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    }
5076
8b74a4b60b31 4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents: 3919
diff changeset
   231
  } while (!terminator()->offer_termination());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
//
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   235
// StealRegionCompactionTask
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   238
StealRegionCompactionTask::StealRegionCompactionTask(ParallelTaskTerminator* t):
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   239
  _terminator(t) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   241
void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  assert(Universe::heap()->is_gc_active(), "called outside gc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
   244
  NOT_PRODUCT(GCTraceTime tm("StealRegionCompactionTask",
25350
6423a57e5451 8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents: 24424
diff changeset
   245
    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  ParCompactionManager* cm =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    ParCompactionManager::gc_thread_compaction_manager(which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   250
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   251
  // If not all threads are active, get a draining stack
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   252
  // from the list.  Else, just use this threads draining stack.
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   253
  uint which_stack_index;
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   254
  bool use_all_workers = manager->all_workers_active();
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   255
  if (use_all_workers) {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   256
    which_stack_index = which;
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   257
    assert(manager->active_workers() == ParallelGCThreads,
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   258
           err_msg("all_workers_active has been incorrectly set: "
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   259
                   " active %d  ParallelGCThreads %d", manager->active_workers(),
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   260
                   ParallelGCThreads));
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   261
  } else {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   262
    which_stack_index = ParCompactionManager::pop_recycled_stack_index();
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   263
  }
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   264
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   265
  cm->set_region_stack_index(which_stack_index);
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   266
  cm->set_region_stack(ParCompactionManager::region_list(which_stack_index));
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   267
  if (TraceDynamicGCThreads) {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   268
    gclog_or_tty->print_cr("StealRegionCompactionTask::do_it "
24092
e274d864545a 8039743: Use correct format specifier to print size_t values and pointers in the GC code
stefank
parents: 18025
diff changeset
   269
                           "region_stack_index %d region_stack = " PTR_FORMAT " "
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   270
                           " empty (%d) use all workers %d",
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   271
    which_stack_index, ParCompactionManager::region_list(which_stack_index),
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   272
    cm->region_stack()->is_empty(),
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   273
    use_all_workers);
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   274
  }
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   275
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   276
  // Has to drain stacks first because there may be regions on
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  // preloaded onto the stack and this thread may never have
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  // done a draining task.  Are the draining tasks needed?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   280
  cm->drain_region_stacks();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   282
  size_t region_index = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  int random_seed = 17;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  // If we're the termination task, try 10 rounds of stealing before
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  // setting the termination flag
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  while(true) {
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   289
    if (ParCompactionManager::steal(which, &random_seed, region_index)) {
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   290
      PSParallelCompact::fill_and_update_region(cm, region_index);
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   291
      cm->drain_region_stacks();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
      if (terminator()->offer_termination()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
      // Go around again.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
UpdateDensePrefixTask::UpdateDensePrefixTask(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
                                   PSParallelCompact::SpaceId space_id,
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   304
                                   size_t region_index_start,
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   305
                                   size_t region_index_end) :
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   306
  _space_id(space_id), _region_index_start(region_index_start),
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   307
  _region_index_end(region_index_end) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
   311
  NOT_PRODUCT(GCTraceTime tm("UpdateDensePrefixTask",
25350
6423a57e5451 8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents: 24424
diff changeset
   312
    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  ParCompactionManager* cm =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
    ParCompactionManager::gc_thread_compaction_manager(which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  PSParallelCompact::update_and_deadwood_in_dense_prefix(cm,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
                                                         _space_id,
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   319
                                                         _region_index_start,
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   320
                                                         _region_index_end);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  assert(Universe::heap()->is_gc_active(), "called outside gc");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17844
diff changeset
   326
  NOT_PRODUCT(GCTraceTime tm("DrainStacksCompactionTask",
25350
6423a57e5451 8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents: 24424
diff changeset
   327
    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  ParCompactionManager* cm =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
    ParCompactionManager::gc_thread_compaction_manager(which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   332
  uint which_stack_index;
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   333
  bool use_all_workers = manager->all_workers_active();
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   334
  if (use_all_workers) {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   335
    which_stack_index = which;
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   336
    assert(manager->active_workers() == ParallelGCThreads,
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   337
           err_msg("all_workers_active has been incorrectly set: "
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   338
                   " active %d  ParallelGCThreads %d", manager->active_workers(),
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   339
                   ParallelGCThreads));
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   340
  } else {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   341
    which_stack_index = stack_index();
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   342
  }
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   343
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   344
  cm->set_region_stack(ParCompactionManager::region_list(which_stack_index));
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   345
  if (TraceDynamicGCThreads) {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   346
    gclog_or_tty->print_cr("DrainStacksCompactionTask::do_it which = %d "
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   347
                           "which_stack_index = %d/empty(%d) "
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   348
                           "use all workers %d",
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   349
                           which, which_stack_index,
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   350
                           cm->region_stack()->is_empty(),
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   351
                           use_all_workers);
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   352
  }
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   353
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   354
  cm->set_region_stack_index(which_stack_index);
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   355
1407
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   356
  // Process any regions already in the compaction managers stacks.
9006b01ba3fd 6725697: par compact - rename class ChunkData to RegionData
jcoomes
parents: 670
diff changeset
   357
  cm->drain_region_stacks();
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   358
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   359
  assert(cm->region_stack()->is_empty(), "Not empty");
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   360
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   361
  if (!use_all_workers) {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   362
    // Always give up the region stack.
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   363
    assert(cm->region_stack() ==
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   364
           ParCompactionManager::region_list(cm->region_stack_index()),
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   365
           "region_stack and region_stack_index are inconsistent");
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   366
    ParCompactionManager::push_recycled_stack_index(cm->region_stack_index());
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   367
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   368
    if (TraceDynamicGCThreads) {
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   369
      void* old_region_stack = (void*) cm->region_stack();
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   370
      int old_region_stack_index = cm->region_stack_index();
24092
e274d864545a 8039743: Use correct format specifier to print size_t values and pointers in the GC code
stefank
parents: 18025
diff changeset
   371
      gclog_or_tty->print_cr("Pushing region stack " PTR_FORMAT "/%d",
11174
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   372
        old_region_stack, old_region_stack_index);
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   373
    }
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   374
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   375
    cm->set_region_stack(NULL);
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   376
    cm->set_region_stack_index((uint)max_uintx);
fccee5238e70 6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents: 10524
diff changeset
   377
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
}