<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Does anyone from runtime have an opinion on this one?<div><br></div><div>-- Chris</div><div><br><div><div>On May 16, 2012, at 1:26 PM, Christian Thalinger wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 16, 2012, at 12:44 PM, Krystal Mok wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi all,</div><div><br></div><div>Could I get some review for this change, please?</div><div><a href="https://gist.github.com/2709918#file_jre_name.patch">https://gist.github.com/2709918#file_jre_name.patch</a></div><div>
I'm considering this as an initial draft version, and will improve it later on</div><div>based on comments received.</div><div><br></div><div>Background:</div><div><br></div><div>An earlier case on hotspot-dev [1][2] seemed to have hit a bug caused by mix-</div>
<div>matching an Oracle JRE with a OpenJDK-based HotSpot VM.</div><div><br></div><div>Chris suggested [3] that, to better aid future analysis of similar problems,</div><div>it's useful to print the JRE name in the error log, in addition to the JRE</div>
<div>version as printed currently. This patch implements Chris' suggestion.</div><div><br></div><div>An example of the effect of this patch is avaiable [4].</div><div><br></div><div>There are a few details that I'm not too sure about yet, and I'm looking for</div>
<div>comments on them:</div><div><br></div><div>1. How and when should I get the JRE name?</div><div><br></div><div>The JRE name is only exposed as a field of a Java-level class, namely the</div><div>"java_runtime_name" constant field in sun.misc.Version. I couldn't find it</div>
<div>exposed anywhere else. It is set into the Java-level system properties, by the</div><div>key "<a href="http://java.runtime.name/">java.runtime.name</a>", but that's not immediately available to the VM side.</div>
<div><br></div><div>In my patch, I'm fetching the JRE name from sun.misc.Version.java_runtime_name</div><div>immediately after java.lang.System.initializeSystemClass() is invoked, and then</div><div>storing it in a static field in JDK_Version. This is safer to do then fetching</div>
<div>the name during error reporting, because it may be unreliable to access Java</div><div>heap contents when the VM is crashing.</div><div><br></div><div>There are other alternatives that I've thought about. One is adding a new</div>
<div>private interface between JDK/JVM that would allow the JDK to expose its name</div><div>to the VM directly, perhaps with a new function JDK_GetName0(). But this is</div><div>more involved then the proposed change.</div>
<div><br></div><div>2. Where should I store the JRE name?</div><div><br></div><div>As mentioned, I'm storing it in a newly added static field in JDK_Version right</div><div>now. But I'm not sure if this is the place it belongs. Universe doesn't seem</div>
<div>like the right place, neither.</div><div><br></div><div>Any suggestions or comments are welcomed.</div></blockquote><div><br></div>I looked at the changes and I think this is the right way to implement it. &nbsp;It will definitely help debugging some strange crashes like the one mentioned.</div><div><br></div><div>-- Chris</div><div><br><blockquote type="cite"><div><br></div><div>Should I cc serviceability-dev as well?</div><div><br></div><div>Regards,</div><div>Kris</div>
<div><br></div><div>[1]: <a href="http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2012-May/007647.html">http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2012-May/007647.html</a></div><div>[2]: <a href="http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-May/005711.html">http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-May/005711.html</a></div>
<div>[3]: <a href="http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-May/005725.html">http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-May/005725.html</a></div><div>[4]: <a href="https://gist.github.com/2709918">https://gist.github.com/2709918</a></div>
<div>
</div>
</blockquote></div><br></div></blockquote></div><br></div></body></html>