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