src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp
changeset 54843 25c329958c70
parent 53244 9807daeb47c4
child 54934 39814e0a8964
equal deleted inserted replaced
54842:f9c8e16db3dd 54843:25c329958c70
    39   // Although we never intentionally push references outside of the collection
    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
    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
    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.
    42   // processed multiple times, and so we might get references into old gen here.
    43   // So we need to redo this check.
    43   // So we need to redo this check.
    44   const InCSetState in_cset_state = _g1h->in_cset_state(obj);
    44   const G1HeapRegionAttr region_attr = _g1h->region_attr(obj);
    45   // References pushed onto the work stack should never point to a humongous region
    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.
    46   // as they are not added to the collection set due to above precondition.
    47   assert(!in_cset_state.is_humongous(),
    47   assert(!region_attr.is_humongous(),
    48          "Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT,
    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));
    49          p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p));
    50 
    50 
    51   if (!in_cset_state.is_in_cset()) {
    51   if (!region_attr.is_in_cset()) {
    52     // In this case somebody else already did all the work.
    52     // In this case somebody else already did all the work.
    53     return;
    53     return;
    54   }
    54   }
    55 
    55 
    56   markOop m = obj->mark_raw();
    56   markOop m = obj->mark_raw();
    57   if (m->is_marked()) {
    57   if (m->is_marked()) {
    58     obj = (oop) m->decode_pointer();
    58     obj = (oop) m->decode_pointer();
    59   } else {
    59   } else {
    60     obj = copy_to_survivor_space(in_cset_state, obj, m);
    60     obj = copy_to_survivor_space(region_attr, obj, m);
    61   }
    61   }
    62   RawAccess<IS_NOT_NULL>::oop_store(p, obj);
    62   RawAccess<IS_NOT_NULL>::oop_store(p, obj);
    63 
    63 
    64   assert(obj != NULL, "Must be");
    64   assert(obj != NULL, "Must be");
    65   if (HeapRegion::is_in_same_region(p, obj)) {
    65   if (HeapRegion::is_in_same_region(p, obj)) {
    66     return;
    66     return;
    67   }
    67   }
    68   HeapRegion* from = _g1h->heap_region_containing(p);
    68   HeapRegion* from = _g1h->heap_region_containing(p);
    69   if (!from->is_young()) {
    69   if (!from->is_young()) {
    70     enqueue_card_if_tracked(p, obj);
    70     enqueue_card_if_tracked(_g1h->region_attr(obj), p, obj);
    71   }
    71   }
    72 }
    72 }
    73 
    73 
    74 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
    74 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
    75   assert(verify_ref(ref), "sanity");
    75   assert(verify_ref(ref), "sanity");