8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY
authortschatzl
Fri, 18 Dec 2015 14:27:51 +0100
changeset 35190 8a4918d9f9ae
parent 35189 a69874af6697
child 35191 da47979837b4
8145673: G1RemSetSummary.hpp uses FREE_C_HEAP_ARRAY Summary: Move destructor work into cpp file Reviewed-by: mgerdin, stefank
hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp
hotspot/src/share/vm/gc/g1/g1RemSetSummary.hpp
--- a/hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp	Fri Dec 18 11:30:29 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp	Fri Dec 18 14:27:51 2015 +0100
@@ -30,6 +30,7 @@
 #include "gc/g1/g1RemSetSummary.hpp"
 #include "gc/g1/heapRegion.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
+#include "memory/allocation.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
 class GetRSThreadVTimeClosure : public ThreadClosure {
@@ -89,6 +90,23 @@
   update();
 }
 
+G1RemSetSummary::G1RemSetSummary() :
+  _remset(NULL),
+  _num_refined_cards(0),
+  _num_processed_buf_mutator(0),
+  _num_processed_buf_rs_threads(0),
+  _num_coarsenings(0),
+  _rs_threads_vtimes(NULL),
+  _num_vtimes(0),
+  _sampling_thread_vtime(0.0f) {
+}
+
+G1RemSetSummary::~G1RemSetSummary() {
+  if (_rs_threads_vtimes) {
+    FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
+  }
+}
+
 void G1RemSetSummary::set(G1RemSetSummary* other) {
   assert(other != NULL, "just checking");
   assert(remset() == other->remset(), "just checking");
--- a/hotspot/src/share/vm/gc/g1/g1RemSetSummary.hpp	Fri Dec 18 11:30:29 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSetSummary.hpp	Fri Dec 18 14:27:51 2015 +0100
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_G1_G1REMSETSUMMARY_HPP
 #define SHARE_VM_GC_G1_G1REMSETSUMMARY_HPP
 
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/ostream.hpp"
 
 class G1RemSet;
@@ -57,26 +58,12 @@
     _sampling_thread_vtime = value;
   }
 
-  void free_and_null() {
-    if (_rs_threads_vtimes) {
-      FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
-      _rs_threads_vtimes = NULL;
-      _num_vtimes = 0;
-    }
-  }
-
   // update this summary with current data from various places
   void update();
 
 public:
-  G1RemSetSummary() : _remset(NULL), _num_refined_cards(0),
-    _num_processed_buf_mutator(0), _num_processed_buf_rs_threads(0), _num_coarsenings(0),
-    _rs_threads_vtimes(NULL), _num_vtimes(0), _sampling_thread_vtime(0.0f) {
-  }
-
-  ~G1RemSetSummary() {
-    free_and_null();
-  }
+  G1RemSetSummary();
+  ~G1RemSetSummary();
 
   // set the counters in this summary to the values of the others
   void set(G1RemSetSummary* other);