src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page

        

@@ -4478,35 +4478,44 @@
     _preserved_marks_of_objs.push(m);
   }
 }
 
 HeapWord* G1CollectedHeap::par_allocate_during_gc(GCAllocPurpose purpose,
-                                                  size_t word_size) {
+                                                  size_t word_size, 
+                                                  oop const old,
+                                                  uint age) {
+  
+  HeapWord* result = NULL;
+  
   if (purpose == GCAllocForSurvived) {
-    HeapWord* result = survivor_attempt_allocation(word_size);
+    result = survivor_attempt_allocation(word_size);
     if (result != NULL) {
-      return result;
+      _g1h->_gc_tracer_stw->report_promotion_to_new_plab(old, age, false, word_size);
     } else {
       // Let's try to allocate in the old gen in case we can fit the
       // object there.
-      return old_attempt_allocation(word_size);
+      result = old_attempt_allocation(word_size);
+      if (result != NULL) {
+        _g1h->_gc_tracer_stw->report_promotion_to_new_plab(old, age, true, word_size);
+      }
     }
   } else {
     assert(purpose ==  GCAllocForTenured, "sanity");
-    HeapWord* result = old_attempt_allocation(word_size);
+    result = old_attempt_allocation(word_size);
     if (result != NULL) {
-      return result;
+      _g1h->_gc_tracer_stw->report_promotion_to_new_plab(old, age, true, word_size);
     } else {
       // Let's try to allocate in the survivors in case we can fit the
       // object there.
-      return survivor_attempt_allocation(word_size);
+      result = survivor_attempt_allocation(word_size);
+      if (result != NULL) {
+        _g1h->_gc_tracer_stw->report_promotion_to_new_plab(old, age, false, word_size);
+      }
     }
   }
 
-  ShouldNotReachHere();
-  // Trying to keep some compilers happy.
-  return NULL;
+  return result;
 }
 
 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) :
   ParGCAllocBuffer(gclab_word_size), _retired(true) { }