< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp

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

@@ -24,10 +24,11 @@
 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHHEAP_INLINE_HPP
 
 #include "classfile/javaClasses.inline.hpp"
 #include "gc/shared/markBitMap.inline.hpp"
+#include "gc/shared/plab.hpp"
 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
 #include "gc/shared/suspendibleThreadSet.hpp"
 #include "gc/shenandoah/brooksPointer.inline.hpp"
 #include "gc/shenandoah/shenandoahAsserts.hpp"
 #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"

@@ -251,26 +252,23 @@
   _cancelled_concgc.set(CANCELLABLE);
   _oom_evac_handler.clear();
 }
 
 inline HeapWord* ShenandoahHeap::allocate_from_gclab(Thread* thread, size_t size) {
-  if (UseTLAB) {
-    if (!thread->gclab().is_initialized()) {
+  PLAB* gclab = thread->gclab();
+  if (gclab == NULL) {
       assert(!thread->is_Java_thread() && !thread->is_Worker_thread(),
              "Performance: thread should have GCLAB: %s", thread->name());
       // No GCLABs in this thread, fallback to shared allocation
       return NULL;
     }
-    HeapWord* obj = thread->gclab().allocate(size);
+  HeapWord* obj = gclab->allocate(size);
     if (obj != NULL) {
       return obj;
     }
     // Otherwise...
     return allocate_from_gclab_slow(thread, size);
-  } else {
-    return NULL;
-  }
 }
 
 inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) {
   if (Thread::current()->is_oom_during_evac()) {
     // This thread went through the OOM during evac protocol and it is safe to return

@@ -347,11 +345,11 @@
     // object will overwrite this stale copy, or the filler object on LAB retirement will
     // do this. For non-GCLAB allocations, we have no way to retract the allocation, and
     // have to explicitly overwrite the copy with the filler object. With that overwrite,
     // we have to keep the fwdptr initialized and pointing to our (stale) copy.
     if (alloc_from_gclab) {
-      thread->gclab().rollback(size_with_fwdptr);
+      thread->gclab()->undo_allocation(filler, size_with_fwdptr);
     } else {
       fill_with_object(copy, size_no_fwdptr);
     }
     log_develop_trace(gc, compaction)("Copy object: " PTR_FORMAT " -> " PTR_FORMAT " failed, use other: " PTR_FORMAT,
                                       p2i(p), p2i(copy), p2i(result));
< prev index next >