--- a/src/hotspot/share/runtime/thread.cpp Sat Feb 24 08:26:53 2018 +0000
+++ b/src/hotspot/share/runtime/thread.cpp Mon Feb 19 04:50:50 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",