< prev index next >

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

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

@@ -126,11 +126,11 @@
       set_slow_path_end(NULL);
     }
   }
   assert(!(retire || ZeroTLAB)  ||
          (start() == NULL && end() == NULL && top() == NULL &&
-          actual_end() == NULL && slow_path_end() == NULL),
+          _actual_end == NULL && _slow_path_end == NULL),
          "TLAB must be reset");
 }
 
 void ThreadLocalAllocBuffer::resize_all_tlabs() {
   if (ResizeTLAB) {

@@ -177,11 +177,11 @@
 
   // Remember old bytes until sample for the next tlab only if this is our first
   // actual refill.
   size_t old_bytes_until_sample = 0;
   if (_number_of_refills > 1) {
-    old_bytes_until_sample = bytes_until_sample();
+    old_bytes_until_sample = _bytes_until_sample;
   }
 
   initialize(start, top, start + new_size - alignment_reserve());
 
   if (old_bytes_until_sample > 0) {

@@ -324,12 +324,12 @@
   }
   guarantee(p == top(), "end of last object must match end of space");
 }
 
 void ThreadLocalAllocBuffer::set_sample_end() {
-  size_t heap_words_remaining = _end - _top;
-  size_t bytes_left = bytes_until_sample();
+  size_t heap_words_remaining = pointer_delta(_end, _top);
+  size_t bytes_left = _bytes_until_sample;
   size_t words_until_sample = bytes_left / HeapWordSize;
 
   if (heap_words_remaining > words_until_sample) {
     HeapWord* new_end = _top + words_until_sample;
     set_end(new_end);

@@ -339,33 +339,34 @@
     bytes_left -= heap_words_remaining * HeapWordSize;
     set_bytes_until_sample(bytes_left);
   }
 }
 
-void ThreadLocalAllocBuffer::pick_next_sample(size_t diff) {
+void ThreadLocalAllocBuffer::pick_next_sample(size_t overflowed_words) {
   if (!HeapMonitoring::enabled()) {
     return;
   }
 
-  if (bytes_until_sample() == 0) {
-    HeapMonitoring::pick_next_sample(bytes_until_sample_addr());
+  if (_bytes_until_sample == 0) {
+    HeapMonitoring::pick_next_sample(&_bytes_until_sample);
   }
 
-  if (diff > 0) {
+  if (overflowed_words > 0) {
     // Try to correct sample size by removing extra space from last allocation.
-    if (bytes_until_sample() > diff * HeapWordSize) {
-      set_bytes_until_sample(bytes_until_sample() - diff * HeapWordSize);
+    if (_bytes_until_sample > overflowed_words * HeapWordSize) {
+      set_bytes_until_sample(_bytes_until_sample - overflowed_words * HeapWordSize);
     }
   }
 
   set_sample_end();
 
   log_trace(gc, tlab)("TLAB picked next sample: thread: " INTPTR_FORMAT " [id: %2d]"
-                      " start: %p  top: %p end: %p actual_end: %p slow_path_end: %p",
+                      " start: " INTPTR_FORMAT " top: " INTPTR_FORMAT " end: " INTPTR_FORMAT " actual_end:"
+                      INTPTR_FORMAT " slow_path_end: " INTPTR_FORMAT,
                       p2i(myThread()), myThread()->osthread()->thread_id(),
-                      start(), top(), end(),
-                      actual_end(), slow_path_end());
+                      p2i(start()), p2i(top()), p2i(end()),
+                      p2i(_actual_end), p2i(_slow_path_end));
 }
 
 Thread* ThreadLocalAllocBuffer::myThread() {
   return (Thread*)(((char *)this) +
                    in_bytes(start_offset()) -

@@ -388,12 +389,12 @@
   if (!HeapMonitoring::enabled()) {
     return;
   }
 
   size_t size_in_bytes = size * HeapWordSize;
-  if (bytes_until_sample() > size_in_bytes) {
-    set_bytes_until_sample(bytes_until_sample() - size_in_bytes);
+  if (_bytes_until_sample > size_in_bytes) {
+    set_bytes_until_sample(_bytes_until_sample - size_in_bytes);
   } else {
     // Technically this is not exactly right, we probably should remember how many bytes are
     // negative probably to then reduce our next sample size.
     set_bytes_until_sample(0);
   }
< prev index next >