97 #include "runtime/vframeArray.hpp" 98 #include "runtime/vframe_hp.hpp" 99 #include "runtime/vmThread.hpp" 100 #include "runtime/vm_operations.hpp" 101 #include "runtime/vm_version.hpp" 102 #include "services/attachListener.hpp" 103 #include "services/management.hpp" 104 #include "services/memTracker.hpp" 105 #include "services/threadService.hpp" 106 #include "trace/traceMacros.hpp" 107 #include "trace/tracing.hpp" 108 #include "trace/tracingExport.hpp" 109 #include "utilities/align.hpp" 110 #include "utilities/copy.hpp" 111 #include "utilities/defaultStream.hpp" 112 #include "utilities/dtrace.hpp" 113 #include "utilities/events.hpp" 114 #include "utilities/macros.hpp" 115 #include "utilities/preserveException.hpp" 116 #include "utilities/vmError.hpp" 117 #if INCLUDE_ALL_GCS 118 #include "gc/cms/concurrentMarkSweepThread.hpp" 119 #include "gc/g1/g1ConcurrentMarkThread.inline.hpp" 120 #include "gc/parallel/pcTasks.hpp" 121 #endif // INCLUDE_ALL_GCS 122 #if INCLUDE_JVMCI 123 #include "jvmci/jvmciCompiler.hpp" 124 #include "jvmci/jvmciRuntime.hpp" 125 #include "logging/logHandle.hpp" 126 #endif 127 #ifdef COMPILER1 128 #include "c1/c1_Compiler.hpp" 129 #endif 130 #ifdef COMPILER2 131 #include "opto/c2compiler.hpp" 132 #include "opto/idealGraphPrinter.hpp" 133 #endif 134 #if INCLUDE_RTM_OPT 135 #include "runtime/rtmLocking.hpp" 136 #endif 137 138 // Initialization after module runtime initialization 139 void universe_post_module_init(); // must happen after call_initPhase2 140 141 #ifdef DTRACE_ENABLED 4482 "VMThread " PTR_FORMAT " has incorrect parity %d != %d", p2i(vmt), thread_parity, _thread_claim_parity); 4483 } 4484 #endif // ASSERT 4485 4486 class ParallelOopsDoThreadClosure : public ThreadClosure { 4487 private: 4488 OopClosure* _f; 4489 CodeBlobClosure* _cf; 4490 public: 4491 ParallelOopsDoThreadClosure(OopClosure* f, CodeBlobClosure* cf) : _f(f), _cf(cf) {} 4492 void do_thread(Thread* t) { 4493 t->oops_do(_f, _cf); 4494 } 4495 }; 4496 4497 void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf) { 4498 ParallelOopsDoThreadClosure tc(f, cf); 4499 possibly_parallel_threads_do(is_par, &tc); 4500 } 4501 4502 #if INCLUDE_ALL_GCS 4503 // Used by ParallelScavenge 4504 void Threads::create_thread_roots_tasks(GCTaskQueue* q) { 4505 ALL_JAVA_THREADS(p) { 4506 q->enqueue(new ThreadRootsTask(p)); 4507 } 4508 q->enqueue(new ThreadRootsTask(VMThread::vm_thread())); 4509 } 4510 4511 // Used by Parallel Old 4512 void Threads::create_thread_roots_marking_tasks(GCTaskQueue* q) { 4513 ALL_JAVA_THREADS(p) { 4514 q->enqueue(new ThreadRootsMarkingTask(p)); 4515 } 4516 q->enqueue(new ThreadRootsMarkingTask(VMThread::vm_thread())); 4517 } 4518 #endif // INCLUDE_ALL_GCS 4519 4520 void Threads::nmethods_do(CodeBlobClosure* cf) { 4521 ALL_JAVA_THREADS(p) { 4522 // This is used by the code cache sweeper to mark nmethods that are active 4523 // on the stack of a Java thread. Ignore the sweeper thread itself to avoid 4524 // marking CodeCacheSweeperThread::_scanned_compiled_method as active. 4525 if(!p->is_Code_cache_sweeper_thread()) { 4526 p->nmethods_do(cf); 4527 } 4528 } 4529 } 4530 4531 void Threads::metadata_do(void f(Metadata*)) { 4532 ALL_JAVA_THREADS(p) { 4533 p->metadata_do(f); 4534 } 4535 } 4536 4537 class ThreadHandlesClosure : public ThreadClosure { 4538 void (*_f)(Metadata*); | 97 #include "runtime/vframeArray.hpp" 98 #include "runtime/vframe_hp.hpp" 99 #include "runtime/vmThread.hpp" 100 #include "runtime/vm_operations.hpp" 101 #include "runtime/vm_version.hpp" 102 #include "services/attachListener.hpp" 103 #include "services/management.hpp" 104 #include "services/memTracker.hpp" 105 #include "services/threadService.hpp" 106 #include "trace/traceMacros.hpp" 107 #include "trace/tracing.hpp" 108 #include "trace/tracingExport.hpp" 109 #include "utilities/align.hpp" 110 #include "utilities/copy.hpp" 111 #include "utilities/defaultStream.hpp" 112 #include "utilities/dtrace.hpp" 113 #include "utilities/events.hpp" 114 #include "utilities/macros.hpp" 115 #include "utilities/preserveException.hpp" 116 #include "utilities/vmError.hpp" 117 #if INCLUDE_PARALLELGC 118 #include "gc/parallel/pcTasks.hpp" 119 #endif 120 #if INCLUDE_JVMCI 121 #include "jvmci/jvmciCompiler.hpp" 122 #include "jvmci/jvmciRuntime.hpp" 123 #include "logging/logHandle.hpp" 124 #endif 125 #ifdef COMPILER1 126 #include "c1/c1_Compiler.hpp" 127 #endif 128 #ifdef COMPILER2 129 #include "opto/c2compiler.hpp" 130 #include "opto/idealGraphPrinter.hpp" 131 #endif 132 #if INCLUDE_RTM_OPT 133 #include "runtime/rtmLocking.hpp" 134 #endif 135 136 // Initialization after module runtime initialization 137 void universe_post_module_init(); // must happen after call_initPhase2 138 139 #ifdef DTRACE_ENABLED 4480 "VMThread " PTR_FORMAT " has incorrect parity %d != %d", p2i(vmt), thread_parity, _thread_claim_parity); 4481 } 4482 #endif // ASSERT 4483 4484 class ParallelOopsDoThreadClosure : public ThreadClosure { 4485 private: 4486 OopClosure* _f; 4487 CodeBlobClosure* _cf; 4488 public: 4489 ParallelOopsDoThreadClosure(OopClosure* f, CodeBlobClosure* cf) : _f(f), _cf(cf) {} 4490 void do_thread(Thread* t) { 4491 t->oops_do(_f, _cf); 4492 } 4493 }; 4494 4495 void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf) { 4496 ParallelOopsDoThreadClosure tc(f, cf); 4497 possibly_parallel_threads_do(is_par, &tc); 4498 } 4499 4500 #if INCLUDE_PARALLELGC 4501 // Used by ParallelScavenge 4502 void Threads::create_thread_roots_tasks(GCTaskQueue* q) { 4503 ALL_JAVA_THREADS(p) { 4504 q->enqueue(new ThreadRootsTask(p)); 4505 } 4506 q->enqueue(new ThreadRootsTask(VMThread::vm_thread())); 4507 } 4508 4509 // Used by Parallel Old 4510 void Threads::create_thread_roots_marking_tasks(GCTaskQueue* q) { 4511 ALL_JAVA_THREADS(p) { 4512 q->enqueue(new ThreadRootsMarkingTask(p)); 4513 } 4514 q->enqueue(new ThreadRootsMarkingTask(VMThread::vm_thread())); 4515 } 4516 #endif // INCLUDE_PARALLELGC 4517 4518 void Threads::nmethods_do(CodeBlobClosure* cf) { 4519 ALL_JAVA_THREADS(p) { 4520 // This is used by the code cache sweeper to mark nmethods that are active 4521 // on the stack of a Java thread. Ignore the sweeper thread itself to avoid 4522 // marking CodeCacheSweeperThread::_scanned_compiled_method as active. 4523 if(!p->is_Code_cache_sweeper_thread()) { 4524 p->nmethods_do(cf); 4525 } 4526 } 4527 } 4528 4529 void Threads::metadata_do(void f(Metadata*)) { 4530 ALL_JAVA_THREADS(p) { 4531 p->metadata_do(f); 4532 } 4533 } 4534 4535 class ThreadHandlesClosure : public ThreadClosure { 4536 void (*_f)(Metadata*); |