src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp

Print this page
rev 6670 : fast reclaim main patch


  35   }
  36 }
  37 
  38 template <class T> void G1ParScanThreadState::update_rs(HeapRegion* from, T* p, int tid) {
  39   if (G1DeferredRSUpdate) {
  40     deferred_rs_update(from, p, tid);
  41   } else {
  42     immediate_rs_update(from, p, tid);
  43   }
  44 }
  45 
  46 template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from) {
  47   assert(!oopDesc::is_null(oopDesc::load_decode_heap_oop(p)),
  48          "Reference should not be NULL here as such are never pushed to the task queue.");
  49   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  50 
  51   // Although we never intentionally push references outside of the collection
  52   // set, due to (benign) races in the claim mechanism during RSet scanning more
  53   // than one thread might claim the same card. So the same card may be
  54   // processed multiple times. So redo this check.
  55   if (_g1h->in_cset_fast_test(obj)) {
  56     oop forwardee;
  57     if (obj->is_forwarded()) {
  58       forwardee = obj->forwardee();
  59     } else {
  60       forwardee = copy_to_survivor_space(obj);
  61     }
  62     assert(forwardee != NULL, "forwardee should not be NULL");
  63     oopDesc::encode_store_heap_oop(p, forwardee);
  64   }

  65 
  66   assert(obj != NULL, "Must be");
  67   update_rs(from, p, queue_num());
  68 }
  69 
  70 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
  71   assert(has_partial_array_mask(p), "invariant");
  72   oop from_obj = clear_partial_array_mask(p);
  73 
  74   assert(Universe::heap()->is_in_reserved(from_obj), "must be in heap.");
  75   assert(from_obj->is_objArray(), "must be obj array");
  76   objArrayOop from_obj_array = objArrayOop(from_obj);
  77   // The from-space object contains the real length.
  78   int length                 = from_obj_array->length();
  79 
  80   assert(from_obj->is_forwarded(), "must be forwarded");
  81   oop to_obj                 = from_obj->forwardee();
  82   assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
  83   objArrayOop to_obj_array   = objArrayOop(to_obj);
  84   // We keep track of the next start index in the length field of the




  35   }
  36 }
  37 
  38 template <class T> void G1ParScanThreadState::update_rs(HeapRegion* from, T* p, int tid) {
  39   if (G1DeferredRSUpdate) {
  40     deferred_rs_update(from, p, tid);
  41   } else {
  42     immediate_rs_update(from, p, tid);
  43   }
  44 }
  45 
  46 template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from) {
  47   assert(!oopDesc::is_null(oopDesc::load_decode_heap_oop(p)),
  48          "Reference should not be NULL here as such are never pushed to the task queue.");
  49   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  50 
  51   // Although we never intentionally push references outside of the collection
  52   // set, due to (benign) races in the claim mechanism during RSet scanning more
  53   // than one thread might claim the same card. So the same card may be
  54   // processed multiple times. So redo this check.
  55   if (_g1h->is_in_cset_or_humongous(obj)) {
  56     oop forwardee;
  57     if (obj->is_forwarded()) {
  58       forwardee = obj->forwardee();
  59     } else {
  60       forwardee = copy_to_survivor_space(obj);
  61     }
  62     if (forwardee != NULL) {
  63       oopDesc::encode_store_heap_oop(p, forwardee);
  64     }
  65   }
  66 
  67   assert(obj != NULL, "Must be");
  68   update_rs(from, p, queue_num());
  69 }
  70 
  71 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
  72   assert(has_partial_array_mask(p), "invariant");
  73   oop from_obj = clear_partial_array_mask(p);
  74 
  75   assert(Universe::heap()->is_in_reserved(from_obj), "must be in heap.");
  76   assert(from_obj->is_objArray(), "must be obj array");
  77   objArrayOop from_obj_array = objArrayOop(from_obj);
  78   // The from-space object contains the real length.
  79   int length                 = from_obj_array->length();
  80 
  81   assert(from_obj->is_forwarded(), "must be forwarded");
  82   oop to_obj                 = from_obj->forwardee();
  83   assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
  84   objArrayOop to_obj_array   = objArrayOop(to_obj);
  85   // We keep track of the next start index in the length field of the