src/share/vm/memory/tenuredGeneration.cpp

Print this page

        

@@ -25,10 +25,11 @@
 #include "precompiled.hpp"
 #include "gc_implementation/shared/collectorCounters.hpp"
 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/blockOffsetTable.inline.hpp"
+#include "memory/defNewGeneration.hpp"
 #include "memory/generation.inline.hpp"
 #include "memory/generationSpec.hpp"
 #include "memory/space.hpp"
 #include "memory/tenuredGeneration.hpp"
 #include "oops/oop.inline.hpp"

@@ -198,16 +199,16 @@
   }
 }
 
 
 #if INCLUDE_ALL_GCS
-oop TenuredGeneration::par_promote(int thread_num,
+oop TenuredGeneration::par_promote(const ParNewTracer* gc_tracer,
+                                   int thread_num,
                                    oop old, markOop m, size_t word_sz) {
 
   ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
   HeapWord* obj_ptr = buf->allocate(word_sz);
-  bool is_lab = true;
   if (obj_ptr == NULL) {
 #ifndef PRODUCT
     if (Universe::heap()->promotion_should_fail()) {
       return NULL;
     }

@@ -224,20 +225,33 @@
       }
       if (buf_space != NULL) {
         buf->retire(false, false);
         buf->set_buf(buf_space);
         obj_ptr = buf->allocate(word_sz);
+        if (gc_tracer->should_report_promotion_in_new_plab_event()) {
+          uint age = m->has_displaced_mark_helper() ?
+                       m->displaced_mark_helper()->age() :
+                       m->age();
+          gc_tracer->report_promotion_in_new_plab_event(old, word_sz, age, true, 
+                                                        buf->word_sz());
+        }
         assert(obj_ptr != NULL, "Buffer was definitely big enough...");
       }
     };
     // Otherwise, buffer allocation failed; try allocating object
     // individually.
     if (obj_ptr == NULL) {
       obj_ptr = TenuredGeneration::par_allocate(word_sz, false);
       if (obj_ptr == NULL) {
         obj_ptr = expand_and_allocate(word_sz, false, true /* parallel */);
       }
+      if (gc_tracer->should_report_promotion_outside_plab_event()) {
+        uint age = m->has_displaced_mark_helper() ?
+                     m->displaced_mark_helper()->age() :
+                     m->age();
+        gc_tracer->report_promotion_outside_plab_event(old, word_sz, age, true);
+      }
     }
     if (obj_ptr == NULL) return NULL;
   }
   assert(obj_ptr != NULL, "program logic");
   Copy::aligned_disjoint_words((HeapWord*)old, obj_ptr, word_sz);