1188 // There are two reasons to retire all plabs between old-gen evacuation passes.
1189 // 1. We need to make the plab memory parsable by remembered-set scanning.
1190 // 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region
1191 ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread);
1192
1193 // Re-enable promotions for the next evacuation phase.
1194 ShenandoahThreadLocalData::enable_plab_promotions(thread);
1195
1196 // Reset the fill size for next evacuation phase.
1197 if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) {
1198 ShenandoahThreadLocalData::set_plab_size(thread, 0);
1199 }
1200 }
1201 }
1202 };
1203
1204 class ShenandoahGCStatePropagatorHandshakeClosure : public HandshakeClosure {
1205 public:
1206 explicit ShenandoahGCStatePropagatorHandshakeClosure(char gc_state) :
1207 HandshakeClosure("Shenandoah GC State Change"),
1208 _gc_state(gc_state) {}
1209
1210 void do_thread(Thread* thread) override {
1211 ShenandoahThreadLocalData::set_gc_state(thread, _gc_state);
1212 }
1213 private:
1214 char _gc_state;
1215 };
1216
1217 class ShenandoahPrepareForUpdateRefsHandshakeClosure : public HandshakeClosure {
1218 public:
1219 explicit ShenandoahPrepareForUpdateRefsHandshakeClosure(char gc_state) :
1220 HandshakeClosure("Shenandoah Prepare for Update Refs"),
1221 _retire(ResizeTLAB), _propagator(gc_state) {}
1222
1223 void do_thread(Thread* thread) override {
1224 _propagator.do_thread(thread);
1225 if (ShenandoahThreadLocalData::gclab(thread) != nullptr) {
1226 _retire.do_thread(thread);
1227 }
1228 }
1229 private:
1230 ShenandoahRetireGCLABClosure _retire;
1231 ShenandoahGCStatePropagatorHandshakeClosure _propagator;
1232 };
1233
1234 void ShenandoahHeap::evacuate_collection_set(ShenandoahGeneration* generation, bool concurrent) {
|
1188 // There are two reasons to retire all plabs between old-gen evacuation passes.
1189 // 1. We need to make the plab memory parsable by remembered-set scanning.
1190 // 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region
1191 ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread);
1192
1193 // Re-enable promotions for the next evacuation phase.
1194 ShenandoahThreadLocalData::enable_plab_promotions(thread);
1195
1196 // Reset the fill size for next evacuation phase.
1197 if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) {
1198 ShenandoahThreadLocalData::set_plab_size(thread, 0);
1199 }
1200 }
1201 }
1202 };
1203
1204 class ShenandoahGCStatePropagatorHandshakeClosure : public HandshakeClosure {
1205 public:
1206 explicit ShenandoahGCStatePropagatorHandshakeClosure(char gc_state) :
1207 HandshakeClosure("Shenandoah GC State Change"),
1208 _gc_state(gc_state), _gc_state_fast(ShenandoahThreadLocalData::compute_gc_state_fast(gc_state)) {}
1209
1210 void do_thread(Thread* thread) override {
1211 ShenandoahThreadLocalData::set_gc_state(thread, _gc_state, _gc_state_fast);
1212 }
1213 private:
1214 char _gc_state;
1215 char _gc_state_fast;
1216 };
1217
1218 class ShenandoahPrepareForUpdateRefsHandshakeClosure : public HandshakeClosure {
1219 public:
1220 explicit ShenandoahPrepareForUpdateRefsHandshakeClosure(char gc_state) :
1221 HandshakeClosure("Shenandoah Prepare for Update Refs"),
1222 _retire(ResizeTLAB), _propagator(gc_state) {}
1223
1224 void do_thread(Thread* thread) override {
1225 _propagator.do_thread(thread);
1226 if (ShenandoahThreadLocalData::gclab(thread) != nullptr) {
1227 _retire.do_thread(thread);
1228 }
1229 }
1230 private:
1231 ShenandoahRetireGCLABClosure _retire;
1232 ShenandoahGCStatePropagatorHandshakeClosure _propagator;
1233 };
1234
1235 void ShenandoahHeap::evacuate_collection_set(ShenandoahGeneration* generation, bool concurrent) {
|