< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 49672 : 8200374: Add ThreadsSMRSupport::verify_hazard_pointer_scanned() to verify threads_do().
rev 49673 : Add missing NULL check; use proper lock-free get/set with TracingExport::_sampler_thread.
rev 49674 : Rename TracingExport::get_sampler_thread() to TracingExport::sampler_thread_acquire() and TracingExport::set_sampler_thread() to TracingExport::set_sampler_thread_with_lock(); set_sampler_thread_with_lock() uses Threads_lock toavoid conflicts with Thread-SMR scans.

*** 103,112 **** --- 103,113 ---- #include "services/management.hpp" #include "services/memTracker.hpp" #include "services/threadService.hpp" #include "trace/traceMacros.hpp" #include "trace/tracing.hpp" + #include "trace/tracingExport.hpp" #include "utilities/align.hpp" #include "utilities/copy.hpp" #include "utilities/defaultStream.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp"
*** 3431,3451 **** X = (JavaThread*)prefetch_and_load_ptr((void**)MACRO_current_p, (intx)MACRO_scan_interval)) // All JavaThreads #define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_java_thread_list(), X) ! // All JavaThreads + all non-JavaThreads (i.e., every thread in the system) ! void Threads::threads_do(ThreadClosure* tc) { ! assert_locked_or_safepoint(Threads_lock); ! // ALL_JAVA_THREADS iterates through all JavaThreads ! ALL_JAVA_THREADS(p) { ! tc->do_thread(p); ! } // Someday we could have a table or list of all non-JavaThreads. // For now, just manually iterate through them. tc->do_thread(VMThread::vm_thread()); Universe::heap()->gc_threads_do(tc); WatcherThread *wt = WatcherThread::watcher_thread(); // Strictly speaking, the following NULL check isn't sufficient to make sure // the data for WatcherThread is still valid upon being examined. However, // considering that WatchThread terminates when the VM is on the way to // exit at safepoint, the chance of the above is extremely small. The right --- 3432,3449 ---- X = (JavaThread*)prefetch_and_load_ptr((void**)MACRO_current_p, (intx)MACRO_scan_interval)) // All JavaThreads #define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_java_thread_list(), X) ! // All non-JavaThreads (i.e., every non-JavaThread in the system). ! void Threads::non_java_threads_do(ThreadClosure* tc) { // Someday we could have a table or list of all non-JavaThreads. // For now, just manually iterate through them. tc->do_thread(VMThread::vm_thread()); + if (Universe::heap() != NULL) { Universe::heap()->gc_threads_do(tc); + } WatcherThread *wt = WatcherThread::watcher_thread(); // Strictly speaking, the following NULL check isn't sufficient to make sure // the data for WatcherThread is still valid upon being examined. However, // considering that WatchThread terminates when the VM is on the way to // exit at safepoint, the chance of the above is extremely small. The right
*** 3454,3466 **** --- 3452,3481 ---- // checking in some cases. if (wt != NULL) { tc->do_thread(wt); } + #if INCLUDE_TRACE + Thread* sampler_thread = TracingExport::sampler_thread_acquire(); + if (sampler_thread != NULL) { + tc->do_thread(sampler_thread); + } + #endif + // If CompilerThreads ever become non-JavaThreads, add them here } + // All JavaThreads + all non-JavaThreads (i.e., every thread in the system). + void Threads::threads_do(ThreadClosure* tc) { + assert_locked_or_safepoint(Threads_lock); + // ALL_JAVA_THREADS iterates through all JavaThreads. + ALL_JAVA_THREADS(p) { + tc->do_thread(p); + } + non_java_threads_do(tc); + } + void Threads::possibly_parallel_threads_do(bool is_par, ThreadClosure* tc) { int cp = Threads::thread_claim_parity(); ALL_JAVA_THREADS(p) { if (p->claim_oops_do(is_par, cp)) { tc->do_thread(p);
< prev index next >