< prev index next >

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

Print this page
rev 48920 : [backport] Use PLAB for evacuations instead of TLAB

@@ -52,12 +52,10 @@
   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
     thread->tlab().accumulate_statistics();
     thread->tlab().initialize_statistics();
   }
 
-  Universe::heap()->accumulate_statistics_all_gclabs();
-
   // Publish new stats if some allocation occurred.
   if (global_stats()->allocation() != 0) {
     global_stats()->publish();
     global_stats()->print();
   }

@@ -67,11 +65,11 @@
   Thread* thread = myThread();
   size_t capacity = Universe::heap()->tlab_capacity(thread);
   size_t used     = Universe::heap()->tlab_used(thread);
 
   _gc_waste += (unsigned)remaining();
-  size_t total_allocated = _gclab ? thread->allocated_bytes_gclab() : thread->allocated_bytes();
+  size_t total_allocated = thread->allocated_bytes();
   size_t allocated_since_last_gc = total_allocated - _allocated_before_last_gc;
   _allocated_before_last_gc = total_allocated;
 
   print_stats("gc");
 

@@ -112,16 +110,12 @@
 void ThreadLocalAllocBuffer::make_parsable(bool retire, bool zap) {
   if (end() != NULL) {
     invariants();
 
     if (retire) {
-      if (_gclab) {
-        myThread()->incr_allocated_bytes_gclab(used_bytes());
-      } else {
         myThread()->incr_allocated_bytes(used_bytes());
       }
-    }
 
     HeapWord* obj = Universe::heap()->tlab_post_allocation_setup(top());
     CollectedHeap::fill_with_object(obj, hard_end(), retire && zap);
 
     if (retire || ZeroTLAB) {  // "Reset" the TLAB

@@ -192,13 +186,11 @@
   set_pf_top(top);
   set_end(end);
   invariants();
 }
 
-void ThreadLocalAllocBuffer::initialize(bool gclab) {
-  _initialized = true;
-  _gclab = gclab;
+void ThreadLocalAllocBuffer::initialize() {
   initialize(NULL,                    // start
              NULL,                    // top
              NULL);                   // end
 
   set_desired_size(initial_desired_size());

@@ -251,12 +243,11 @@
 #endif
 
   // During jvm startup, the main thread is initialized
   // before the heap is initialized.  So reinitialize it now.
   guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread");
-  Thread::current()->tlab().initialize(false);
-  Thread::current()->gclab().initialize(true);
+  Thread::current()->tlab().initialize();
 
   log_develop_trace(gc, tlab)("TLAB min: " SIZE_FORMAT " initial: " SIZE_FORMAT " max: " SIZE_FORMAT,
                                min_size(), Thread::current()->tlab().initial_desired_size(), max_size());
 }
 

@@ -315,31 +306,13 @@
   }
   guarantee(p == top(), "end of last object must match end of space");
 }
 
 Thread* ThreadLocalAllocBuffer::myThread() {
-  ByteSize gclab_offset = Thread::gclab_start_offset();
-  ByteSize tlab_offset = Thread::tlab_start_offset();
-  ByteSize offs = _gclab ? gclab_offset : tlab_offset;
-  Thread* thread = (Thread*)(((char *)this) +
-                   in_bytes(start_offset()) - in_bytes(offs));
-#ifdef ASSERT
-  assert(this == (_gclab ? &thread->gclab() : &thread->tlab()), "must be");
-#endif
-  return thread;
-}
-
-size_t ThreadLocalAllocBuffer::end_reserve() {
-  int reserve_size = typeArrayOopDesc::header_size(T_INT);
-  return MAX2(reserve_size, _reserve_for_allocation_prefetch);
-}
-
-void ThreadLocalAllocBuffer::rollback(size_t size) {
-  HeapWord* old_top = top();
-  if (old_top != NULL) { // Pathological case: we accept that we can't rollback.
-    set_top(old_top - size);
-  }
+  return (Thread*)(((char *)this) +
+                   in_bytes(start_offset()) -
+                   in_bytes(Thread::tlab_start_offset()));
 }
 
 
 GlobalTLABStats::GlobalTLABStats() :
   _allocating_threads_avg(TLABAllocationWeight) {
< prev index next >