< prev index next >

src/hotspot/share/gc/g1/g1BarrierSet.cpp

Print this page

        

@@ -35,29 +35,30 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/macros.hpp"
 
+SATBMarkQueueSet G1BarrierSet::_satb_mark_queue_set;
+DirtyCardQueueSet G1BarrierSet::_dirty_card_queue_set;
+
 G1BarrierSet::G1BarrierSet(G1CardTable* card_table) :
   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),
                       card_table,
-                      BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)),
-  _dcqs(JavaThread::dirty_card_queue_set())
-{ }
+                      BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)) {}
 
 void G1BarrierSet::enqueue(oop pre_val) {
   // Nulls should have been already filtered.
   assert(oopDesc::is_oop(pre_val, true), "Error");
 
-  if (!JavaThread::satb_mark_queue_set().is_active()) return;
+  if (!_satb_mark_queue_set.is_active()) return;
   Thread* thr = Thread::current();
   if (thr->is_Java_thread()) {
     JavaThread* jt = (JavaThread*)thr;
     jt->satb_mark_queue().enqueue(pre_val);
   } else {
     MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
-    JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val);
+    _satb_mark_queue_set.shared_satb_queue()->enqueue(pre_val);
   }
 }
 
 void G1BarrierSet::write_ref_array_pre_oop_entry(oop* dst, size_t length) {
   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());

@@ -74,11 +75,11 @@
   bs->G1BarrierSet::write_ref_array(dst, length);
 }
 
 template <class T> void
 G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
-  if (!JavaThread::satb_mark_queue_set().is_active()) return;
+  if (!_satb_mark_queue_set.is_active()) return;
   T* elem_ptr = dst;
   for (size_t i = 0; i < count; i++, elem_ptr++) {
     T heap_oop = RawAccess<>::oop_load(elem_ptr);
     if (!CompressedOops::is_null(heap_oop)) {
       enqueue(CompressedOops::decode_not_null(heap_oop));

@@ -109,11 +110,11 @@
       JavaThread* jt = (JavaThread*)thr;
       jt->dirty_card_queue().enqueue(byte);
     } else {
       MutexLockerEx x(Shared_DirtyCardQ_lock,
                       Mutex::_no_safepoint_check_flag);
-      _dcqs.shared_dirty_card_queue()->enqueue(byte);
+      _dirty_card_queue_set.shared_dirty_card_queue()->enqueue(byte);
     }
   }
 }
 
 void G1BarrierSet::invalidate(MemRegion mr) {

@@ -147,11 +148,11 @@
         if (*byte == G1CardTable::g1_young_card_val()) {
           continue;
         }
         if (*byte != G1CardTable::dirty_card_val()) {
           *byte = G1CardTable::dirty_card_val();
-          _dcqs.shared_dirty_card_queue()->enqueue(byte);
+          _dirty_card_queue_set.shared_dirty_card_queue()->enqueue(byte);
         }
       }
     }
   }
 }

@@ -179,11 +180,11 @@
   assert(thread->satb_mark_queue().is_empty(), "SATB queue should be empty");
   assert(thread->dirty_card_queue().is_active(), "Dirty card queue should be active");
 
   // If we are creating the thread during a marking cycle, we should
   // set the active field of the SATB queue to true.
-  if (thread->satb_mark_queue_set().is_active()) {
+  if (_satb_mark_queue_set.is_active()) {
     thread->satb_mark_queue().set_active(true);
   }
 }
 
 void G1BarrierSet::on_thread_detach(JavaThread* thread) {
< prev index next >