comparison src/share/vm/runtime/thread.cpp @ 2129:8f8dfba37802

6994753: Implement optional hook to a Java method at VM startup. Reviewed-by: mchung, acorn
author kevinw
date Wed, 12 Jan 2011 15:44:16 +0000
parents db2b0f8c1cef
children ccfcb502af3f
comparison
equal deleted inserted replaced
2128:0ca32cc95d7b 2129:8f8dfba37802
976 JavaCalls::call_static(&result, klass, vmSymbolHandles::setBootClassLoaderHook_name(), 976 JavaCalls::call_static(&result, klass, vmSymbolHandles::setBootClassLoaderHook_name(),
977 vmSymbolHandles::void_method_signature(), CHECK); 977 vmSymbolHandles::void_method_signature(), CHECK);
978 } 978 }
979 #endif // KERNEL 979 #endif // KERNEL
980 980
981 // General purpose hook into Java code, run once when the VM is initialized.
982 // The Java library method itself may be changed independently from the VM.
983 static void call_postVMInitHook(TRAPS) {
984 klassOop k = SystemDictionary::sun_misc_PostVMInitHook_klass();
985 instanceKlassHandle klass (THREAD, k);
986 if (klass.not_null()) {
987 JavaValue result(T_VOID);
988 JavaCalls::call_static(&result, klass, vmSymbolHandles::run_method_name(),
989 vmSymbolHandles::void_method_signature(),
990 CHECK);
991 }
992 }
993
981 static void reset_vm_info_property(TRAPS) { 994 static void reset_vm_info_property(TRAPS) {
982 // the vm info string 995 // the vm info string
983 ResourceMark rm(THREAD); 996 ResourceMark rm(THREAD);
984 const char *vm_info = VM_Version::vm_info_string(); 997 const char *vm_info = VM_Version::vm_info_string();
985 998
3344 StatSampler::engage(); 3357 StatSampler::engage();
3345 if (CheckJNICalls) JniPeriodicChecker::engage(); 3358 if (CheckJNICalls) JniPeriodicChecker::engage();
3346 3359
3347 BiasedLocking::init(); 3360 BiasedLocking::init();
3348 3361
3362 if (JDK_Version::current().post_vm_init_hook_enabled()) {
3363 call_postVMInitHook(THREAD);
3364 // The Java side of PostVMInitHook.run must deal with all
3365 // exceptions and provide means of diagnosis.
3366 if (HAS_PENDING_EXCEPTION) {
3367 CLEAR_PENDING_EXCEPTION;
3368 }
3369 }
3349 3370
3350 // Start up the WatcherThread if there are any periodic tasks 3371 // Start up the WatcherThread if there are any periodic tasks
3351 // NOTE: All PeriodicTasks should be registered by now. If they 3372 // NOTE: All PeriodicTasks should be registered by now. If they
3352 // aren't, late joiners might appear to start slowly (we might 3373 // aren't, late joiners might appear to start slowly (we might
3353 // take a while to process their first tick). 3374 // take a while to process their first tick).