mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8002078: hs_err_pid file should report full JDK version string
Reviewed-by: dholmes, sspitsyn, kmo
This commit is contained in:
parent
772e0e748d
commit
ff6a68b801
5 changed files with 36 additions and 1 deletions
|
@ -1042,6 +1042,7 @@ static void call_initializeSystemClass(TRAPS) {
|
|||
}
|
||||
|
||||
char java_runtime_name[128] = "";
|
||||
char java_runtime_version[128] = "";
|
||||
|
||||
// extract the JRE name from sun.misc.Version.java_runtime_name
|
||||
static const char* get_java_runtime_name(TRAPS) {
|
||||
|
@ -1064,6 +1065,27 @@ static const char* get_java_runtime_name(TRAPS) {
|
|||
}
|
||||
}
|
||||
|
||||
// extract the JRE version from sun.misc.Version.java_runtime_version
|
||||
static const char* get_java_runtime_version(TRAPS) {
|
||||
Klass* k = SystemDictionary::find(vmSymbols::sun_misc_Version(),
|
||||
Handle(), Handle(), CHECK_AND_CLEAR_NULL);
|
||||
fieldDescriptor fd;
|
||||
bool found = k != NULL &&
|
||||
InstanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_version_name(),
|
||||
vmSymbols::string_signature(), &fd);
|
||||
if (found) {
|
||||
oop name_oop = k->java_mirror()->obj_field(fd.offset());
|
||||
if (name_oop == NULL)
|
||||
return NULL;
|
||||
const char* name = java_lang_String::as_utf8_string(name_oop,
|
||||
java_runtime_version,
|
||||
sizeof(java_runtime_version));
|
||||
return name;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// General purpose hook into Java code, run once when the VM is initialized.
|
||||
// The Java library method itself may be changed independently from the VM.
|
||||
static void call_postVMInitHook(TRAPS) {
|
||||
|
@ -3473,6 +3495,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
|||
|
||||
// get the Java runtime name after java.lang.System is initialized
|
||||
JDK_Version::set_runtime_name(get_java_runtime_name(THREAD));
|
||||
JDK_Version::set_runtime_version(get_java_runtime_version(THREAD));
|
||||
} else {
|
||||
warning("java.lang.System not initialized");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue