< prev index next >

src/share/vm/gc/shared/genOopClosures.inline.hpp

Print this page




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_SHARED_GENOOPCLOSURES_INLINE_HPP
  26 #define SHARE_VM_GC_SHARED_GENOOPCLOSURES_INLINE_HPP
  27 
  28 #include "gc/serial/defNewGeneration.hpp"
  29 #include "gc/shared/cardTableRS.hpp"
  30 #include "gc/shared/genCollectedHeap.hpp"
  31 #include "gc/shared/genOopClosures.hpp"
  32 #include "gc/shared/genRemSet.hpp"
  33 #include "gc/shared/generation.hpp"
  34 #include "gc/shared/space.hpp"
  35 
  36 inline OopsInGenClosure::OopsInGenClosure(Generation* gen) :
  37   ExtendedOopClosure(gen->ref_processor()), _orig_gen(gen), _rs(NULL) {
  38   set_generation(gen);
  39 }
  40 
  41 inline void OopsInGenClosure::set_generation(Generation* gen) {

  42   _gen = gen;
  43   _gen_boundary = _gen->reserved().start();
  44   // Barrier set for the heap, must be set after heap is initialized
  45   if (_rs == NULL) {
  46     GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
  47     _rs = (CardTableRS*)rs;
  48   }
  49 }
  50 




  51 template <class T> inline void OopsInGenClosure::do_barrier(T* p) {
  52   assert(generation()->is_in_reserved(p), "expected ref in generation");
  53   T heap_oop = oopDesc::load_heap_oop(p);
  54   assert(!oopDesc::is_null(heap_oop), "expected non-null oop");
  55   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
  56   // If p points to a younger generation, mark the card.
  57   if ((HeapWord*)obj < _gen_boundary) {
  58     _rs->inline_write_ref_field_gc(p, obj);
  59   }
  60 }
  61 
  62 template <class T> inline void OopsInGenClosure::par_do_barrier(T* p) {
  63   assert(generation()->is_in_reserved(p), "expected ref in generation");
  64   T heap_oop = oopDesc::load_heap_oop(p);
  65   assert(!oopDesc::is_null(heap_oop), "expected non-null oop");
  66   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
  67   // If p points to a younger generation, mark the card.
  68   if ((HeapWord*)obj < gen_boundary()) {
  69     rs()->write_ref_field_gc_par(p, obj);
  70   }




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_SHARED_GENOOPCLOSURES_INLINE_HPP
  26 #define SHARE_VM_GC_SHARED_GENOOPCLOSURES_INLINE_HPP
  27 
  28 #include "gc/serial/defNewGeneration.hpp"
  29 #include "gc/shared/cardTableRS.hpp"
  30 #include "gc/shared/genCollectedHeap.hpp"
  31 #include "gc/shared/genOopClosures.hpp"
  32 #include "gc/shared/genRemSet.hpp"
  33 #include "gc/shared/generation.hpp"
  34 #include "gc/shared/space.hpp"
  35 
  36 inline OopsInGenClosure::OopsInGenClosure(Generation* gen) :
  37   ExtendedOopClosure(gen->ref_processor()), _gen(NULL), _rs(NULL) {
  38   set_generation(gen);
  39 }
  40 
  41 inline void OopsInGenClosure::set_generation(Generation* gen) {
  42   assert(_gen == NULL, "Generation already initialized");
  43   _gen = gen;
  44   _gen_boundary = _gen->reserved().start();
  45   // Barrier set for the heap, must be set after heap is initialized
  46   if (_rs == NULL) {
  47     GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
  48     _rs = (CardTableRS*)rs;
  49   }
  50 }
  51 
  52 inline void OopsInGenClosure::assert_generation(Generation* gen) {
  53   assert(_gen == gen, "Generations mismatch. Fix it now!!");
  54 }
  55 
  56 template <class T> inline void OopsInGenClosure::do_barrier(T* p) {
  57   assert(generation()->is_in_reserved(p), "expected ref in generation");
  58   T heap_oop = oopDesc::load_heap_oop(p);
  59   assert(!oopDesc::is_null(heap_oop), "expected non-null oop");
  60   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
  61   // If p points to a younger generation, mark the card.
  62   if ((HeapWord*)obj < _gen_boundary) {
  63     _rs->inline_write_ref_field_gc(p, obj);
  64   }
  65 }
  66 
  67 template <class T> inline void OopsInGenClosure::par_do_barrier(T* p) {
  68   assert(generation()->is_in_reserved(p), "expected ref in generation");
  69   T heap_oop = oopDesc::load_heap_oop(p);
  70   assert(!oopDesc::is_null(heap_oop), "expected non-null oop");
  71   oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
  72   // If p points to a younger generation, mark the card.
  73   if ((HeapWord*)obj < gen_boundary()) {
  74     rs()->write_ref_field_gc_par(p, obj);
  75   }


< prev index next >