src/hotspot/share/runtime/thread.cpp
changeset 48961 120b61d50f85
parent 48823 99c973b56994
child 48983 df25d1a5d78a
child 49006 c6d1c4ad90f4
--- a/src/hotspot/share/runtime/thread.cpp	Mon Feb 12 16:08:33 2018 -0800
+++ b/src/hotspot/share/runtime/thread.cpp	Wed Jan 10 22:48:27 2018 +0100
@@ -1994,20 +1994,10 @@
     JvmtiExport::cleanup_thread(this);
   }
 
-  // We must flush any deferred card marks before removing a thread from
-  // the list of active threads.
-  Universe::heap()->flush_deferred_store_barrier(this);
-  assert(deferred_card_mark().is_empty(), "Should have been flushed");
-
-#if INCLUDE_ALL_GCS
-  // We must flush the G1-related buffers before removing a thread
-  // from the list of active threads. We must do this after any deferred
-  // card marks have been flushed (above) so that any entries that are
-  // added to the thread's dirty card queue as a result are not lost.
-  if (UseG1GC) {
-    flush_barrier_queues();
-  }
-#endif // INCLUDE_ALL_GCS
+  // We must flush any deferred card marks and other various GC barrier
+  // related buffers (e.g. G1 SATB buffer and G1 dirty card queue buffer)
+  // before removing a thread from the list of active threads.
+  BarrierSet::barrier_set()->flush_deferred_barriers(this);
 
   log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
     exit_type == JavaThread::normal_exit ? "exiting" : "detaching",