8220161: Shenandoah does not need to initialize PLABs for safepoint workers
authorzgu
Tue, 05 Mar 2019 12:30:47 -0500
changeset 54000 3158fae17e80
parent 53999 d7852bb72332
child 54001 b4e59fc5edd1
8220161: Shenandoah does not need to initialize PLABs for safepoint workers Reviewed-by: shade
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Mar 05 09:55:00 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Mar 05 12:30:47 2019 -0500
@@ -479,14 +479,12 @@
   }
 }
 
-class ShenandoahInitGCLABClosure : public ThreadClosure {
+class ShenandoahInitWorkerGCLABClosure : public ThreadClosure {
 public:
   void do_thread(Thread* thread) {
     assert(thread != NULL, "Sanity");
-    assert(!thread->is_Java_thread(), "Don't expect JavaThread this early");
-    if (thread->is_Worker_thread()) {
-      ShenandoahThreadLocalData::initialize_gclab(thread);
-    }
+    assert(thread->is_Worker_thread(), "Only worker thread expected");
+    ShenandoahThreadLocalData::initialize_gclab(thread);
   }
 };
 
@@ -494,8 +492,8 @@
   CollectedHeap::post_initialize();
   MutexLocker ml(Threads_lock);
 
-  ShenandoahInitGCLABClosure init_gclabs;
-  Threads::threads_do(&init_gclabs);
+  ShenandoahInitWorkerGCLABClosure init_gclabs;
+  _workers->threads_do(&init_gclabs);
 
   // gclab can not be initialized early during VM startup, as it can not determinate its max_size.
   // Now, we will let WorkGang to initialize gclab when new worker is created.
@@ -1027,7 +1025,6 @@
     cl.do_thread(t);
   }
   workers()->threads_do(&cl);
-  _safepoint_workers->threads_do(&cl);
 }
 
 void ShenandoahHeap::resize_tlabs() {
@@ -1113,7 +1110,6 @@
     cl.do_thread(t);
   }
   workers()->threads_do(&cl);
-  _safepoint_workers->threads_do(&cl);
 }
 
 void ShenandoahHeap::collect(GCCause::Cause cause) {