112 #include "utilities/dtrace.hpp" |
112 #include "utilities/dtrace.hpp" |
113 #include "utilities/events.hpp" |
113 #include "utilities/events.hpp" |
114 #include "utilities/macros.hpp" |
114 #include "utilities/macros.hpp" |
115 #include "utilities/preserveException.hpp" |
115 #include "utilities/preserveException.hpp" |
116 #include "utilities/vmError.hpp" |
116 #include "utilities/vmError.hpp" |
117 #if INCLUDE_PARALLELGC |
|
118 #include "gc/parallel/pcTasks.hpp" |
|
119 #endif |
|
120 #if INCLUDE_JVMCI |
117 #if INCLUDE_JVMCI |
121 #include "jvmci/jvmciCompiler.hpp" |
118 #include "jvmci/jvmciCompiler.hpp" |
122 #include "jvmci/jvmciRuntime.hpp" |
119 #include "jvmci/jvmciRuntime.hpp" |
123 #include "logging/logHandle.hpp" |
120 #include "logging/logHandle.hpp" |
124 #endif |
121 #endif |
3434 #endif |
3431 #endif |
3435 |
3432 |
3436 // If CompilerThreads ever become non-JavaThreads, add them here |
3433 // If CompilerThreads ever become non-JavaThreads, add them here |
3437 } |
3434 } |
3438 |
3435 |
3439 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system). |
3436 // All JavaThreads |
3440 void Threads::threads_do(ThreadClosure* tc) { |
3437 void Threads::java_threads_do(ThreadClosure* tc) { |
3441 assert_locked_or_safepoint(Threads_lock); |
3438 assert_locked_or_safepoint(Threads_lock); |
3442 // ALL_JAVA_THREADS iterates through all JavaThreads. |
3439 // ALL_JAVA_THREADS iterates through all JavaThreads. |
3443 ALL_JAVA_THREADS(p) { |
3440 ALL_JAVA_THREADS(p) { |
3444 tc->do_thread(p); |
3441 tc->do_thread(p); |
3445 } |
3442 } |
|
3443 } |
|
3444 |
|
3445 void Threads::java_threads_and_vm_thread_do(ThreadClosure* tc) { |
|
3446 assert_locked_or_safepoint(Threads_lock); |
|
3447 java_threads_do(tc); |
|
3448 tc->do_thread(VMThread::vm_thread()); |
|
3449 } |
|
3450 |
|
3451 // All JavaThreads + all non-JavaThreads (i.e., every thread in the system). |
|
3452 void Threads::threads_do(ThreadClosure* tc) { |
|
3453 assert_locked_or_safepoint(Threads_lock); |
|
3454 java_threads_do(tc); |
3446 non_java_threads_do(tc); |
3455 non_java_threads_do(tc); |
3447 } |
3456 } |
3448 |
3457 |
3449 void Threads::possibly_parallel_threads_do(bool is_par, ThreadClosure* tc) { |
3458 void Threads::possibly_parallel_threads_do(bool is_par, ThreadClosure* tc) { |
3450 int cp = Threads::thread_claim_parity(); |
3459 int cp = Threads::thread_claim_parity(); |
4462 |
4471 |
4463 void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf) { |
4472 void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf) { |
4464 ParallelOopsDoThreadClosure tc(f, cf); |
4473 ParallelOopsDoThreadClosure tc(f, cf); |
4465 possibly_parallel_threads_do(is_par, &tc); |
4474 possibly_parallel_threads_do(is_par, &tc); |
4466 } |
4475 } |
4467 |
|
4468 #if INCLUDE_PARALLELGC |
|
4469 // Used by ParallelScavenge |
|
4470 void Threads::create_thread_roots_tasks(GCTaskQueue* q) { |
|
4471 ALL_JAVA_THREADS(p) { |
|
4472 q->enqueue(new ThreadRootsTask(p)); |
|
4473 } |
|
4474 q->enqueue(new ThreadRootsTask(VMThread::vm_thread())); |
|
4475 } |
|
4476 |
|
4477 // Used by Parallel Old |
|
4478 void Threads::create_thread_roots_marking_tasks(GCTaskQueue* q) { |
|
4479 ALL_JAVA_THREADS(p) { |
|
4480 q->enqueue(new ThreadRootsMarkingTask(p)); |
|
4481 } |
|
4482 q->enqueue(new ThreadRootsMarkingTask(VMThread::vm_thread())); |
|
4483 } |
|
4484 #endif // INCLUDE_PARALLELGC |
|
4485 |
4476 |
4486 void Threads::nmethods_do(CodeBlobClosure* cf) { |
4477 void Threads::nmethods_do(CodeBlobClosure* cf) { |
4487 ALL_JAVA_THREADS(p) { |
4478 ALL_JAVA_THREADS(p) { |
4488 // This is used by the code cache sweeper to mark nmethods that are active |
4479 // This is used by the code cache sweeper to mark nmethods that are active |
4489 // on the stack of a Java thread. Ignore the sweeper thread itself to avoid |
4480 // on the stack of a Java thread. Ignore the sweeper thread itself to avoid |