src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp

changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 631
d1605aabd0a1
child 698
12eea04c8b06
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Fri Apr 11 09:56:35 2008 -0400
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Sun Apr 13 17:43:42 2008 -0400
     1.3 @@ -28,17 +28,16 @@
     1.4  // Checks an individual oop for missing precise marks. Mark
     1.5  // may be either dirty or newgen.
     1.6  class CheckForUnmarkedOops : public OopClosure {
     1.7 -  PSYoungGen* _young_gen;
     1.8 + private:
     1.9 +  PSYoungGen*         _young_gen;
    1.10    CardTableExtension* _card_table;
    1.11 -  HeapWord* _unmarked_addr;
    1.12 -  jbyte* _unmarked_card;
    1.13 +  HeapWord*           _unmarked_addr;
    1.14 +  jbyte*              _unmarked_card;
    1.15  
    1.16 - public:
    1.17 -  CheckForUnmarkedOops( PSYoungGen* young_gen, CardTableExtension* card_table ) :
    1.18 -    _young_gen(young_gen), _card_table(card_table), _unmarked_addr(NULL) { }
    1.19 -
    1.20 -  virtual void do_oop(oop* p) {
    1.21 -    if (_young_gen->is_in_reserved(*p) &&
    1.22 + protected:
    1.23 +  template <class T> void do_oop_work(T* p) {
    1.24 +    oop obj = oopDesc::load_decode_heap_oop_not_null(p);
    1.25 +    if (_young_gen->is_in_reserved(obj) &&
    1.26          !_card_table->addr_is_marked_imprecise(p)) {
    1.27        // Don't overwrite the first missing card mark
    1.28        if (_unmarked_addr == NULL) {
    1.29 @@ -48,6 +47,13 @@
    1.30      }
    1.31    }
    1.32  
    1.33 + public:
    1.34 +  CheckForUnmarkedOops(PSYoungGen* young_gen, CardTableExtension* card_table) :
    1.35 +    _young_gen(young_gen), _card_table(card_table), _unmarked_addr(NULL) { }
    1.36 +
    1.37 +  virtual void do_oop(oop* p)       { CheckForUnmarkedOops::do_oop_work(p); }
    1.38 +  virtual void do_oop(narrowOop* p) { CheckForUnmarkedOops::do_oop_work(p); }
    1.39 +
    1.40    bool has_unmarked_oop() {
    1.41      return _unmarked_addr != NULL;
    1.42    }
    1.43 @@ -56,7 +62,8 @@
    1.44  // Checks all objects for the existance of some type of mark,
    1.45  // precise or imprecise, dirty or newgen.
    1.46  class CheckForUnmarkedObjects : public ObjectClosure {
    1.47 -  PSYoungGen* _young_gen;
    1.48 + private:
    1.49 +  PSYoungGen*         _young_gen;
    1.50    CardTableExtension* _card_table;
    1.51  
    1.52   public:
    1.53 @@ -75,7 +82,7 @@
    1.54    // we test for missing precise marks first. If any are found, we don't
    1.55    // fail unless the object head is also unmarked.
    1.56    virtual void do_object(oop obj) {
    1.57 -    CheckForUnmarkedOops object_check( _young_gen, _card_table );
    1.58 +    CheckForUnmarkedOops object_check(_young_gen, _card_table);
    1.59      obj->oop_iterate(&object_check);
    1.60      if (object_check.has_unmarked_oop()) {
    1.61        assert(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
    1.62 @@ -85,19 +92,25 @@
    1.63  
    1.64  // Checks for precise marking of oops as newgen.
    1.65  class CheckForPreciseMarks : public OopClosure {
    1.66 -  PSYoungGen* _young_gen;
    1.67 + private:
    1.68 +  PSYoungGen*         _young_gen;
    1.69    CardTableExtension* _card_table;
    1.70  
    1.71 + protected:
    1.72 +  template <class T> void do_oop_work(T* p) {
    1.73 +    oop obj = oopDesc::load_decode_heap_oop_not_null(p);
    1.74 +    if (_young_gen->is_in_reserved(obj)) {
    1.75 +      assert(_card_table->addr_is_marked_precise(p), "Found unmarked precise oop");
    1.76 +      _card_table->set_card_newgen(p);
    1.77 +    }
    1.78 +  }
    1.79 +
    1.80   public:
    1.81    CheckForPreciseMarks( PSYoungGen* young_gen, CardTableExtension* card_table ) :
    1.82      _young_gen(young_gen), _card_table(card_table) { }
    1.83  
    1.84 -  virtual void do_oop(oop* p) {
    1.85 -    if (_young_gen->is_in_reserved(*p)) {
    1.86 -      assert(_card_table->addr_is_marked_precise(p), "Found unmarked precise oop");
    1.87 -      _card_table->set_card_newgen(p);
    1.88 -    }
    1.89 -  }
    1.90 +  virtual void do_oop(oop* p)       { CheckForPreciseMarks::do_oop_work(p); }
    1.91 +  virtual void do_oop(narrowOop* p) { CheckForPreciseMarks::do_oop_work(p); }
    1.92  };
    1.93  
    1.94  // We get passed the space_top value to prevent us from traversing into

mercurial