# HG changeset patch # User kbarrett # Date 1534198886 14400 # Node ID 135285dfc55145f05611727175a973e81c8dbe10 # Parent ae001a1deb74eb8da53ec362dd8ac2e5921085f7 8209396: Make PtrQueueSets not statically allocated Summary: Change the G1BarrierSet PtrQueueSet static members to ordinary members. Reviewed-by: shade, tschatzl, rkennke diff -r ae001a1deb74 -r 135285dfc551 src/hotspot/share/gc/g1/g1BarrierSet.cpp --- 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(), make_barrier_set_c1(), make_barrier_set_c2(), 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); } } diff -r ae001a1deb74 -r 135285dfc551 src/hotspot/share/gc/g1/g1BarrierSet.hpp --- 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(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.