diff src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents a2f7274eb6ef
children 859cd1a76f8a
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Aug 31 16:39:35 2012 -0700
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Sat Sep 01 13:25:18 2012 -0400
@@ -315,9 +315,7 @@
 }
 
 bool ConcurrentMark::not_yet_marked(oop obj) const {
-  return (_g1h->is_obj_ill(obj)
-          || (_g1h->is_in_permanent(obj)
-              && !nextMarkBitMap()->isMarked((HeapWord*)obj)));
+  return _g1h->is_obj_ill(obj);
 }
 
 CMRootRegions::CMRootRegions() :
@@ -1207,7 +1205,8 @@
     } else {
       assert(last_idx < _card_bm->size(), "sanity");
       // Note BitMap::par_at_put_range() is exclusive.
-      _card_bm->par_at_put_range(start_idx, last_idx+1, true);
+      BitMap::idx_t max_idx = MAX2(last_idx+1, _card_bm->size());
+      _card_bm->par_at_put_range(start_idx, max_idx, true);
     }
   }
 
@@ -1553,8 +1552,21 @@
 
     // Now set the bits for [ntams, top]
     BitMap::idx_t start_idx = _cm->card_bitmap_index_for(ntams);
-    BitMap::idx_t last_idx = _cm->card_bitmap_index_for(top);
+    // set_card_bitmap_range() expects the last_idx to be with
+    // the range of the bit map (see assertion in set_card_bitmap_range()),
+    // so limit it to that range with this application of MIN2.
+    BitMap::idx_t last_idx = MIN2(_cm->card_bitmap_index_for(top),
+                                  _card_bm->size()-1);
+    if (start_idx < _card_bm->size()) {
     set_card_bitmap_range(start_idx, last_idx);
+    } else {
+      // To reach here start_idx must be beyond the end of
+      // the bit map and last_idx must have been limited by
+      // the MIN2().
+      assert(start_idx == last_idx + 1,
+        err_msg("Not beyond end start_idx " SIZE_FORMAT " last_idx "
+                SIZE_FORMAT, start_idx, last_idx));
+    }
 
     // Set the bit for the region if it contains live data
     if (hr->next_marked_bytes() > 0) {
@@ -2011,7 +2023,7 @@
          (!_g1->is_in_g1_reserved(addr) || !_g1->is_obj_ill(obj));
 }
 
-class G1CMKeepAliveClosure: public OopClosure {
+class G1CMKeepAliveClosure: public ExtendedOopClosure {
   G1CollectedHeap* _g1;
   ConcurrentMark*  _cm;
  public:
@@ -2052,7 +2064,7 @@
     _oopClosure(oopClosure) { }
 
   void do_void() {
-    _markStack->drain((OopClosure*)_oopClosure, _cm->nextMarkBitMap(), false);
+    _markStack->drain(_oopClosure, _cm->nextMarkBitMap(), false);
   }
 };
 
@@ -2494,7 +2506,7 @@
       _out->print_cr(" "PTR_FORMAT"%s",
                      o, (over_tams) ? " >" : (marked) ? " M" : "");
       PrintReachableOopClosure oopCl(_out, _vo, _all);
-      o->oop_iterate(&oopCl);
+      o->oop_iterate_no_header(&oopCl);
     }
   }
 };