< prev index next >

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

Print this page

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



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

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