< prev index next >

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

Print this page
rev 8978 : imported patch remove_err_msg


  35   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  36 
  37   // Although we never intentionally push references outside of the collection
  38   // set, due to (benign) races in the claim mechanism during RSet scanning more
  39   // than one thread might claim the same card. So the same card may be
  40   // processed multiple times. So redo this check.
  41   const InCSetState in_cset_state = _g1h->in_cset_state(obj);
  42   if (in_cset_state.is_in_cset()) {
  43     oop forwardee;
  44     markOop m = obj->mark();
  45     if (m->is_marked()) {
  46       forwardee = (oop) m->decode_pointer();
  47     } else {
  48       forwardee = copy_to_survivor_space(in_cset_state, obj, m);
  49     }
  50     oopDesc::encode_store_heap_oop(p, forwardee);
  51   } else if (in_cset_state.is_humongous()) {
  52     _g1h->set_humongous_is_live(obj);
  53   } else {
  54     assert(!in_cset_state.is_in_cset_or_humongous(),
  55            err_msg("In_cset_state must be NotInCSet here, but is " CSETSTATE_FORMAT, in_cset_state.value()));
  56   }
  57 
  58   assert(obj != NULL, "Must be");
  59   update_rs(from, p, _worker_id);
  60 }
  61 
  62 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
  63   assert(verify_ref(ref), "sanity");
  64   _refs->push(ref);
  65 }
  66 
  67 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
  68   assert(has_partial_array_mask(p), "invariant");
  69   oop from_obj = clear_partial_array_mask(p);
  70 
  71   assert(_g1h->is_in_reserved(from_obj), "must be in heap.");
  72   assert(from_obj->is_objArray(), "must be obj array");
  73   objArrayOop from_obj_array = objArrayOop(from_obj);
  74   // The from-space object contains the real length.
  75   int length                 = from_obj_array->length();
  76 
  77   assert(from_obj->is_forwarded(), "must be forwarded");
  78   oop to_obj                 = from_obj->forwardee();
  79   assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
  80   objArrayOop to_obj_array   = objArrayOop(to_obj);
  81   // We keep track of the next start index in the length field of the
  82   // to-space object.
  83   int next_index             = to_obj_array->length();
  84   assert(0 <= next_index && next_index < length,
  85          err_msg("invariant, next index: %d, length: %d", next_index, length));
  86 
  87   int start                  = next_index;
  88   int end                    = length;
  89   int remainder              = end - start;
  90   // We'll try not to push a range that's smaller than ParGCArrayScanChunk.
  91   if (remainder > 2 * ParGCArrayScanChunk) {
  92     end = start + ParGCArrayScanChunk;
  93     to_obj_array->set_length(end);
  94     // Push the remainder before we process the range in case another
  95     // worker has run out of things to do and can steal it.
  96     oop* from_obj_p = set_partial_array_mask(from_obj);
  97     push_on_queue(from_obj_p);
  98   } else {
  99     assert(length == end, "sanity");
 100     // We'll process the final range for this object. Restore the length
 101     // so that the heap remains parsable in case of evacuation failure.
 102     to_obj_array->set_length(end);
 103   }
 104   _scanner.set_region(_g1h->heap_region_containing_raw(to_obj));
 105   // Process indexes [start,end). It will also process the header




  35   oop obj = oopDesc::load_decode_heap_oop_not_null(p);
  36 
  37   // Although we never intentionally push references outside of the collection
  38   // set, due to (benign) races in the claim mechanism during RSet scanning more
  39   // than one thread might claim the same card. So the same card may be
  40   // processed multiple times. So redo this check.
  41   const InCSetState in_cset_state = _g1h->in_cset_state(obj);
  42   if (in_cset_state.is_in_cset()) {
  43     oop forwardee;
  44     markOop m = obj->mark();
  45     if (m->is_marked()) {
  46       forwardee = (oop) m->decode_pointer();
  47     } else {
  48       forwardee = copy_to_survivor_space(in_cset_state, obj, m);
  49     }
  50     oopDesc::encode_store_heap_oop(p, forwardee);
  51   } else if (in_cset_state.is_humongous()) {
  52     _g1h->set_humongous_is_live(obj);
  53   } else {
  54     assert(!in_cset_state.is_in_cset_or_humongous(),
  55            "In_cset_state must be NotInCSet here, but is " CSETSTATE_FORMAT, in_cset_state.value());
  56   }
  57 
  58   assert(obj != NULL, "Must be");
  59   update_rs(from, p, _worker_id);
  60 }
  61 
  62 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
  63   assert(verify_ref(ref), "sanity");
  64   _refs->push(ref);
  65 }
  66 
  67 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
  68   assert(has_partial_array_mask(p), "invariant");
  69   oop from_obj = clear_partial_array_mask(p);
  70 
  71   assert(_g1h->is_in_reserved(from_obj), "must be in heap.");
  72   assert(from_obj->is_objArray(), "must be obj array");
  73   objArrayOop from_obj_array = objArrayOop(from_obj);
  74   // The from-space object contains the real length.
  75   int length                 = from_obj_array->length();
  76 
  77   assert(from_obj->is_forwarded(), "must be forwarded");
  78   oop to_obj                 = from_obj->forwardee();
  79   assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
  80   objArrayOop to_obj_array   = objArrayOop(to_obj);
  81   // We keep track of the next start index in the length field of the
  82   // to-space object.
  83   int next_index             = to_obj_array->length();
  84   assert(0 <= next_index && next_index < length,
  85          "invariant, next index: %d, length: %d", next_index, length);
  86 
  87   int start                  = next_index;
  88   int end                    = length;
  89   int remainder              = end - start;
  90   // We'll try not to push a range that's smaller than ParGCArrayScanChunk.
  91   if (remainder > 2 * ParGCArrayScanChunk) {
  92     end = start + ParGCArrayScanChunk;
  93     to_obj_array->set_length(end);
  94     // Push the remainder before we process the range in case another
  95     // worker has run out of things to do and can steal it.
  96     oop* from_obj_p = set_partial_array_mask(from_obj);
  97     push_on_queue(from_obj_p);
  98   } else {
  99     assert(length == end, "sanity");
 100     // We'll process the final range for this object. Restore the length
 101     // so that the heap remains parsable in case of evacuation failure.
 102     to_obj_array->set_length(end);
 103   }
 104   _scanner.set_region(_g1h->heap_region_containing_raw(to_obj));
 105   // Process indexes [start,end). It will also process the header


< prev index next >