< prev index next >

src/share/vm/runtime/thread.cpp

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


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









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




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


< prev index next >