8232232: G1RemSetSummary::_rs_threads_vtimes is not initialized to zero jdk-14+19
authormanc
Mon, 14 Oct 2019 18:48:10 -0700
changeset 58652 9b67dd88a931
parent 58650 d068b1e534de
child 58653 71fef5fae9cc
8232232: G1RemSetSummary::_rs_threads_vtimes is not initialized to zero Summary: Fix error in "Concurrent refinement threads times" in GC log and cleanup. Reviewed-by: tschatzl, kbarrett
src/hotspot/share/gc/g1/g1RemSet.cpp
src/hotspot/share/gc/g1/g1RemSetSummary.cpp
src/hotspot/share/gc/g1/g1RemSetSummary.hpp
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Oct 16 16:54:56 2019 +0200
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Mon Oct 14 18:48:10 2019 -0700
@@ -487,7 +487,7 @@
                    G1CardTable* ct,
                    G1HotCardCache* hot_card_cache) :
   _scan_state(new G1RemSetScanState()),
-  _prev_period_summary(),
+  _prev_period_summary(false),
   _g1h(g1h),
   _ct(ct),
   _g1p(_g1h->policy()),
@@ -1404,7 +1404,7 @@
   if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) &&
       (period_count % G1SummarizeRSetStatsPeriod == 0)) {
 
-    G1RemSetSummary current(this);
+    G1RemSetSummary current;
     _prev_period_summary.subtract_from(&current);
 
     Log(gc, remset) log;
@@ -1421,7 +1421,7 @@
   Log(gc, remset, exit) log;
   if (log.is_trace()) {
     log.trace(" Cumulative RS summary");
-    G1RemSetSummary current(this);
+    G1RemSetSummary current;
     ResourceMark rm;
     LogStream ls(log.trace());
     current.print_on(&ls);
--- a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Wed Oct 16 16:54:56 2019 +0200
+++ b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Mon Oct 14 18:48:10 2019 -0700
@@ -81,8 +81,7 @@
   return _rs_threads_vtimes[thread];
 }
 
-G1RemSetSummary::G1RemSetSummary() :
-  _rem_set(NULL),
+G1RemSetSummary::G1RemSetSummary(bool should_update) :
   _total_mutator_refined_cards(0),
   _total_concurrent_refined_cards(0),
   _num_coarsenings(0),
@@ -91,17 +90,10 @@
   _sampling_thread_vtime(0.0f) {
 
   memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
-}
 
-G1RemSetSummary::G1RemSetSummary(G1RemSet* rem_set) :
-  _rem_set(rem_set),
-  _total_mutator_refined_cards(0),
-  _total_concurrent_refined_cards(0),
-  _num_coarsenings(0),
-  _num_vtimes(G1ConcurrentRefine::max_num_threads()),
-  _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)),
-  _sampling_thread_vtime(0.0f) {
-  update();
+  if (should_update) {
+    update();
+  }
 }
 
 G1RemSetSummary::~G1RemSetSummary() {
--- a/src/hotspot/share/gc/g1/g1RemSetSummary.hpp	Wed Oct 16 16:54:56 2019 +0200
+++ b/src/hotspot/share/gc/g1/g1RemSetSummary.hpp	Mon Oct 14 18:48:10 2019 -0700
@@ -36,8 +36,6 @@
 private:
   friend class GetRSThreadVTimeClosure;
 
-  G1RemSet* _rem_set;
-
   size_t _total_mutator_refined_cards;
   size_t _total_concurrent_refined_cards;
 
@@ -57,8 +55,7 @@
   void update();
 
 public:
-  G1RemSetSummary();
-  G1RemSetSummary(G1RemSet* remset);
+  G1RemSetSummary(bool should_update = true);
 
   ~G1RemSetSummary();