8080877: Don't use workers()->total_workers() when walking G1CollectedHeap::_task_queues
authorstefank
Fri, 22 May 2015 13:35:29 +0200
changeset 30878 f1702744b3a4
parent 30876 44a71334fd94
child 30879 31b89265eed8
8080877: Don't use workers()->total_workers() when walking G1CollectedHeap::_task_queues Reviewed-by: jmasa, drwhite
hotspot/src/share/vm/gc/cms/cmsOopClosures.hpp
hotspot/src/share/vm/gc/cms/parOopClosures.hpp
hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp
hotspot/src/share/vm/gc/shared/genOopClosures.hpp
hotspot/src/share/vm/gc/shared/taskqueue.hpp
--- a/hotspot/src/share/vm/gc/cms/cmsOopClosures.hpp	Fri May 22 10:58:16 2015 +0200
+++ b/hotspot/src/share/vm/gc/cms/cmsOopClosures.hpp	Fri May 22 13:35:29 2015 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_CMS_CMSOOPCLOSURES_HPP
 
 #include "gc/shared/genOopClosures.hpp"
+#include "gc/shared/taskqueue.hpp"
 #include "memory/iterator.hpp"
 
 /////////////////////////////////////////////////////////////////
--- a/hotspot/src/share/vm/gc/cms/parOopClosures.hpp	Fri May 22 10:58:16 2015 +0200
+++ b/hotspot/src/share/vm/gc/cms/parOopClosures.hpp	Fri May 22 13:35:29 2015 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_CMS_PAROOPCLOSURES_HPP
 
 #include "gc/shared/genOopClosures.hpp"
+#include "gc/shared/taskqueue.hpp"
 #include "memory/padded.hpp"
 
 // Closures for ParNewGeneration
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri May 22 10:58:16 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri May 22 13:35:29 2015 +0200
@@ -3545,6 +3545,10 @@
 };
 #endif // ASSERT
 
+uint G1CollectedHeap::num_task_queues() const {
+  return _task_queues->size();
+}
+
 #if TASKQUEUE_STATS
 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
   st->print_raw_cr("GC Task Stats");
@@ -3556,7 +3560,7 @@
   print_taskqueue_stats_hdr(st);
 
   TaskQueueStats totals;
-  const uint n = workers()->total_workers();
+  const uint n = num_task_queues();
   for (uint i = 0; i < n; ++i) {
     st->print("%3u ", i); task_queue(i)->stats.print(st); st->cr();
     totals += task_queue(i)->stats;
@@ -3567,7 +3571,7 @@
 }
 
 void G1CollectedHeap::reset_taskqueue_stats() {
-  const uint n = workers()->total_workers();
+  const uint n = num_task_queues();
   for (uint i = 0; i < n; ++i) {
     task_queue(i)->stats.reset();
   }
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Fri May 22 10:58:16 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Fri May 22 13:35:29 2015 +0200
@@ -981,6 +981,8 @@
 
   RefToScanQueue *task_queue(uint i) const;
 
+  uint num_task_queues() const;
+
   // A set of cards where updates happened during the GC
   DirtyCardQueueSet& dirty_card_queue_set() { return _dirty_card_queue_set; }
 
--- a/hotspot/src/share/vm/gc/shared/genOopClosures.hpp	Fri May 22 10:58:16 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/genOopClosures.hpp	Fri May 22 13:35:29 2015 +0200
@@ -35,11 +35,6 @@
 class DefNewGeneration;
 class KlassRemSet;
 
-template<class E, MEMFLAGS F, unsigned int N> class GenericTaskQueue;
-typedef GenericTaskQueue<oop, mtGC, TASKQUEUE_SIZE> OopTaskQueue;
-template<class T, MEMFLAGS F> class GenericTaskQueueSet;
-typedef GenericTaskQueueSet<OopTaskQueue, mtGC> OopTaskQueueSet;
-
 // Closure for iterating roots from a particular generation
 // Note: all classes deriving from this MUST call this do_barrier
 // method at the end of their own do_oop method!
--- a/hotspot/src/share/vm/gc/shared/taskqueue.hpp	Fri May 22 10:58:16 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.hpp	Fri May 22 13:35:29 2015 +0200
@@ -382,6 +382,8 @@
   bool steal(uint queue_num, int* seed, E& t);
 
   bool peek();
+
+  uint size() const { return _n; }
 };
 
 template<class T, MEMFLAGS F> void