< prev index next >

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

Print this page

 82 #endif
 83   G1ThreadLocalData::set_byte_map_base(thread, card_table()->byte_map_base());
 84 }
 85 
 86 template <class T> void
 87 G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
 88   G1SATBMarkQueueSet& queue_set = G1BarrierSet::satb_mark_queue_set();
 89   if (!queue_set.is_active()) return;
 90 
 91   SATBMarkQueue& queue = G1ThreadLocalData::satb_mark_queue(Thread::current());
 92 
 93   T* elem_ptr = dst;
 94   for (size_t i = 0; i < count; i++, elem_ptr++) {
 95     T heap_oop = RawAccess<>::oop_load(elem_ptr);
 96     if (!CompressedOops::is_null(heap_oop)) {
 97       queue_set.enqueue_known_active(queue, CompressedOops::decode_not_null(heap_oop));
 98     }
 99   }
100 }
101 
102 void G1BarrierSet::write_ref_array_pre(oop* dst, size_t count, bool dest_uninitialized) {
103   if (!dest_uninitialized) {
104     write_ref_array_pre_work(dst, count);
105   }
106 }
107 
108 void G1BarrierSet::write_ref_array_pre(narrowOop* dst, size_t count, bool dest_uninitialized) {
109   if (!dest_uninitialized) {
110     write_ref_array_pre_work(dst, count);
111   }
112 }
113 
114 void G1BarrierSet::write_region(MemRegion mr) {
115   if (mr.is_empty()) {
116     return;
117   }
118 
119   // Skip writes to young gen.
120   if (G1CollectedHeap::heap()->heap_region_containing(mr.start())->is_young()) {
121     // MemRegion should not span multiple regions for arrays in young gen.
122     DEBUG_ONLY(G1HeapRegion* containing_hr = G1CollectedHeap::heap()->heap_region_containing(mr.start());)
123     assert(containing_hr->is_young(), "it should be young");
124     assert(containing_hr->is_in(mr.start()), "it should contain start");
125     assert(containing_hr->is_in(mr.last()), "it should also contain last");
126     return;
127   }
128 
129   // We need to make sure that we get the start/end byte information for the area
130   // to mark from the same card table to avoid getting confused in the mark loop
131   // further below - we might execute while the global card table is being switched.

 82 #endif
 83   G1ThreadLocalData::set_byte_map_base(thread, card_table()->byte_map_base());
 84 }
 85 
 86 template <class T> void
 87 G1BarrierSet::write_ref_array_pre_work(T* dst, size_t count) {
 88   G1SATBMarkQueueSet& queue_set = G1BarrierSet::satb_mark_queue_set();
 89   if (!queue_set.is_active()) return;
 90 
 91   SATBMarkQueue& queue = G1ThreadLocalData::satb_mark_queue(Thread::current());
 92 
 93   T* elem_ptr = dst;
 94   for (size_t i = 0; i < count; i++, elem_ptr++) {
 95     T heap_oop = RawAccess<>::oop_load(elem_ptr);
 96     if (!CompressedOops::is_null(heap_oop)) {
 97       queue_set.enqueue_known_active(queue, CompressedOops::decode_not_null(heap_oop));
 98     }
 99   }
100 }
101 
102 void G1BarrierSet::write_ref_array_pre(oop* dst, size_t count) {
103   write_ref_array_pre_work(dst, count);


104 }
105 
106 void G1BarrierSet::write_ref_array_pre(narrowOop* dst, size_t count) {
107   write_ref_array_pre_work(dst, count);


108 }
109 
110 void G1BarrierSet::write_region(MemRegion mr) {
111   if (mr.is_empty()) {
112     return;
113   }
114 
115   // Skip writes to young gen.
116   if (G1CollectedHeap::heap()->heap_region_containing(mr.start())->is_young()) {
117     // MemRegion should not span multiple regions for arrays in young gen.
118     DEBUG_ONLY(G1HeapRegion* containing_hr = G1CollectedHeap::heap()->heap_region_containing(mr.start());)
119     assert(containing_hr->is_young(), "it should be young");
120     assert(containing_hr->is_in(mr.start()), "it should contain start");
121     assert(containing_hr->is_in(mr.last()), "it should also contain last");
122     return;
123   }
124 
125   // We need to make sure that we get the start/end byte information for the area
126   // to mark from the same card table to avoid getting confused in the mark loop
127   // further below - we might execute while the global card table is being switched.
< prev index next >