< prev index next >

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

Print this page




 178 
 179 template <class T>
 180 inline void G1ScanObjsDuringScanRSClosure::do_oop_nv(T* p) {
 181   T heap_oop = oopDesc::load_heap_oop(p);
 182   if (oopDesc::is_null(heap_oop)) {
 183     return;
 184   }
 185   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 186 
 187   const InCSetState state = _g1->in_cset_state(obj);
 188   if (state.is_in_cset()) {
 189     prefetch_and_push(p, obj);
 190   } else {
 191     if (HeapRegion::is_in_same_region(p, obj)) {
 192       return;
 193     }
 194     handle_non_cset_obj_common(state, p, obj);
 195   }
 196 }
 197 
 198 template <class T>
 199 void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) {
 200   if (_g1->heap_region_containing(new_obj)->is_young()) {
 201     _scanned_klass->record_modified_oops();
 202   }
 203 }
 204 
 205 void G1ParCopyHelper::mark_object(oop obj) {
 206   assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
 207 
 208   _cm->mark_in_next_bitmap(obj);
 209 }
 210 
 211 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
 212   assert(from_obj->is_forwarded(), "from obj should be forwarded");
 213   assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
 214   assert(from_obj != to_obj, "should not be self-forwarded");
 215 
 216   assert(_g1->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet");
 217   assert(!_g1->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet");
 218 
 219   _cm->mark_in_next_bitmap(to_obj);
 220 }
 221 


 232 
 233   assert(_worker_id == _par_scan_state->worker_id(), "sanity");
 234 
 235   const InCSetState state = _g1->in_cset_state(obj);
 236   if (state.is_in_cset()) {
 237     oop forwardee;
 238     markOop m = obj->mark();
 239     if (m->is_marked()) {
 240       forwardee = (oop) m->decode_pointer();
 241     } else {
 242       forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m);
 243     }
 244     assert(forwardee != NULL, "forwardee should not be NULL");
 245     oopDesc::encode_store_heap_oop(p, forwardee);
 246     if (do_mark_object != G1MarkNone && forwardee != obj) {
 247       // If the object is self-forwarded we don't need to explicitly
 248       // mark it, the evacuation failure protocol will do so.
 249       mark_forwarded_object(obj, forwardee);
 250     }
 251 
 252     if (barrier == G1BarrierKlass) {
 253       do_klass_barrier(p, forwardee);
 254     }
 255   } else {
 256     if (state.is_humongous()) {
 257       _g1->set_humongous_is_live(obj);
 258     }
 259 
 260     if (use_ext && state.is_ext()) {
 261       _par_scan_state->do_oop_ext(p);
 262     }
 263     // The object is not in collection set. If we're a root scanning
 264     // closure during an initial mark pause then attempt to mark the object.
 265     if (do_mark_object == G1MarkFromRoot) {
 266       mark_object(obj);
 267     }
 268   }
 269 }
 270 
 271 #endif // SHARE_VM_GC_G1_G1OOPCLOSURES_INLINE_HPP


 178 
 179 template <class T>
 180 inline void G1ScanObjsDuringScanRSClosure::do_oop_nv(T* p) {
 181   T heap_oop = oopDesc::load_heap_oop(p);
 182   if (oopDesc::is_null(heap_oop)) {
 183     return;
 184   }
 185   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 186 
 187   const InCSetState state = _g1->in_cset_state(obj);
 188   if (state.is_in_cset()) {
 189     prefetch_and_push(p, obj);
 190   } else {
 191     if (HeapRegion::is_in_same_region(p, obj)) {
 192       return;
 193     }
 194     handle_non_cset_obj_common(state, p, obj);
 195   }
 196 }
 197 
 198 void G1ParCopyHelper::do_cld_barrier(oop new_obj) {

 199   if (_g1->heap_region_containing(new_obj)->is_young()) {
 200     _scanned_cld->record_modified_oops();
 201   }
 202 }
 203 
 204 void G1ParCopyHelper::mark_object(oop obj) {
 205   assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
 206 
 207   _cm->mark_in_next_bitmap(obj);
 208 }
 209 
 210 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
 211   assert(from_obj->is_forwarded(), "from obj should be forwarded");
 212   assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
 213   assert(from_obj != to_obj, "should not be self-forwarded");
 214 
 215   assert(_g1->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet");
 216   assert(!_g1->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet");
 217 
 218   _cm->mark_in_next_bitmap(to_obj);
 219 }
 220 


 231 
 232   assert(_worker_id == _par_scan_state->worker_id(), "sanity");
 233 
 234   const InCSetState state = _g1->in_cset_state(obj);
 235   if (state.is_in_cset()) {
 236     oop forwardee;
 237     markOop m = obj->mark();
 238     if (m->is_marked()) {
 239       forwardee = (oop) m->decode_pointer();
 240     } else {
 241       forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m);
 242     }
 243     assert(forwardee != NULL, "forwardee should not be NULL");
 244     oopDesc::encode_store_heap_oop(p, forwardee);
 245     if (do_mark_object != G1MarkNone && forwardee != obj) {
 246       // If the object is self-forwarded we don't need to explicitly
 247       // mark it, the evacuation failure protocol will do so.
 248       mark_forwarded_object(obj, forwardee);
 249     }
 250 
 251     if (barrier == G1BarrierCLD) {
 252       do_cld_barrier(forwardee);
 253     }
 254   } else {
 255     if (state.is_humongous()) {
 256       _g1->set_humongous_is_live(obj);
 257     }
 258 
 259     if (use_ext && state.is_ext()) {
 260       _par_scan_state->do_oop_ext(p);
 261     }
 262     // The object is not in collection set. If we're a root scanning
 263     // closure during an initial mark pause then attempt to mark the object.
 264     if (do_mark_object == G1MarkFromRoot) {
 265       mark_object(obj);
 266     }
 267   }
 268 }

 269 #endif // SHARE_VM_GC_G1_G1OOPCLOSURES_INLINE_HPP
< prev index next >