< prev index next >

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

Print this page




  36   // Reference should not be NULL here as such are never pushed to the task queue.
  37   oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
  38 
  39   // Although we never intentionally push references outside of the collection
  40   // set, due to (benign) races in the claim mechanism during RSet scanning more
  41   // than one thread might claim the same card. So the same card may be
  42   // processed multiple times, and so we might get references into old gen here.
  43   // So we need to redo this check.
  44   const G1HeapRegionAttr region_attr = _g1h->region_attr(obj);
  45   // References pushed onto the work stack should never point to a humongous region
  46   // as they are not added to the collection set due to above precondition.
  47   assert(!region_attr.is_humongous(),
  48          "Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT,
  49          p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p));
  50 
  51   if (!region_attr.is_in_cset()) {
  52     // In this case somebody else already did all the work.
  53     return;
  54   }
  55 
  56   markWord m = obj->mark_raw();
  57   if (m.is_marked()) {
  58     obj = (oop) m.decode_pointer();
  59   } else {
  60     obj = copy_to_survivor_space(region_attr, obj, m);
  61   }
  62   RawAccess<IS_NOT_NULL>::oop_store(p, obj);
  63 
  64   assert(obj != NULL, "Must be");
  65   if (HeapRegion::is_in_same_region(p, obj)) {
  66     return;
  67   }
  68   HeapRegion* from = _g1h->heap_region_containing(p);
  69   if (!from->is_young()) {
  70     enqueue_card_if_tracked(_g1h->region_attr(obj), p, obj);
  71   }
  72 }
  73 
  74 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
  75   assert(verify_ref(ref), "sanity");
  76   _refs->push(ref);
  77 }
  78 




  36   // Reference should not be NULL here as such are never pushed to the task queue.
  37   oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
  38 
  39   // Although we never intentionally push references outside of the collection
  40   // set, due to (benign) races in the claim mechanism during RSet scanning more
  41   // than one thread might claim the same card. So the same card may be
  42   // processed multiple times, and so we might get references into old gen here.
  43   // So we need to redo this check.
  44   const G1HeapRegionAttr region_attr = _g1h->region_attr(obj);
  45   // References pushed onto the work stack should never point to a humongous region
  46   // as they are not added to the collection set due to above precondition.
  47   assert(!region_attr.is_humongous(),
  48          "Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT,
  49          p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p));
  50 
  51   if (!region_attr.is_in_cset()) {
  52     // In this case somebody else already did all the work.
  53     return;
  54   }
  55 
  56   markOop m = obj->mark_raw();
  57   if (m->is_marked()) {
  58     obj = (oop) m->decode_pointer();
  59   } else {
  60     obj = copy_to_survivor_space(region_attr, obj, m);
  61   }
  62   RawAccess<IS_NOT_NULL>::oop_store(p, obj);
  63 
  64   assert(obj != NULL, "Must be");
  65   if (HeapRegion::is_in_same_region(p, obj)) {
  66     return;
  67   }
  68   HeapRegion* from = _g1h->heap_region_containing(p);
  69   if (!from->is_young()) {
  70     enqueue_card_if_tracked(_g1h->region_attr(obj), p, obj);
  71   }
  72 }
  73 
  74 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
  75   assert(verify_ref(ref), "sanity");
  76   _refs->push(ref);
  77 }
  78 


< prev index next >