Kirs Mok wrote:
Could I get some review for this change, please?
I'm considering this as an initial draft version, and will improve it later
based on comments received.
An earlier case on hotspot-dev  seemed to have hit a bug caused by
matching an Oracle JRE with a OpenJDK-based HotSpot VM.
Chris suggested  that, to better aid future analysis of similar problems,
it's useful to print the JRE name in the error log, in addition to the JRE
version as printed currently. This patch implements Chris' suggestion.
An example of the effect of this patch is avaiable .
There are a few details that I'm not too sure about yet, and I'm looking for
comments on them:
1. How and when should I get the JRE name?
The JRE name is only exposed as a field of a Java-level class, namely the
"java_runtime_name" constant field in sun.misc.Version. I couldn't find it
exposed anywhere else. It is set into the Java-level system properties, by
key "java.runtime.name", but that's not immediately available to the VM
In my patch, I'm fetching the JRE name from
immediately after java.lang.System.initializeSystemClass() is invoked, and
storing it in a static field in JDK_Version. This is safer to do then
the name during error reporting, because it may be unreliable to access Java
heap contents when the VM is crashing.
There are other alternatives that I've thought about. One is adding a new
private interface between JDK/JVM that would allow the JDK to expose its
to the VM directly, perhaps with a new function JDK_GetName0(). But this is
more involved then the proposed change.
2. Where should I store the JRE name?
As mentioned, I'm storing it in a newly added static field in JDK_Version
now. But I'm not sure if this is the place it belongs. Universe doesn't seem
like the right place, neither.
Any suggestions or comments are welcomed.
Should I cc serviceability-dev as well?