hotspot/src/share/vm/gc/g1/g1OopClosures.hpp
changeset 33224 bc5da96c1f0e
parent 33213 b937f634f56e
child 33226 19cb9b844190
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp	Fri Oct 16 00:01:49 2015 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp	Thu Oct 15 10:10:13 2015 -0400
@@ -52,15 +52,12 @@
 protected:
   G1CollectedHeap* _g1;
   G1ParScanThreadState* _par_scan_state;
-  uint _worker_id;
+
+  G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
+  ~G1ParClosureSuper() { }
+
 public:
-  // Initializes the instance, leaving _par_scan_state uninitialized. Must be done
-  // later using the set_par_scan_thread_state() method.
-  G1ParClosureSuper(G1CollectedHeap* g1);
-  G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
-  bool apply_to_weak_ref_discovered_field() { return true; }
-
-  void set_par_scan_thread_state(G1ParScanThreadState* par_scan_state);
+  virtual bool apply_to_weak_ref_discovered_field() { return true; }
 };
 
 class G1ParPushHeapRSClosure : public G1ParClosureSuper {
@@ -76,7 +73,8 @@
 
 class G1ParScanClosure : public G1ParClosureSuper {
 public:
-  G1ParScanClosure(G1CollectedHeap* g1) : G1ParClosureSuper(g1) { }
+  G1ParScanClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
+    G1ParClosureSuper(g1, par_scan_state) { }
 
   template <class T> void do_oop_nv(T* p);
   virtual void do_oop(oop* p)          { do_oop_nv(p); }
@@ -88,6 +86,7 @@
 // Add back base class for metadata
 class G1ParCopyHelper : public G1ParClosureSuper {
 protected:
+  uint _worker_id;              // Cache value from par_scan_state.
   Klass* _scanned_klass;
   ConcurrentMark* _cm;
 
@@ -100,10 +99,11 @@
   // objects pointed to by roots that have been forwarded during a
   // GC. It is MT-safe.
   inline void mark_forwarded_object(oop from_obj, oop to_obj);
- public:
+
   G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state);
-  G1ParCopyHelper(G1CollectedHeap* g1);
+  ~G1ParCopyHelper() { }
 
+ public:
   void set_scanned_klass(Klass* k) { _scanned_klass = k; }
   template <class T> inline void do_klass_barrier(T* p, oop new_obj);
 };
@@ -130,10 +130,6 @@
     assert(_ref_processor == NULL, "sanity");
   }
 
-  G1ParCopyClosure(G1CollectedHeap* g1) : G1ParCopyHelper(g1) {
-    assert(_ref_processor == NULL, "sanity");
-  }
-
   template <class T> void do_oop_nv(T* p) { do_oop_work(p); }
   virtual void do_oop(oop* p)       { do_oop_nv(p); }
   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }