src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp
changeset 52210 f59960ebed20
parent 51292 0538a5cdb474
child 52348 21fdf8d9a8b6
equal deleted inserted replaced
52209:3b2e68c9e7a6 52210:f59960ebed20
    23  */
    23  */
    24 
    24 
    25 #ifndef SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
    25 #ifndef SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
    26 #define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
    26 #define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
    27 
    27 
       
    28 #include "gc/g1/g1CollectedHeap.inline.hpp"
    28 #include "gc/g1/g1ParScanThreadState.hpp"
    29 #include "gc/g1/g1ParScanThreadState.hpp"
    29 #include "gc/g1/g1RemSet.hpp"
    30 #include "gc/g1/g1RemSet.hpp"
    30 #include "oops/access.inline.hpp"
    31 #include "oops/access.inline.hpp"
    31 #include "oops/oop.inline.hpp"
    32 #include "oops/oop.inline.hpp"
    32 
    33 
    38   // set, due to (benign) races in the claim mechanism during RSet scanning more
    39   // 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   // than one thread might claim the same card. So the same card may be
    40   // processed multiple times, and so we might get references into old gen here.
    41   // processed multiple times, and so we might get references into old gen here.
    41   // So we need to redo this check.
    42   // So we need to redo this check.
    42   const InCSetState in_cset_state = _g1h->in_cset_state(obj);
    43   const InCSetState in_cset_state = _g1h->in_cset_state(obj);
    43   if (in_cset_state.is_in_cset()) {
    44   // References pushed onto the work stack should never point to a humongous region
    44     markOop m = obj->mark_raw();
    45   // as they are not added to the collection set due to above precondition.
    45     if (m->is_marked()) {
    46   assert(!in_cset_state.is_humongous(),
    46       obj = (oop) m->decode_pointer();
    47          "Obj " PTR_FORMAT " should not refer to humongous region %u from " PTR_FORMAT,
    47     } else {
    48          p2i(obj), _g1h->addr_to_region((HeapWord*)obj), p2i(p));
    48       obj = copy_to_survivor_space(in_cset_state, obj, m);
    49 
    49     }
    50   if (!in_cset_state.is_in_cset()) {
    50     RawAccess<IS_NOT_NULL>::oop_store(p, obj);
    51     // In this case somebody else already did all the work.
    51   } else if (in_cset_state.is_humongous()) {
    52     return;
    52     _g1h->set_humongous_is_live(obj);
    53   }
    53   } else {
    54 
    54     assert(in_cset_state.is_default(),
    55   markOop m = obj->mark_raw();
    55            "In_cset_state must be NotInCSet here, but is " CSETSTATE_FORMAT, in_cset_state.value());
    56   if (m->is_marked()) {
    56   }
    57     obj = (oop) m->decode_pointer();
       
    58   } else {
       
    59     obj = copy_to_survivor_space(in_cset_state, obj, m);
       
    60   }
       
    61   RawAccess<IS_NOT_NULL>::oop_store(p, obj);
    57 
    62 
    58   assert(obj != NULL, "Must be");
    63   assert(obj != NULL, "Must be");
    59   if (!HeapRegion::is_in_same_region(p, obj)) {
    64   if (!HeapRegion::is_in_same_region(p, obj)) {
    60     HeapRegion* from = _g1h->heap_region_containing(p);
    65     HeapRegion* from = _g1h->heap_region_containing(p);
    61     update_rs(from, p, obj);
    66     update_rs(from, p, obj);