Merge
authormgerdin
Wed, 13 Apr 2016 13:53:05 +0200
changeset 37472 4eea82a66dab
parent 37470 d668bb1f3633 (current diff)
parent 37471 6ba3e52c2bd6 (diff)
child 37473 8af1deb0c879
child 37475 0da78fa10d78
Merge
--- a/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp	Wed Apr 13 12:11:06 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp	Wed Apr 13 13:53:05 2016 +0200
@@ -206,8 +206,14 @@
       return 0;
     }
     if (hr->is_humongous()) {
-      mark_card_bitmap_range(start, hr->top());
-      return pointer_delta(hr->top(), start, 1);
+      HeapRegion* start_region = hr->humongous_start_region();
+      if (mark_bitmap->isMarked(start_region->bottom())) {
+        mark_card_bitmap_range(start, hr->top());
+        return pointer_delta(hr->top(), start, 1);
+      } else {
+        // Humongous start object was actually dead.
+        return 0;
+      }
     }
 
     assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Apr 13 12:11:06 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Apr 13 13:53:05 2016 +0200
@@ -2946,13 +2946,17 @@
       : rset->is_empty();
   }
 
-  bool is_typeArray_region(HeapRegion* region) const {
-    return oop(region->bottom())->is_typeArray();
-  }
-
   bool humongous_region_is_candidate(G1CollectedHeap* heap, HeapRegion* region) const {
     assert(region->is_starts_humongous(), "Must start a humongous object");
 
+    oop obj = oop(region->bottom());
+
+    // Dead objects cannot be eager reclaim candidates. Due to class
+    // unloading it is unsafe to query their classes so we return early.
+    if (heap->is_obj_dead(obj, region)) {
+      return false;
+    }
+
     // Candidate selection must satisfy the following constraints
     // while concurrent marking is in progress:
     //
@@ -2989,7 +2993,7 @@
     // important use case for eager reclaim, and this special handling
     // may reduce needed headroom.
 
-    return is_typeArray_region(region) && is_remset_small(region);
+    return obj->is_typeArray() && is_remset_small(region);
   }
 
  public: