diff src/share/vm/gc_implementation/g1/g1OopClosures.hpp @ 20225:cd43876f692e

8040977: G1 crashes when run with -XX:-G1DeferredRSUpdate Summary: When G1 is run with -XX:-G1DeferredRSUpdate, the VM crashes because of wrong initialization order of member variables. The change makes the initalization explicit, not relying on initialization order any more. Reviewed-by: brutisso, mgerdin
author tschatzl
date Mon, 21 Jul 2014 09:41:06 +0200
parents 8847586c9037
children 2c6ef90f030a
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Mon Jul 21 09:41:06 2014 +0200
+++ b/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Mon Jul 21 09:41:06 2014 +0200
@@ -51,8 +51,13 @@
   G1ParScanThreadState* _par_scan_state;
   uint _worker_id;
 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);
 };
 
 class G1ParPushHeapRSClosure : public G1ParClosureSuper {
@@ -68,9 +73,8 @@
 
 class G1ParScanClosure : public G1ParClosureSuper {
 public:
-  G1ParScanClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, ReferenceProcessor* rp) :
-    G1ParClosureSuper(g1, par_scan_state)
-  {
+  G1ParScanClosure(G1CollectedHeap* g1, ReferenceProcessor* rp) :
+    G1ParClosureSuper(g1) {
     assert(_ref_processor == NULL, "sanity");
     _ref_processor = rp;
   }