Mercurial > hg > truffle
comparison src/share/vm/runtime/thread.cpp @ 6181:f8de958e5b2c
7176856: add the JRE name to the error log
Reviewed-by: coleenp, jrose, kvn, twisti
Contributed-by: Krystal Mok <sajia@taobao.com>
author | twisti |
---|---|
date | Mon, 18 Jun 2012 12:29:21 -0700 |
parents | df4cd4aac5c1 |
children | 24b9c7f4cae6 |
comparison
equal
deleted
inserted
replaced
6180:eeb819cf36e5 | 6181:f8de958e5b2c |
---|---|
994 JavaValue result(T_VOID); | 994 JavaValue result(T_VOID); |
995 JavaCalls::call_static(&result, klass, vmSymbols::initializeSystemClass_name(), | 995 JavaCalls::call_static(&result, klass, vmSymbols::initializeSystemClass_name(), |
996 vmSymbols::void_method_signature(), CHECK); | 996 vmSymbols::void_method_signature(), CHECK); |
997 } | 997 } |
998 | 998 |
999 char java_runtime_name[128] = ""; | |
1000 | |
1001 // extract the JRE name from sun.misc.Version.java_runtime_name | |
1002 static const char* get_java_runtime_name(TRAPS) { | |
1003 klassOop k = SystemDictionary::find(vmSymbols::sun_misc_Version(), | |
1004 Handle(), Handle(), CHECK_AND_CLEAR_NULL); | |
1005 fieldDescriptor fd; | |
1006 bool found = k != NULL && | |
1007 instanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_name_name(), | |
1008 vmSymbols::string_signature(), &fd); | |
1009 if (found) { | |
1010 oop name_oop = k->java_mirror()->obj_field(fd.offset()); | |
1011 if (name_oop == NULL) | |
1012 return NULL; | |
1013 const char* name = java_lang_String::as_utf8_string(name_oop, | |
1014 java_runtime_name, | |
1015 sizeof(java_runtime_name)); | |
1016 return name; | |
1017 } else { | |
1018 return NULL; | |
1019 } | |
1020 } | |
1021 | |
999 // General purpose hook into Java code, run once when the VM is initialized. | 1022 // General purpose hook into Java code, run once when the VM is initialized. |
1000 // The Java library method itself may be changed independently from the VM. | 1023 // The Java library method itself may be changed independently from the VM. |
1001 static void call_postVMInitHook(TRAPS) { | 1024 static void call_postVMInitHook(TRAPS) { |
1002 klassOop k = SystemDictionary::PostVMInitHook_klass(); | 1025 klassOop k = SystemDictionary::PostVMInitHook_klass(); |
1003 instanceKlassHandle klass (THREAD, k); | 1026 instanceKlassHandle klass (THREAD, k); |
3350 initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0); | 3373 initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0); |
3351 initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0); | 3374 initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0); |
3352 // The VM creates & returns objects of this class. Make sure it's initialized. | 3375 // The VM creates & returns objects of this class. Make sure it's initialized. |
3353 initialize_class(vmSymbols::java_lang_Class(), CHECK_0); | 3376 initialize_class(vmSymbols::java_lang_Class(), CHECK_0); |
3354 call_initializeSystemClass(CHECK_0); | 3377 call_initializeSystemClass(CHECK_0); |
3378 | |
3379 // get the Java runtime name after java.lang.System is initialized | |
3380 JDK_Version::set_runtime_name(get_java_runtime_name(THREAD)); | |
3355 } else { | 3381 } else { |
3356 warning("java.lang.System not initialized"); | 3382 warning("java.lang.System not initialized"); |
3357 } | 3383 } |
3358 | 3384 |
3359 // an instance of OutOfMemory exception has been allocated earlier | 3385 // an instance of OutOfMemory exception has been allocated earlier |