< prev index next >

src/share/vm/runtime/thread.cpp

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


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









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




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


< prev index next >