< prev index next >

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

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1BarrierSet.inline.hpp"
  27 #include "gc/g1/g1BarrierSetAssembler.hpp"
  28 #include "gc/g1/g1CardTable.inline.hpp"
  29 #include "gc/g1/g1CollectedHeap.inline.hpp"
  30 #include "gc/g1/heapRegion.hpp"
  31 #include "gc/g1/satbMarkQueue.hpp"
  32 #include "logging/log.hpp"


  33 #include "oops/oop.inline.hpp"
  34 #include "runtime/mutexLocker.hpp"
  35 #include "runtime/thread.inline.hpp"
  36 #include "utilities/macros.hpp"
  37 
  38 G1BarrierSet::G1BarrierSet(G1CardTable* card_table) :
  39   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),
  40                       card_table,
  41                       BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)),
  42   _dcqs(JavaThread::dirty_card_queue_set())
  43 { }
  44 
  45 void G1BarrierSet::enqueue(oop pre_val) {
  46   // Nulls should have been already filtered.
  47   assert(oopDesc::is_oop(pre_val, true), "Error");
  48 
  49   if (!JavaThread::satb_mark_queue_set().is_active()) return;
  50   Thread* thr = Thread::current();
  51   if (thr->is_Java_thread()) {
  52     JavaThread* jt = (JavaThread*)thr;


  60 void G1BarrierSet::write_ref_array_pre_oop_entry(oop* dst, size_t length) {
  61   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
  62   bs->write_ref_array_pre(dst, length, false);
  63 }
  64 
  65 void G1BarrierSet::write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length) {
  66   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
  67   bs->write_ref_array_pre(dst, length, false);
  68 }
  69 
  70 void G1BarrierSet::write_ref_array_post_entry(HeapWord* dst, size_t length) {
  71   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
  72   bs->G1BarrierSet::write_ref_array(dst, length);
  73 }
  74 
  75 template <class T> void
  76 G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
  77   if (!JavaThread::satb_mark_queue_set().is_active()) return;
  78   T* elem_ptr = dst;
  79   for (size_t i = 0; i < count; i++, elem_ptr++) {
  80     T heap_oop = oopDesc::load_heap_oop(elem_ptr);
  81     if (!oopDesc::is_null(heap_oop)) {
  82       enqueue(oopDesc::decode_heap_oop_not_null(heap_oop));
  83     }
  84   }
  85 }
  86 
  87 void G1BarrierSet::write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized) {
  88   if (!dest_uninitialized) {
  89     write_ref_array_pre_work(dst, count);
  90   }
  91 }
  92 
  93 void G1BarrierSet::write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized) {
  94   if (!dest_uninitialized) {
  95     write_ref_array_pre_work(dst, count);
  96   }
  97 }
  98 
  99 void G1BarrierSet::write_ref_field_post_slow(volatile jbyte* byte) {
 100   // In the slow path, we know a card is not young
 101   assert(*byte != G1CardTable::g1_young_card_val(), "slow path invoked without filtering");
 102   OrderAccess::storeload();




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1BarrierSet.inline.hpp"
  27 #include "gc/g1/g1BarrierSetAssembler.hpp"
  28 #include "gc/g1/g1CardTable.inline.hpp"
  29 #include "gc/g1/g1CollectedHeap.inline.hpp"
  30 #include "gc/g1/heapRegion.hpp"
  31 #include "gc/g1/satbMarkQueue.hpp"
  32 #include "logging/log.hpp"
  33 #include "oops/access.inline.hpp"
  34 #include "oops/compressedOops.inline.hpp"
  35 #include "oops/oop.inline.hpp"
  36 #include "runtime/mutexLocker.hpp"
  37 #include "runtime/thread.inline.hpp"
  38 #include "utilities/macros.hpp"
  39 
  40 G1BarrierSet::G1BarrierSet(G1CardTable* card_table) :
  41   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),
  42                       card_table,
  43                       BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)),
  44   _dcqs(JavaThread::dirty_card_queue_set())
  45 { }
  46 
  47 void G1BarrierSet::enqueue(oop pre_val) {
  48   // Nulls should have been already filtered.
  49   assert(oopDesc::is_oop(pre_val, true), "Error");
  50 
  51   if (!JavaThread::satb_mark_queue_set().is_active()) return;
  52   Thread* thr = Thread::current();
  53   if (thr->is_Java_thread()) {
  54     JavaThread* jt = (JavaThread*)thr;


  62 void G1BarrierSet::write_ref_array_pre_oop_entry(oop* dst, size_t length) {
  63   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
  64   bs->write_ref_array_pre(dst, length, false);
  65 }
  66 
  67 void G1BarrierSet::write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length) {
  68   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
  69   bs->write_ref_array_pre(dst, length, false);
  70 }
  71 
  72 void G1BarrierSet::write_ref_array_post_entry(HeapWord* dst, size_t length) {
  73   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
  74   bs->G1BarrierSet::write_ref_array(dst, length);
  75 }
  76 
  77 template <class T> void
  78 G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
  79   if (!JavaThread::satb_mark_queue_set().is_active()) return;
  80   T* elem_ptr = dst;
  81   for (size_t i = 0; i < count; i++, elem_ptr++) {
  82     T heap_oop = RawAccess<>::oop_load(elem_ptr);
  83     if (!CompressedOops::is_null(heap_oop)) {
  84       enqueue(CompressedOops::decode_not_null(heap_oop));
  85     }
  86   }
  87 }
  88 
  89 void G1BarrierSet::write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized) {
  90   if (!dest_uninitialized) {
  91     write_ref_array_pre_work(dst, count);
  92   }
  93 }
  94 
  95 void G1BarrierSet::write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized) {
  96   if (!dest_uninitialized) {
  97     write_ref_array_pre_work(dst, count);
  98   }
  99 }
 100 
 101 void G1BarrierSet::write_ref_field_post_slow(volatile jbyte* byte) {
 102   // In the slow path, we know a card is not young
 103   assert(*byte != G1CardTable::g1_young_card_val(), "slow path invoked without filtering");
 104   OrderAccess::storeload();


< prev index next >