hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp
changeset 6958 cfa71cf3564d
parent 6250 5680f968c721
child 7385 eaca4b61b374
equal deleted inserted replaced
6769:5f30b5a1ce5c 6958:cfa71cf3564d
    28   } else {
    28   } else {
    29     return 1;
    29     return 1;
    30   }
    30   }
    31 }
    31 }
    32 
    32 
    33 template <class T> inline void HRInto_G1RemSet::write_ref_nv(HeapRegion* from, T* p) {
    33 template <class T>
       
    34 inline void G1RemSet::write_ref_nv(HeapRegion* from, T* p) {
    34   par_write_ref_nv(from, p, 0);
    35   par_write_ref_nv(from, p, 0);
    35 }
    36 }
    36 
    37 
    37 inline bool HRInto_G1RemSet::self_forwarded(oop obj) {
    38 inline bool G1RemSet::self_forwarded(oop obj) {
    38   bool result =  (obj->is_forwarded() && (obj->forwardee()== obj));
    39   bool result =  (obj->is_forwarded() && (obj->forwardee()== obj));
    39   return result;
    40   return result;
    40 }
    41 }
    41 
    42 
    42 template <class T> inline void HRInto_G1RemSet::par_write_ref_nv(HeapRegion* from, T* p, int tid) {
    43 template <class T>
       
    44 inline void G1RemSet::par_write_ref_nv(HeapRegion* from, T* p, int tid) {
    43   oop obj = oopDesc::load_decode_heap_oop(p);
    45   oop obj = oopDesc::load_decode_heap_oop(p);
    44 #ifdef ASSERT
    46 #ifdef ASSERT
    45   // can't do because of races
    47   // can't do because of races
    46   // assert(obj == NULL || obj->is_oop(), "expected an oop");
    48   // assert(obj == NULL || obj->is_oop(), "expected an oop");
    47 
    49 
    75       _cset_rs_update_cl[tid]->do_oop(p);
    77       _cset_rs_update_cl[tid]->do_oop(p);
    76 
    78 
    77       // Deferred updates to the CSet are either discarded (in the normal case),
    79       // Deferred updates to the CSet are either discarded (in the normal case),
    78       // or processed (if an evacuation failure occurs) at the end
    80       // or processed (if an evacuation failure occurs) at the end
    79       // of the collection.
    81       // of the collection.
    80       // See HRInto_G1RemSet::cleanup_after_oops_into_collection_set_do().
    82       // See G1RemSet::cleanup_after_oops_into_collection_set_do().
    81     } else {
    83     } else {
    82 #if G1_REM_SET_LOGGING
    84 #if G1_REM_SET_LOGGING
    83       gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS"
    85       gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS"
    84                              " for region [" PTR_FORMAT ", " PTR_FORMAT ")",
    86                              " for region [" PTR_FORMAT ", " PTR_FORMAT ")",
    85                              p, obj,
    87                              p, obj,
    89       to->rem_set()->add_reference(p, tid);
    91       to->rem_set()->add_reference(p, tid);
    90     }
    92     }
    91   }
    93   }
    92 }
    94 }
    93 
    95 
    94 template <class T> inline void UpdateRSOopClosure::do_oop_work(T* p) {
    96 template <class T>
       
    97 inline void UpdateRSOopClosure::do_oop_work(T* p) {
    95   assert(_from != NULL, "from region must be non-NULL");
    98   assert(_from != NULL, "from region must be non-NULL");
    96   _rs->par_write_ref(_from, p, _worker_i);
    99   _rs->par_write_ref(_from, p, _worker_i);
    97 }
   100 }
    98 
   101 
    99 template <class T> inline void UpdateRSetImmediate::do_oop_work(T* p) {
   102 template <class T>
       
   103 inline void UpdateRSetImmediate::do_oop_work(T* p) {
   100   assert(_from->is_in_reserved(p), "paranoia");
   104   assert(_from->is_in_reserved(p), "paranoia");
   101   T heap_oop = oopDesc::load_heap_oop(p);
   105   T heap_oop = oopDesc::load_heap_oop(p);
   102   if (!oopDesc::is_null(heap_oop) && !_from->is_survivor()) {
   106   if (!oopDesc::is_null(heap_oop) && !_from->is_survivor()) {
   103     _g1_rem_set->par_write_ref(_from, p, 0);
   107     _g1_rem_set->par_write_ref(_from, p, 0);
   104   }
   108   }