< prev index next >

src/hotspot/share/gc/parallel/psCardTable.cpp

Print this page




  29 #include "gc/parallel/psPromotionManager.inline.hpp"
  30 #include "gc/parallel/psScavenge.inline.hpp"
  31 #include "gc/parallel/psYoungGen.hpp"
  32 #include "memory/iterator.inline.hpp"
  33 #include "oops/access.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "runtime/prefetch.inline.hpp"
  36 #include "utilities/align.hpp"
  37 
  38 // Checks an individual oop for missing precise marks. Mark
  39 // may be either dirty or newgen.
  40 class CheckForUnmarkedOops : public BasicOopIterateClosure {
  41  private:
  42   PSYoungGen*  _young_gen;
  43   PSCardTable* _card_table;
  44   HeapWord*    _unmarked_addr;
  45 
  46  protected:
  47   template <class T> void do_oop_work(T* p) {
  48     oop obj = RawAccess<>::oop_load(p);


  49     if (_young_gen->is_in_reserved(obj) &&
  50         !_card_table->addr_is_marked_imprecise(p)) {
  51       // Don't overwrite the first missing card mark
  52       if (_unmarked_addr == NULL) {
  53         _unmarked_addr = (HeapWord*)p;
  54       }
  55     }
  56   }
  57 
  58  public:
  59   CheckForUnmarkedOops(PSYoungGen* young_gen, PSCardTable* card_table) :
  60     _young_gen(young_gen), _card_table(card_table), _unmarked_addr(NULL) { }
  61 
  62   virtual void do_oop(oop* p)       { CheckForUnmarkedOops::do_oop_work(p); }
  63   virtual void do_oop(narrowOop* p) { CheckForUnmarkedOops::do_oop_work(p); }
  64 
  65   bool has_unmarked_oop() {
  66     return _unmarked_addr != NULL;
  67   }
  68 };


  86   // we test for missing precise marks first. If any are found, we don't
  87   // fail unless the object head is also unmarked.
  88   virtual void do_object(oop obj) {
  89     CheckForUnmarkedOops object_check(_young_gen, _card_table);
  90     obj->oop_iterate(&object_check);
  91     if (object_check.has_unmarked_oop()) {
  92       guarantee(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
  93     }
  94   }
  95 };
  96 
  97 // Checks for precise marking of oops as newgen.
  98 class CheckForPreciseMarks : public BasicOopIterateClosure {
  99  private:
 100   PSYoungGen*  _young_gen;
 101   PSCardTable* _card_table;
 102 
 103  protected:
 104   template <class T> void do_oop_work(T* p) {
 105     oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);


 106     if (_young_gen->is_in_reserved(obj)) {
 107       assert(_card_table->addr_is_marked_precise(p), "Found unmarked precise oop");
 108       _card_table->set_card_newgen(p);
 109     }
 110   }
 111 
 112  public:
 113   CheckForPreciseMarks(PSYoungGen* young_gen, PSCardTable* card_table) :
 114     _young_gen(young_gen), _card_table(card_table) { }
 115 
 116   virtual void do_oop(oop* p)       { CheckForPreciseMarks::do_oop_work(p); }
 117   virtual void do_oop(narrowOop* p) { CheckForPreciseMarks::do_oop_work(p); }
 118 };
 119 
 120 // We get passed the space_top value to prevent us from traversing into
 121 // the old_gen promotion labs, which cannot be safely parsed.
 122 
 123 // Do not call this method if the space is empty.
 124 // It is a waste to start tasks and get here only to
 125 // do no work.  If this method needs to be called




  29 #include "gc/parallel/psPromotionManager.inline.hpp"
  30 #include "gc/parallel/psScavenge.inline.hpp"
  31 #include "gc/parallel/psYoungGen.hpp"
  32 #include "memory/iterator.inline.hpp"
  33 #include "oops/access.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "runtime/prefetch.inline.hpp"
  36 #include "utilities/align.hpp"
  37 
  38 // Checks an individual oop for missing precise marks. Mark
  39 // may be either dirty or newgen.
  40 class CheckForUnmarkedOops : public BasicOopIterateClosure {
  41  private:
  42   PSYoungGen*  _young_gen;
  43   PSCardTable* _card_table;
  44   HeapWord*    _unmarked_addr;
  45 
  46  protected:
  47   template <class T> void do_oop_work(T* p) {
  48     oop obj = RawAccess<>::oop_load(p);
  49     assert_object_is_in_heap_or_null(p, obj);
  50 
  51     if (_young_gen->is_in_reserved(obj) &&
  52         !_card_table->addr_is_marked_imprecise(p)) {
  53       // Don't overwrite the first missing card mark
  54       if (_unmarked_addr == NULL) {
  55         _unmarked_addr = (HeapWord*)p;
  56       }
  57     }
  58   }
  59 
  60  public:
  61   CheckForUnmarkedOops(PSYoungGen* young_gen, PSCardTable* card_table) :
  62     _young_gen(young_gen), _card_table(card_table), _unmarked_addr(NULL) { }
  63 
  64   virtual void do_oop(oop* p)       { CheckForUnmarkedOops::do_oop_work(p); }
  65   virtual void do_oop(narrowOop* p) { CheckForUnmarkedOops::do_oop_work(p); }
  66 
  67   bool has_unmarked_oop() {
  68     return _unmarked_addr != NULL;
  69   }
  70 };


  88   // we test for missing precise marks first. If any are found, we don't
  89   // fail unless the object head is also unmarked.
  90   virtual void do_object(oop obj) {
  91     CheckForUnmarkedOops object_check(_young_gen, _card_table);
  92     obj->oop_iterate(&object_check);
  93     if (object_check.has_unmarked_oop()) {
  94       guarantee(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
  95     }
  96   }
  97 };
  98 
  99 // Checks for precise marking of oops as newgen.
 100 class CheckForPreciseMarks : public BasicOopIterateClosure {
 101  private:
 102   PSYoungGen*  _young_gen;
 103   PSCardTable* _card_table;
 104 
 105  protected:
 106   template <class T> void do_oop_work(T* p) {
 107     oop obj = RawAccess<IS_NOT_NULL>::oop_load(p);
 108     assert_object_is_in_heap_or_null(p, obj);
 109 
 110     if (_young_gen->is_in_reserved(obj)) {
 111       assert(_card_table->addr_is_marked_precise(p), "Found unmarked precise oop");
 112       _card_table->set_card_newgen(p);
 113     }
 114   }
 115 
 116  public:
 117   CheckForPreciseMarks(PSYoungGen* young_gen, PSCardTable* card_table) :
 118     _young_gen(young_gen), _card_table(card_table) { }
 119 
 120   virtual void do_oop(oop* p)       { CheckForPreciseMarks::do_oop_work(p); }
 121   virtual void do_oop(narrowOop* p) { CheckForPreciseMarks::do_oop_work(p); }
 122 };
 123 
 124 // We get passed the space_top value to prevent us from traversing into
 125 // the old_gen promotion labs, which cannot be safely parsed.
 126 
 127 // Do not call this method if the space is empty.
 128 // It is a waste to start tasks and get here only to
 129 // do no work.  If this method needs to be called


< prev index next >