211 }
212
213 template <G1Barrier barrier, bool should_mark>
214 template <class T>
215 void G1ParCopyClosure<barrier, should_mark>::do_oop_work(T* p) {
216 T heap_oop = RawAccess<>::oop_load(p);
217
218 if (CompressedOops::is_null(heap_oop)) {
219 return;
220 }
221
222 oop obj = CompressedOops::decode_not_null(heap_oop);
223
224 assert(_worker_id == _par_scan_state->worker_id(), "sanity");
225
226 const G1HeapRegionAttr state = _g1h->region_attr(obj);
227 if (state.is_in_cset()) {
228 oop forwardee;
229 markWord m = obj->mark();
230 if (m.is_marked()) {
231 forwardee = cast_to_oop(m.decode_pointer());
232 } else {
233 forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m);
234 }
235 assert(forwardee != nullptr, "forwardee should not be null");
236 RawAccess<IS_NOT_NULL>::oop_store(p, forwardee);
237
238 if (barrier == G1BarrierCLD) {
239 do_cld_barrier(forwardee);
240 }
241 } else {
242 if (state.is_humongous_candidate()) {
243 _g1h->set_humongous_is_live(obj);
244 } else if ((barrier != G1BarrierNoOptRoots) && state.is_optional()) {
245 _par_scan_state->remember_root_into_optional_region(p);
246 }
247
248 // The object is not in the collection set. should_mark is true iff the
249 // current closure is applied on strong roots (and weak roots when class
250 // unloading is disabled) in a concurrent mark start pause.
251 if (should_mark) {
|
211 }
212
213 template <G1Barrier barrier, bool should_mark>
214 template <class T>
215 void G1ParCopyClosure<barrier, should_mark>::do_oop_work(T* p) {
216 T heap_oop = RawAccess<>::oop_load(p);
217
218 if (CompressedOops::is_null(heap_oop)) {
219 return;
220 }
221
222 oop obj = CompressedOops::decode_not_null(heap_oop);
223
224 assert(_worker_id == _par_scan_state->worker_id(), "sanity");
225
226 const G1HeapRegionAttr state = _g1h->region_attr(obj);
227 if (state.is_in_cset()) {
228 oop forwardee;
229 markWord m = obj->mark();
230 if (m.is_marked()) {
231 forwardee = obj->forwardee(m);
232 } else {
233 forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m);
234 }
235 assert(forwardee != nullptr, "forwardee should not be null");
236 RawAccess<IS_NOT_NULL>::oop_store(p, forwardee);
237
238 if (barrier == G1BarrierCLD) {
239 do_cld_barrier(forwardee);
240 }
241 } else {
242 if (state.is_humongous_candidate()) {
243 _g1h->set_humongous_is_live(obj);
244 } else if ((barrier != G1BarrierNoOptRoots) && state.is_optional()) {
245 _par_scan_state->remember_root_into_optional_region(p);
246 }
247
248 // The object is not in the collection set. should_mark is true iff the
249 // current closure is applied on strong roots (and weak roots when class
250 // unloading is disabled) in a concurrent mark start pause.
251 if (should_mark) {
|