< prev index next >

src/share/vm/gc/g1/heapRegion.inline.hpp

Print this page
rev 13047 : imported patch 8071280-specialize-heapregion-oops-on-card-seq-iterate
rev 13048 : imported patch 8071280-kim-review
rev 13049 : imported patch 8071280-kim-sangheon-review
rev 13050 : imported patch 8071280-erikh-review

@@ -110,25 +110,26 @@
 inline HeapWord*
 G1ContiguousSpace::block_start_const(const void* p) const {
   return _bot_part.block_start_const(p);
 }
 
-template <bool is_gc_active>
-inline bool HeapRegion::is_obj_dead_with_size(const oop obj, G1CMBitMapRO* bitmap, size_t* size) const {
+inline bool HeapRegion::is_obj_dead_with_size(const oop obj, G1CMBitMapRO* prev_bitmap, size_t* size) const {
+  HeapWord* addr = (HeapWord*) obj;
+
+  assert(addr < top(), "must be");
   assert(!is_archive(), "Archive regions should not have references into interesting regions.");
   assert(!is_humongous(), "Humongous objects not handled here");
-  bool result =
-    !obj_allocated_since_prev_marking(obj) &&
-    !bitmap->isMarked((HeapWord*)obj);
-  if (ClassUnloadingWithConcurrentMark && result) {
-    *size = is_gc_active ? block_size_during_gc((HeapWord*)obj, bitmap)
-                         : block_size((HeapWord*)obj);
+  bool obj_is_dead = is_obj_dead(obj, prev_bitmap);
+
+  if (ClassUnloadingWithConcurrentMark && obj_is_dead) {
+    assert(!block_is_obj(addr), "must be");
+    *size = block_size_using_bitmap(addr, prev_bitmap);
   } else {
-    assert(block_is_obj((HeapWord*)obj), "must be");
+    assert(block_is_obj(addr), "must be");
     *size = obj->size();
   }
-  return result;
+  return obj_is_dead;
 }
 
 inline bool
 HeapRegion::block_is_obj(const HeapWord* p) const {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();

@@ -141,30 +142,28 @@
     return !g1h->is_obj_dead(oop(p), this);
   }
   return p < top();
 }
 
-inline size_t HeapRegion::block_size_using_bitmap(const HeapWord* addr, const G1CMBitMapRO* bitmap) const {
+inline size_t HeapRegion::block_size_using_bitmap(const HeapWord* addr, const G1CMBitMapRO* prev_bitmap) const {
   assert(ClassUnloadingWithConcurrentMark,
          "All blocks should be objects if class unloading isn't used, so this method should not be called. "
          "HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") "
          "addr: " PTR_FORMAT,
          p2i(bottom()), p2i(top()), p2i(end()), p2i(addr));
 
   // Old regions' dead objects may have dead classes
   // We need to find the next live object using the bitmap
-  HeapWord* next = bitmap->getNextMarkedWordAddress(addr, prev_top_at_mark_start());
+  HeapWord* next = prev_bitmap->getNextMarkedWordAddress(addr, prev_top_at_mark_start());
 
   assert(next > addr, "must get the next live object");
   return pointer_delta(next, addr);    
 }
 
-inline size_t HeapRegion::block_size_during_gc(const HeapWord *addr, const G1CMBitMapRO* bitmap) const {
-  assert(addr < top(), "must be");
-  assert(!block_is_obj(addr), "must be");
-
-  return block_size_using_bitmap(addr, bitmap);
+inline bool HeapRegion::is_obj_dead(const oop obj, const G1CMBitMapRO* prev_bitmap) const {
+  assert(is_in_reserved(obj), "Object " PTR_FORMAT " must be in region", p2i(obj));
+  return !obj_allocated_since_prev_marking(obj) && !prev_bitmap->isMarked((HeapWord*)obj);
 }
 
 inline size_t HeapRegion::block_size(const HeapWord *addr) const {
   if (addr == top()) {
     return pointer_delta(end(), addr);

@@ -337,11 +336,11 @@
     assert(obj->is_oop(true), "Not an oop at " PTR_FORMAT, p2i(cur));
     assert(obj->klass_or_null() != NULL,
            "Unparsable heap at " PTR_FORMAT, p2i(cur));
 
     size_t size;
-    bool is_dead = is_obj_dead_with_size<is_gc_active>(obj, bitmap, &size);
+    bool is_dead = is_obj_dead_with_size(obj, bitmap, &size);
 
     cur += size;
     if (!is_dead) {
       // Process live object's references.
 
< prev index next >