< prev index next >

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

Print this page




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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 #include "precompiled.hpp"
  26 #include "gc/parallel/gcTaskManager.hpp"
  27 #include "gc/parallel/objectStartArray.inline.hpp"
  28 #include "gc/parallel/parallelScavengeHeap.inline.hpp"
  29 #include "gc/parallel/psCardTable.hpp"
  30 #include "gc/parallel/psPromotionManager.inline.hpp"
  31 #include "gc/parallel/psScavenge.hpp"
  32 #include "gc/parallel/psTasks.hpp"
  33 #include "gc/parallel/psYoungGen.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 OopClosure {
  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 = oopDesc::load_decode_heap_oop(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 };


  85   // a mismatch of precise marks and beginning of object marks. This means
  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_no_header(&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 OopClosure {
  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 = oopDesc::load_decode_heap_oop_not_null(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




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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 #include "precompiled.hpp"
  26 #include "gc/parallel/gcTaskManager.hpp"
  27 #include "gc/parallel/objectStartArray.inline.hpp"
  28 #include "gc/parallel/parallelScavengeHeap.inline.hpp"
  29 #include "gc/parallel/psCardTable.hpp"
  30 #include "gc/parallel/psPromotionManager.inline.hpp"
  31 #include "gc/parallel/psScavenge.hpp"
  32 #include "gc/parallel/psTasks.hpp"
  33 #include "gc/parallel/psYoungGen.hpp"
  34 #include "oops/access.inline.hpp"
  35 #include "oops/oop.inline.hpp"
  36 #include "runtime/prefetch.inline.hpp"
  37 #include "utilities/align.hpp"
  38 
  39 // Checks an individual oop for missing precise marks. Mark
  40 // may be either dirty or newgen.
  41 class CheckForUnmarkedOops : public OopClosure {
  42  private:
  43   PSYoungGen*  _young_gen;
  44   PSCardTable* _card_table;
  45   HeapWord*    _unmarked_addr;
  46 
  47  protected:
  48   template <class T> void do_oop_work(T* p) {
  49     oop obj = RawAccess<>::oop_load(p);
  50     if (_young_gen->is_in_reserved(obj) &&
  51         !_card_table->addr_is_marked_imprecise(p)) {
  52       // Don't overwrite the first missing card mark
  53       if (_unmarked_addr == NULL) {
  54         _unmarked_addr = (HeapWord*)p;
  55       }
  56     }
  57   }
  58 
  59  public:
  60   CheckForUnmarkedOops(PSYoungGen* young_gen, PSCardTable* card_table) :
  61     _young_gen(young_gen), _card_table(card_table), _unmarked_addr(NULL) { }
  62 
  63   virtual void do_oop(oop* p)       { CheckForUnmarkedOops::do_oop_work(p); }
  64   virtual void do_oop(narrowOop* p) { CheckForUnmarkedOops::do_oop_work(p); }
  65 
  66   bool has_unmarked_oop() {
  67     return _unmarked_addr != NULL;
  68   }
  69 };


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


< prev index next >