changeset 51390:135285dfc551

8209396: Make PtrQueueSets not statically allocated Summary: Change the G1BarrierSet PtrQueueSet static members to ordinary members. Reviewed-by: shade, tschatzl, rkennke
author kbarrett
date Mon, 13 Aug 2018 18:21:26 -0400
parents ae001a1deb74
children 07ea887eee5f
files src/hotspot/share/gc/g1/g1BarrierSet.cpp src/hotspot/share/gc/g1/g1BarrierSet.hpp
diffstat 2 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/g1/g1BarrierSet.cpp	Mon Aug 13 13:24:55 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1BarrierSet.cpp	Mon Aug 13 18:21:26 2018 -0400
@@ -48,27 +48,30 @@
 class G1BarrierSetC1;
 class G1BarrierSetC2;
 
-G1SATBMarkQueueSet G1BarrierSet::_satb_mark_queue_set;
-DirtyCardQueueSet G1BarrierSet::_dirty_card_queue_set;
-
 G1BarrierSet::G1BarrierSet(G1CardTable* card_table) :
   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),
                       make_barrier_set_c1<G1BarrierSetC1>(),
                       make_barrier_set_c2<G1BarrierSetC2>(),
                       card_table,
-                      BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)) {}
+                      BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)),
+  _satb_mark_queue_set(),
+  _dirty_card_queue_set()
+{}
 
 void G1BarrierSet::enqueue(oop pre_val) {
   // Nulls should have been already filtered.
   assert(oopDesc::is_oop(pre_val, true), "Error");
 
-  if (!_satb_mark_queue_set.is_active()) return;
+  G1SATBMarkQueueSet& queue_set = satb_mark_queue_set();
+  if (!queue_set.is_active()) {
+    return;
+  }
   Thread* thr = Thread::current();
   if (thr->is_Java_thread()) {
     G1ThreadLocalData::satb_mark_queue(thr).enqueue(pre_val);
   } else {
     MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
-    _satb_mark_queue_set.shared_satb_queue()->enqueue(pre_val);
+    queue_set.shared_satb_queue()->enqueue(pre_val);
   }
 }
 
--- a/src/hotspot/share/gc/g1/g1BarrierSet.hpp	Mon Aug 13 13:24:55 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1BarrierSet.hpp	Mon Aug 13 18:21:26 2018 -0400
@@ -39,8 +39,12 @@
 class G1BarrierSet: public CardTableBarrierSet {
   friend class VMStructs;
  private:
-  static G1SATBMarkQueueSet _satb_mark_queue_set;
-  static DirtyCardQueueSet _dirty_card_queue_set;
+  G1SATBMarkQueueSet _satb_mark_queue_set;
+  DirtyCardQueueSet _dirty_card_queue_set;
+
+  static G1BarrierSet* g1_barrier_set() {
+    return barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
+  }
 
  public:
   G1BarrierSet(G1CardTable* table);
@@ -75,12 +79,12 @@
   virtual void on_thread_attach(JavaThread* thread);
   virtual void on_thread_detach(JavaThread* thread);
 
-  static SATBMarkQueueSet& satb_mark_queue_set() {
-    return _satb_mark_queue_set;
+  static G1SATBMarkQueueSet& satb_mark_queue_set() {
+    return g1_barrier_set()->_satb_mark_queue_set;
   }
 
   static DirtyCardQueueSet& dirty_card_queue_set() {
-    return _dirty_card_queue_set;
+    return g1_barrier_set()->_dirty_card_queue_set;
   }
 
   // Callbacks for runtime accesses.