< prev index next >

src/share/vm/runtime/thread.cpp

Print this page
rev 13265 : 8180932: Parallelize safepoint cleanup
Summary: Provide infrastructure to do safepoint cleanup tasks using parallel worker threads
Reviewed-by: dholmes, rehn, dcubed, thartmann


3365   }
3366   // Someday we could have a table or list of all non-JavaThreads.
3367   // For now, just manually iterate through them.
3368   tc->do_thread(VMThread::vm_thread());
3369   Universe::heap()->gc_threads_do(tc);
3370   WatcherThread *wt = WatcherThread::watcher_thread();
3371   // Strictly speaking, the following NULL check isn't sufficient to make sure
3372   // the data for WatcherThread is still valid upon being examined. However,
3373   // considering that WatchThread terminates when the VM is on the way to
3374   // exit at safepoint, the chance of the above is extremely small. The right
3375   // way to prevent termination of WatcherThread would be to acquire
3376   // Terminator_lock, but we can't do that without violating the lock rank
3377   // checking in some cases.
3378   if (wt != NULL) {
3379     tc->do_thread(wt);
3380   }
3381 
3382   // If CompilerThreads ever become non-JavaThreads, add them here
3383 }
3384 









3385 // The system initialization in the library has three phases.
3386 //
3387 // Phase 1: java.lang.System class initialization
3388 //     java.lang.System is a primordial class loaded and initialized
3389 //     by the VM early during startup.  java.lang.System.<clinit>
3390 //     only does registerNatives and keeps the rest of the class
3391 //     initialization work later until thread initialization completes.
3392 //
3393 //     System.initPhase1 initializes the system properties, the static
3394 //     fields in, out, and err. Set up java signal handlers, OS-specific
3395 //     system settings, and thread group of the main thread.
3396 static void call_initPhase1(TRAPS) {
3397   Klass* klass =  SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
3398   JavaValue result(T_VOID);
3399   JavaCalls::call_static(&result, klass, vmSymbols::initPhase1_name(),
3400                                          vmSymbols::void_method_signature(), CHECK);
3401 }
3402 
3403 // Phase 2. Module system initialization
3404 //     This will initialize the module system.  Only java.base classes




3365   }
3366   // Someday we could have a table or list of all non-JavaThreads.
3367   // For now, just manually iterate through them.
3368   tc->do_thread(VMThread::vm_thread());
3369   Universe::heap()->gc_threads_do(tc);
3370   WatcherThread *wt = WatcherThread::watcher_thread();
3371   // Strictly speaking, the following NULL check isn't sufficient to make sure
3372   // the data for WatcherThread is still valid upon being examined. However,
3373   // considering that WatchThread terminates when the VM is on the way to
3374   // exit at safepoint, the chance of the above is extremely small. The right
3375   // way to prevent termination of WatcherThread would be to acquire
3376   // Terminator_lock, but we can't do that without violating the lock rank
3377   // checking in some cases.
3378   if (wt != NULL) {
3379     tc->do_thread(wt);
3380   }
3381 
3382   // If CompilerThreads ever become non-JavaThreads, add them here
3383 }
3384 
3385 void Threads::parallel_java_threads_do(ThreadClosure* tc) {
3386   int cp = Threads::thread_claim_parity();
3387   ALL_JAVA_THREADS(p) {
3388     if (p->claim_oops_do(true, cp)) {
3389       tc->do_thread(p);
3390     }
3391   }
3392 }
3393 
3394 // The system initialization in the library has three phases.
3395 //
3396 // Phase 1: java.lang.System class initialization
3397 //     java.lang.System is a primordial class loaded and initialized
3398 //     by the VM early during startup.  java.lang.System.<clinit>
3399 //     only does registerNatives and keeps the rest of the class
3400 //     initialization work later until thread initialization completes.
3401 //
3402 //     System.initPhase1 initializes the system properties, the static
3403 //     fields in, out, and err. Set up java signal handlers, OS-specific
3404 //     system settings, and thread group of the main thread.
3405 static void call_initPhase1(TRAPS) {
3406   Klass* klass =  SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
3407   JavaValue result(T_VOID);
3408   JavaCalls::call_static(&result, klass, vmSymbols::initPhase1_name(),
3409                                          vmSymbols::void_method_signature(), CHECK);
3410 }
3411 
3412 // Phase 2. Module system initialization
3413 //     This will initialize the module system.  Only java.base classes


< prev index next >