< prev index next >

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

Print this page
rev 13253 : imported patch 8183539-remove-into-cset-dcqs
rev 13256 : imported patch overflow-queue-mechanics-change
rev 13261 : imported patch 8184348-merge-par_mark-and_gray_root


  82   if (state.is_in_cset()) {
  83     prefetch_and_push(p, obj);
  84   } else {
  85     if (HeapRegion::is_in_same_region(p, obj)) {
  86       return;
  87     }
  88     handle_non_cset_obj_common(state, p, obj);
  89     _par_scan_state->update_rs(_from, p, obj);
  90   }
  91 }
  92 
  93 template <class T>
  94 inline void G1CMOopClosure::do_oop_nv(T* p) {
  95   oop obj = oopDesc::load_decode_heap_oop(p);
  96   _task->deal_with_reference(obj);
  97 }
  98 
  99 template <class T>
 100 inline void G1RootRegionScanClosure::do_oop_nv(T* p) {
 101   T heap_oop = oopDesc::load_heap_oop(p);
 102   if (!oopDesc::is_null(heap_oop)) {
 103     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 104     HeapRegion* hr = _g1h->heap_region_containing((HeapWord*) obj);
 105     _cm->grayRoot(obj, hr);
 106   }


 107 }
 108 
 109 template <class T>
 110 inline static void check_obj_during_refinement(T* p, oop const obj) {
 111 #ifdef ASSERT
 112   G1CollectedHeap* g1 = G1CollectedHeap::heap();
 113   // can't do because of races
 114   // assert(obj == NULL || obj->is_oop(), "expected an oop");
 115   assert(check_obj_alignment(obj), "not oop aligned");
 116   assert(g1->is_in_reserved(obj), "must be in heap");
 117 
 118   HeapRegion* from = g1->heap_region_containing(p);
 119 
 120   assert(from != NULL, "from region must be non-NULL");
 121   assert(from->is_in_reserved(p) ||
 122          (from->is_humongous() &&
 123           g1->heap_region_containing(p)->is_humongous() &&
 124           from->humongous_start_region() == g1->heap_region_containing(p)->humongous_start_region()),
 125          "p " PTR_FORMAT " is not in the same region %u or part of the correct humongous object starting at region %u.",
 126          p2i(p), from->hrm_index(), from->humongous_start_region()->hrm_index());


 192   if (state.is_in_cset()) {
 193     prefetch_and_push(p, obj);
 194   } else {
 195     if (HeapRegion::is_in_same_region(p, obj)) {
 196       return;
 197     }
 198     handle_non_cset_obj_common(state, p, obj);
 199   }
 200 }
 201 
 202 template <class T>
 203 void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) {
 204   if (_g1->heap_region_containing(new_obj)->is_young()) {
 205     _scanned_klass->record_modified_oops();
 206   }
 207 }
 208 
 209 void G1ParCopyHelper::mark_object(oop obj) {
 210   assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
 211 
 212   // We know that the object is not moving so it's safe to read its size.
 213   _cm->grayRoot(obj);
 214 }
 215 
 216 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
 217   assert(from_obj->is_forwarded(), "from obj should be forwarded");
 218   assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
 219   assert(from_obj != to_obj, "should not be self-forwarded");
 220 
 221   assert(_g1->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet");
 222   assert(!_g1->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet");
 223 
 224   // The object might be in the process of being copied by another
 225   // worker so we cannot trust that its to-space image is
 226   // well-formed. So we have to read its size from its from-space
 227   // image which we know should not be changing.
 228   _cm->grayRoot(to_obj);
 229 }
 230 
 231 template <G1Barrier barrier, G1Mark do_mark_object, bool use_ext>
 232 template <class T>
 233 void G1ParCopyClosure<barrier, do_mark_object, use_ext>::do_oop_work(T* p) {
 234   T heap_oop = oopDesc::load_heap_oop(p);
 235 
 236   if (oopDesc::is_null(heap_oop)) {
 237     return;
 238   }
 239 
 240   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 241 
 242   assert(_worker_id == _par_scan_state->worker_id(), "sanity");
 243 
 244   const InCSetState state = _g1->in_cset_state(obj);
 245   if (state.is_in_cset()) {
 246     oop forwardee;
 247     markOop m = obj->mark();
 248     if (m->is_marked()) {




  82   if (state.is_in_cset()) {
  83     prefetch_and_push(p, obj);
  84   } else {
  85     if (HeapRegion::is_in_same_region(p, obj)) {
  86       return;
  87     }
  88     handle_non_cset_obj_common(state, p, obj);
  89     _par_scan_state->update_rs(_from, p, obj);
  90   }
  91 }
  92 
  93 template <class T>
  94 inline void G1CMOopClosure::do_oop_nv(T* p) {
  95   oop obj = oopDesc::load_decode_heap_oop(p);
  96   _task->deal_with_reference(obj);
  97 }
  98 
  99 template <class T>
 100 inline void G1RootRegionScanClosure::do_oop_nv(T* p) {
 101   T heap_oop = oopDesc::load_heap_oop(p);
 102   if (oopDesc::is_null(heap_oop)) {
 103     return;


 104   }
 105   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 106   _cm->mark_in_next_bitmap(obj);
 107 }
 108 
 109 template <class T>
 110 inline static void check_obj_during_refinement(T* p, oop const obj) {
 111 #ifdef ASSERT
 112   G1CollectedHeap* g1 = G1CollectedHeap::heap();
 113   // can't do because of races
 114   // assert(obj == NULL || obj->is_oop(), "expected an oop");
 115   assert(check_obj_alignment(obj), "not oop aligned");
 116   assert(g1->is_in_reserved(obj), "must be in heap");
 117 
 118   HeapRegion* from = g1->heap_region_containing(p);
 119 
 120   assert(from != NULL, "from region must be non-NULL");
 121   assert(from->is_in_reserved(p) ||
 122          (from->is_humongous() &&
 123           g1->heap_region_containing(p)->is_humongous() &&
 124           from->humongous_start_region() == g1->heap_region_containing(p)->humongous_start_region()),
 125          "p " PTR_FORMAT " is not in the same region %u or part of the correct humongous object starting at region %u.",
 126          p2i(p), from->hrm_index(), from->humongous_start_region()->hrm_index());


 192   if (state.is_in_cset()) {
 193     prefetch_and_push(p, obj);
 194   } else {
 195     if (HeapRegion::is_in_same_region(p, obj)) {
 196       return;
 197     }
 198     handle_non_cset_obj_common(state, p, obj);
 199   }
 200 }
 201 
 202 template <class T>
 203 void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) {
 204   if (_g1->heap_region_containing(new_obj)->is_young()) {
 205     _scanned_klass->record_modified_oops();
 206   }
 207 }
 208 
 209 void G1ParCopyHelper::mark_object(oop obj) {
 210   assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
 211 
 212   _cm->mark_in_next_bitmap(obj);

 213 }
 214 
 215 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
 216   assert(from_obj->is_forwarded(), "from obj should be forwarded");
 217   assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
 218   assert(from_obj != to_obj, "should not be self-forwarded");
 219 
 220   assert(_g1->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet");
 221   assert(!_g1->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet");
 222 
 223   _cm->mark_in_next_bitmap(to_obj);




 224 }
 225 
 226 template <G1Barrier barrier, G1Mark do_mark_object, bool use_ext>
 227 template <class T>
 228 void G1ParCopyClosure<barrier, do_mark_object, use_ext>::do_oop_work(T* p) {
 229   T heap_oop = oopDesc::load_heap_oop(p);
 230 
 231   if (oopDesc::is_null(heap_oop)) {
 232     return;
 233   }
 234 
 235   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 236 
 237   assert(_worker_id == _par_scan_state->worker_id(), "sanity");
 238 
 239   const InCSetState state = _g1->in_cset_state(obj);
 240   if (state.is_in_cset()) {
 241     oop forwardee;
 242     markOop m = obj->mark();
 243     if (m->is_marked()) {


< prev index next >