1999
2000 // We must flush any deferred card marks before removing a thread from
2001 // the list of active threads.
2002 Universe::heap()->flush_deferred_store_barrier(this);
2003 assert(deferred_card_mark().is_empty(), "Should have been flushed");
2004
2005 #if INCLUDE_ALL_GCS
2006 // We must flush the G1-related buffers before removing a thread
2007 // from the list of active threads. We must do this after any deferred
2008 // card marks have been flushed (above) so that any entries that are
2009 // added to the thread's dirty card queue as a result are not lost.
2010 if (UseG1GC) {
2011 flush_barrier_queues();
2012 }
2013 #endif // INCLUDE_ALL_GCS
2014
2015 log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
2016 exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
2017 os::current_thread_id());
2018
2019 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
2020 Threads::remove(this);
2021
2022 // If someone set a handshake on us just as we entered exit path, we simple cancel it.
2023 if (ThreadLocalHandshakes) {
2024 cancel_handshake();
2025 }
2026 }
2027
2028 #if INCLUDE_ALL_GCS
2029 // Flush G1-related queues.
2030 void JavaThread::flush_barrier_queues() {
2031 satb_mark_queue().flush();
2032 dirty_card_queue().flush();
2033 }
2034
2035 void JavaThread::initialize_queues() {
2036 assert(!SafepointSynchronize::is_at_safepoint(),
2037 "we should not be at a safepoint");
2038
2039 SATBMarkQueue& satb_queue = satb_mark_queue();
2040 SATBMarkQueueSet& satb_queue_set = satb_mark_queue_set();
2041 // The SATB queue should have been constructed with its active
2042 // field set to false.
2043 assert(!satb_queue.is_active(), "SATB queue should not be active");
2044 assert(satb_queue.is_empty(), "SATB queue should be empty");
2045 // If we are creating the thread during a marking cycle, we should
|
1999
2000 // We must flush any deferred card marks before removing a thread from
2001 // the list of active threads.
2002 Universe::heap()->flush_deferred_store_barrier(this);
2003 assert(deferred_card_mark().is_empty(), "Should have been flushed");
2004
2005 #if INCLUDE_ALL_GCS
2006 // We must flush the G1-related buffers before removing a thread
2007 // from the list of active threads. We must do this after any deferred
2008 // card marks have been flushed (above) so that any entries that are
2009 // added to the thread's dirty card queue as a result are not lost.
2010 if (UseG1GC) {
2011 flush_barrier_queues();
2012 }
2013 #endif // INCLUDE_ALL_GCS
2014
2015 log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
2016 exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
2017 os::current_thread_id());
2018
2019 if (log_is_enabled(Debug, os, thread, timer)) {
2020 _timer_exit_phase3.stop();
2021 _timer_exit_phase4.start();
2022 }
2023 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
2024 Threads::remove(this);
2025
2026 // If someone set a handshake on us just as we entered exit path, we simple cancel it.
2027 if (ThreadLocalHandshakes) {
2028 cancel_handshake();
2029 }
2030
2031 if (log_is_enabled(Debug, os, thread, timer)) {
2032 _timer_exit_phase4.stop();
2033 ResourceMark rm(this);
2034 log_debug(os, thread, timer)("name='%s'"
2035 ", exit-phase1=" JLONG_FORMAT
2036 ", exit-phase2=" JLONG_FORMAT
2037 ", exit-phase3=" JLONG_FORMAT
2038 ", exit-phase4=" JLONG_FORMAT,
2039 get_thread_name(),
2040 _timer_exit_phase1.milliseconds(),
2041 _timer_exit_phase2.milliseconds(),
2042 _timer_exit_phase3.milliseconds(),
2043 _timer_exit_phase4.milliseconds());
2044 }
2045 }
2046
2047 #if INCLUDE_ALL_GCS
2048 // Flush G1-related queues.
2049 void JavaThread::flush_barrier_queues() {
2050 satb_mark_queue().flush();
2051 dirty_card_queue().flush();
2052 }
2053
2054 void JavaThread::initialize_queues() {
2055 assert(!SafepointSynchronize::is_at_safepoint(),
2056 "we should not be at a safepoint");
2057
2058 SATBMarkQueue& satb_queue = satb_mark_queue();
2059 SATBMarkQueueSet& satb_queue_set = satb_mark_queue_set();
2060 // The SATB queue should have been constructed with its active
2061 // field set to false.
2062 assert(!satb_queue.is_active(), "SATB queue should not be active");
2063 assert(satb_queue.is_empty(), "SATB queue should be empty");
2064 // If we are creating the thread during a marking cycle, we should
|