diff src/share/vm/gc_implementation/g1/heapRegion.cpp @ 1718:bb847e31b836

6974928: G1: sometimes humongous objects are allocated in young regions Summary: as the title says, sometimes we are allocating humongous objects in young regions and we shouldn't. Reviewed-by: ysr, johnc
author tonyp
date Tue, 17 Aug 2010 14:40:00 -0400
parents 2d160770d2e5
children 72a161e62cc4
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/heapRegion.cpp	Tue Aug 17 14:40:00 2010 -0400
+++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp	Tue Aug 17 14:40:00 2010 -0400
@@ -790,8 +790,18 @@
   int objs = 0;
   int blocks = 0;
   VerifyLiveClosure vl_cl(g1, use_prev_marking);
+  bool is_humongous = isHumongous();
+  size_t object_num = 0;
   while (p < top()) {
     size_t size = oop(p)->size();
+    if (is_humongous != g1->isHumongous(size)) {
+      gclog_or_tty->print_cr("obj "PTR_FORMAT" is of %shumongous size ("
+                             SIZE_FORMAT" words) in a %shumongous region",
+                             p, g1->isHumongous(size) ? "" : "non-",
+                             size, is_humongous ? "" : "non-");
+       *failures = true;
+    }
+    object_num += 1;
     if (blocks == BLOCK_SAMPLE_INTERVAL) {
       HeapWord* res = block_start_const(p + (size/2));
       if (p != res) {
@@ -857,6 +867,13 @@
     }
   }
 
+  if (is_humongous && object_num > 1) {
+    gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous "
+                           "but has "SIZE_FORMAT", objects",
+                           bottom(), end(), object_num);
+    *failures = true;
+  }
+
   if (p != top()) {
     gclog_or_tty->print_cr("end of last object "PTR_FORMAT" "
                            "does not match top "PTR_FORMAT, p, top());