8204618: The parallel GC reference processing task executor enqueues a wrong number of tasks into the queue
authortschatzl
Mon, 11 Jun 2018 12:09:59 +0200
changeset 50501 3787e9158925
parent 50500 ade54c345982
child 50502 9c361050293f
8204618: The parallel GC reference processing task executor enqueues a wrong number of tasks into the queue Reviewed-by: sangheki, kbarrett
src/hotspot/share/gc/parallel/pcTasks.cpp
--- a/src/hotspot/share/gc/parallel/pcTasks.cpp	Mon Jun 11 12:09:57 2018 +0200
+++ b/src/hotspot/share/gc/parallel/pcTasks.cpp	Mon Jun 11 12:09:59 2018 +0200
@@ -149,19 +149,16 @@
 void RefProcTaskExecutor::execute(ProcessTask& task)
 {
   ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
-  uint parallel_gc_threads = heap->gc_task_manager()->workers();
   uint active_gc_threads = heap->gc_task_manager()->active_workers();
   OopTaskQueueSet* qset = ParCompactionManager::stack_array();
   ParallelTaskTerminator terminator(active_gc_threads, qset);
   GCTaskQueue* q = GCTaskQueue::create();
-  for(uint i=0; i<parallel_gc_threads; i++) {
+  for(uint i=0; i<active_gc_threads; i++) {
     q->enqueue(new RefProcTaskProxy(task, i));
   }
-  if (task.marks_oops_alive()) {
-    if (parallel_gc_threads>1) {
-      for (uint j=0; j<active_gc_threads; j++) {
-        q->enqueue(new StealMarkingTask(&terminator));
-      }
+  if (task.marks_oops_alive() && (active_gc_threads>1)) {
+    for (uint j=0; j<active_gc_threads; j++) {
+      q->enqueue(new StealMarkingTask(&terminator));
     }
   }
   PSParallelCompact::gc_task_manager()->execute_and_wait(q);