< prev index next >

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

Print this page

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

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