< prev index next >

src/hotspot/share/gc/shared/collectedHeap.cpp

Print this page
rev 47590 : [mq]: heap8
rev 47591 : [mq]: heap10a
rev 47592 : [mq]: heap14_rebased

@@ -289,17 +289,17 @@
 }
 #endif
 
 
 void CollectedHeap::sample_allocation(Thread* thread, HeapWord* obj,
-                                      size_t size, size_t fix_sample_rate) {
+                                      size_t size, size_t overflowed_words) {
   // Object is allocated, sample it now.
   HeapMonitoring::object_alloc_do_sample(thread,
                                          reinterpret_cast<oopDesc*>(obj),
                                          size * HeapWordSize);
   // Pick a next sample in this case, we allocated right.
-  thread->tlab().pick_next_sample(fix_sample_rate);
+  thread->tlab().pick_next_sample(overflowed_words);
 }
 
 HeapWord* CollectedHeap::allocate_sampled_object(Thread* thread, size_t size) {
   thread->tlab().set_back_actual_end();
 

@@ -307,25 +307,25 @@
   return thread->tlab().allocate(size);
 }
 
 HeapWord* CollectedHeap::allocate_from_tlab_slow(Klass* klass, Thread* thread, size_t size) {
   // In case the tlab changes, remember if this one wanted a sample.
-  bool should_sample = thread->tlab().should_sample() && HeapMonitoring::enabled();
+  bool should_sample = HeapMonitoring::enabled() && thread->tlab().should_sample();
 
   HeapWord* obj = NULL;
   if (should_sample) {
     // Remember the tlab end to fix up the sampling rate.
     HeapWord *tlab_old_end = thread->tlab().end();
     obj = allocate_sampled_object(thread, size);
 
     // If we did allocate in this tlab, sample it. Otherwise, we wait for the
     // new tlab's first allocation at the end of this method.
     if (obj != NULL) {
-      // Fix sample rate by removing the extra bytes allocated in this last
+      // Fix sample rate by removing the extra words allocated in this last
       // sample.
-      size_t fix_sample_rate = thread->tlab().top() - tlab_old_end;
-      sample_allocation(thread, obj, size, fix_sample_rate);
+      size_t overflowed_words = pointer_delta(thread->tlab().top(), tlab_old_end);
+      sample_allocation(thread, obj, size, overflowed_words);
       return obj;
     }
   }
 
   // Retain tlab and allocate object in shared space if
< prev index next >