< prev index next >

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

Print this page
rev 52281 : [mq]: 8212911-unify-reference-handling-during-gc


  70 inline void G1ScanClosureBase::trim_queue_partially() {
  71   _par_scan_state->trim_queue_partially();
  72 }
  73 
  74 template <class T>
  75 inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
  76   T heap_oop = RawAccess<>::oop_load(p);
  77 
  78   if (CompressedOops::is_null(heap_oop)) {
  79     return;
  80   }
  81   oop obj = CompressedOops::decode_not_null(heap_oop);
  82   const InCSetState state = _g1h->in_cset_state(obj);
  83   if (state.is_in_cset()) {
  84     prefetch_and_push(p, obj);
  85   } else {
  86     if (HeapRegion::is_in_same_region(p, obj)) {
  87       return;
  88     }
  89     handle_non_cset_obj_common(state, p, obj);
  90     _par_scan_state->update_rs(_from, p, obj);



  91   }
  92 }
  93 
  94 template <class T>
  95 inline void G1CMOopClosure::do_oop_work(T* p) {
  96   _task->deal_with_reference(p);
  97 }
  98 
  99 template <class T>
 100 inline void G1RootRegionScanClosure::do_oop_work(T* p) {
 101   T heap_oop = RawAccess<MO_VOLATILE>::oop_load(p);
 102   if (CompressedOops::is_null(heap_oop)) {
 103     return;
 104   }
 105   oop obj = CompressedOops::decode_not_null(heap_oop);
 106   _cm->mark_in_next_bitmap(_worker_id, obj);
 107 }
 108 
 109 template <class T>
 110 inline static void check_obj_during_refinement(T* p, oop const obj) {


 156   }
 157 }
 158 
 159 template <class T>
 160 inline void G1ScanObjsDuringUpdateRSClosure::do_oop_work(T* p) {
 161   T o = RawAccess<>::oop_load(p);
 162   if (CompressedOops::is_null(o)) {
 163     return;
 164   }
 165   oop obj = CompressedOops::decode_not_null(o);
 166 
 167   check_obj_during_refinement(p, obj);
 168 
 169   assert(!_g1h->is_in_cset((HeapWord*)p), "Oop originates from " PTR_FORMAT " (region: %u) which is in the collection set.", p2i(p), _g1h->addr_to_region((HeapWord*)p));
 170   const InCSetState state = _g1h->in_cset_state(obj);
 171   if (state.is_in_cset()) {
 172     // Since the source is always from outside the collection set, here we implicitly know
 173     // that this is a cross-region reference too.
 174     prefetch_and_push(p, obj);
 175   } else {
 176     HeapRegion* to = _g1h->heap_region_containing(obj);
 177     if (_from == to) {
 178       return;
 179     }
 180     handle_non_cset_obj_common(state, p, obj);
 181     to->rem_set()->add_reference(p, _worker_i);

 182   }
 183 }
 184 
 185 template <class T>
 186 inline void G1ScanObjsDuringScanRSClosure::do_oop_work(T* p) {
 187   T heap_oop = RawAccess<>::oop_load(p);
 188   if (CompressedOops::is_null(heap_oop)) {
 189     return;
 190   }
 191   oop obj = CompressedOops::decode_not_null(heap_oop);
 192 
 193   const InCSetState state = _g1h->in_cset_state(obj);
 194   if (state.is_in_cset()) {
 195     prefetch_and_push(p, obj);
 196   } else {
 197     if (HeapRegion::is_in_same_region(p, obj)) {
 198       return;
 199     }
 200     handle_non_cset_obj_common(state, p, obj);
 201   }




  70 inline void G1ScanClosureBase::trim_queue_partially() {
  71   _par_scan_state->trim_queue_partially();
  72 }
  73 
  74 template <class T>
  75 inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
  76   T heap_oop = RawAccess<>::oop_load(p);
  77 
  78   if (CompressedOops::is_null(heap_oop)) {
  79     return;
  80   }
  81   oop obj = CompressedOops::decode_not_null(heap_oop);
  82   const InCSetState state = _g1h->in_cset_state(obj);
  83   if (state.is_in_cset()) {
  84     prefetch_and_push(p, obj);
  85   } else {
  86     if (HeapRegion::is_in_same_region(p, obj)) {
  87       return;
  88     }
  89     handle_non_cset_obj_common(state, p, obj);
  90     if (_from_is_young) {
  91       return;
  92     }
  93     _par_scan_state->enqueue_card_if_tracked(p, obj);
  94   }
  95 }
  96 
  97 template <class T>
  98 inline void G1CMOopClosure::do_oop_work(T* p) {
  99   _task->deal_with_reference(p);
 100 }
 101 
 102 template <class T>
 103 inline void G1RootRegionScanClosure::do_oop_work(T* p) {
 104   T heap_oop = RawAccess<MO_VOLATILE>::oop_load(p);
 105   if (CompressedOops::is_null(heap_oop)) {
 106     return;
 107   }
 108   oop obj = CompressedOops::decode_not_null(heap_oop);
 109   _cm->mark_in_next_bitmap(_worker_id, obj);
 110 }
 111 
 112 template <class T>
 113 inline static void check_obj_during_refinement(T* p, oop const obj) {


 159   }
 160 }
 161 
 162 template <class T>
 163 inline void G1ScanObjsDuringUpdateRSClosure::do_oop_work(T* p) {
 164   T o = RawAccess<>::oop_load(p);
 165   if (CompressedOops::is_null(o)) {
 166     return;
 167   }
 168   oop obj = CompressedOops::decode_not_null(o);
 169 
 170   check_obj_during_refinement(p, obj);
 171 
 172   assert(!_g1h->is_in_cset((HeapWord*)p), "Oop originates from " PTR_FORMAT " (region: %u) which is in the collection set.", p2i(p), _g1h->addr_to_region((HeapWord*)p));
 173   const InCSetState state = _g1h->in_cset_state(obj);
 174   if (state.is_in_cset()) {
 175     // Since the source is always from outside the collection set, here we implicitly know
 176     // that this is a cross-region reference too.
 177     prefetch_and_push(p, obj);
 178   } else {
 179     if (HeapRegion::is_in_same_region(p, obj)) {

 180       return;
 181     }
 182     handle_non_cset_obj_common(state, p, obj);
 183     assert(!_from_is_young, "Should not be the case.");
 184     _par_scan_state->enqueue_card_if_tracked(p, obj);
 185   }
 186 }
 187 
 188 template <class T>
 189 inline void G1ScanObjsDuringScanRSClosure::do_oop_work(T* p) {
 190   T heap_oop = RawAccess<>::oop_load(p);
 191   if (CompressedOops::is_null(heap_oop)) {
 192     return;
 193   }
 194   oop obj = CompressedOops::decode_not_null(heap_oop);
 195 
 196   const InCSetState state = _g1h->in_cset_state(obj);
 197   if (state.is_in_cset()) {
 198     prefetch_and_push(p, obj);
 199   } else {
 200     if (HeapRegion::is_in_same_region(p, obj)) {
 201       return;
 202     }
 203     handle_non_cset_obj_common(state, p, obj);
 204   }


< prev index next >