< prev index next >

src/hotspot/share/gc/g1/g1OopClosures.inline.hpp

Print this page

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

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