< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp

Print this page

158   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
159   _satb_mark_queue_set.flush_queue(queue);
160   if (thread->is_Java_thread()) {
161     PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
162     if (gclab != nullptr) {
163       gclab->retire();
164     }
165 
166     ShenandoahPLAB* shenandoah_plab = ShenandoahThreadLocalData::shenandoah_plab(thread);
167     if (shenandoah_plab != nullptr) {
168       shenandoah_plab->retire();
169     }
170 
171     // SATB protocol requires to keep alive reachable oops from roots at the beginning of GC
172     if (_heap->is_concurrent_mark_in_progress()) {
173       ShenandoahKeepAliveClosure oops;
174       StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
175     } else if (_heap->is_concurrent_weak_root_in_progress() && _heap->is_evacuation_in_progress()) {
176       ShenandoahContextEvacuateUpdateRootsClosure oops;
177       StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);



178     }
179   }
180 }
181 
182 void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
183   assert(ShenandoahCardBarrier, "Should have been checked by caller");
184 
185   HeapWord* end = (HeapWord*)((char*) start + (count * heapOopSize));
186   // In the case of compressed oops, start and end may potentially be misaligned;
187   // so we need to conservatively align the first downward (this is not
188   // strictly necessary for current uses, but a case of good hygiene and,
189   // if you will, aesthetics) and the second upward (this is essential for
190   // current uses) to a HeapWord boundary, so we mark all cards overlapping
191   // this write.
192   HeapWord* aligned_start = align_down(start, HeapWordSize);
193   HeapWord* aligned_end   = align_up  (end,   HeapWordSize);
194   // If compressed oops were not being used, these should already be aligned
195   assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
196          "Expected heap word alignment of start and end");
197   _heap->old_generation()->card_scan()->mark_range_as_dirty(aligned_start, (aligned_end - aligned_start));

158   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
159   _satb_mark_queue_set.flush_queue(queue);
160   if (thread->is_Java_thread()) {
161     PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
162     if (gclab != nullptr) {
163       gclab->retire();
164     }
165 
166     ShenandoahPLAB* shenandoah_plab = ShenandoahThreadLocalData::shenandoah_plab(thread);
167     if (shenandoah_plab != nullptr) {
168       shenandoah_plab->retire();
169     }
170 
171     // SATB protocol requires to keep alive reachable oops from roots at the beginning of GC
172     if (_heap->is_concurrent_mark_in_progress()) {
173       ShenandoahKeepAliveClosure oops;
174       StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
175     } else if (_heap->is_concurrent_weak_root_in_progress() && _heap->is_evacuation_in_progress()) {
176       ShenandoahContextEvacuateUpdateRootsClosure oops;
177       StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
178     } else {
179       ShenandoahNoOpClosure oops;
180       StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
181     }
182   }
183 }
184 
185 void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
186   assert(ShenandoahCardBarrier, "Should have been checked by caller");
187 
188   HeapWord* end = (HeapWord*)((char*) start + (count * heapOopSize));
189   // In the case of compressed oops, start and end may potentially be misaligned;
190   // so we need to conservatively align the first downward (this is not
191   // strictly necessary for current uses, but a case of good hygiene and,
192   // if you will, aesthetics) and the second upward (this is essential for
193   // current uses) to a HeapWord boundary, so we mark all cards overlapping
194   // this write.
195   HeapWord* aligned_start = align_down(start, HeapWordSize);
196   HeapWord* aligned_end   = align_up  (end,   HeapWordSize);
197   // If compressed oops were not being used, these should already be aligned
198   assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
199          "Expected heap word alignment of start and end");
200   _heap->old_generation()->card_scan()->mark_range_as_dirty(aligned_start, (aligned_end - aligned_start));
< prev index next >