<br><br>
<div class="gmail_quote">On Thu, May 3, 2012 at 9:35 PM, Krystal Mok <span dir="ltr">&lt;<a href="mailto:rednaxelafx@gmail.com" target="_blank">rednaxelafx@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote"><br><br>
<div class="gmail_quote">
<div class="im">On Fri, May 4, 2012 at 8:48 AM, Xin Tong <span dir="ltr">&lt;<a href="mailto:xerox.time.tech@gmail.com" target="_blank">xerox.time.tech@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>On Thu, May 3, 2012 at 8:45 PM, Xin Tong &lt;<a href="mailto:xerox.time.tech@gmail.com" target="_blank">xerox.time.tech@gmail.com</a>&gt; wrote:<br>&gt; On Thu, May 3, 2012 at 8:29 PM, Krystal Mok &lt;<a href="mailto:rednaxelafx@gmail.com" target="_blank">rednaxelafx@gmail.com</a>&gt; wrote:<br>
&gt;&gt; On 2012-5-4, at 8:16, Xin Tong &lt;<a href="mailto:xerox.time.tech@gmail.com" target="_blank">xerox.time.tech@gmail.com</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt;&gt; i would like to know how to debug in hotspot, what are some of the<br>
&gt;&gt;&gt; standard procedures ? Lets say, the hotspot fails to run a Java<br>&gt;&gt;&gt; program. a few steps to triage the problem.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; 1. disable JIT compilers. hotspot has 2 compilers c1 and c2. they are<br>
&gt;&gt;&gt; both used if TieredCompilation is enabled. How do I disable both of<br>&gt;&gt;&gt; them.<br>&gt;&gt;<br>&gt;&gt; It&#39;s there in the globals.hpp file: -XX:-UseCompiler<br></div></blockquote>
<div><br></div></div>
<div>I forgot to mention there&#39;s a shorter (and better supported) equivalent to this: -Xint</div>
<div class="im">
<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>&gt;&gt;<br>&gt;&gt;&gt; 2. if the Java program passes after the JIT is disabled. There is a<br>&gt;&gt;&gt; good chance that the problem is cause by the JIT. I want to narrow<br>&gt;&gt;&gt; down to a specific method, I can use PrintCompilation to find out all<br>
&gt;&gt;&gt; the method compiled, but how can I disable one specific method from<br>&gt;&gt;&gt; being compiled.<br>&gt;&gt;<br>&gt;&gt; -XX:CompileCommand=&#39;exclude,your/class,yourMethod&#39;<br>&gt;&gt; Or an equivalent .hotspot_compiler configuration file.<br>
&gt;&gt; Read this thread for example (in Chinese): <a href="http://hllvm.group.iteye.com/group/topic/28201" target="_blank">http://hllvm.group.iteye.com/group/topic/28201</a><br><br></div>By the way, one thing we can do here is to force c1 to compile a<br>
method. i.e. c2 is more likely to fail than c1 as it does more<br>optimizations. how do i force c1 to compile a method ?</blockquote>
<div><br></div></div>
<div>What platform and version of JDK are you using?</div>
<div>If there&#39;s a Client VM for your platform, use that;</div>
<div>If you&#39;re using JDK7 or JDK8, try -XX:+TieredCompilation -XX:TieredStopAtLevel=1, which effectively disables C2 in tiered mode.</div>
<div>Otherwise, if you have to use the Server VM (for instance, on amd64 where Oracle doesn&#39;t provide a Client VM build), and you&#39;re using an old version of JDK6, I&#39;m not sure if there&#39;s a way to force compilation with C1.</div>

<div>And, there&#39;s no way (yet) to force compilation with C1/C2 on a per-method granularity.</div></div></blockquote>
<div> </div>
<div>There is no way to force the compilation with C1/C2 on a per-method granularity. But methods are compiled with C1 and then C2 in a tiered compilation , right ?</div>
<div> </div>
<div>Xin </div>
<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div class="gmail_quote">
<div class="im">
<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">and how do i<br>know which compiler is used to compile a method in the<br>PrintCompilation log  or through any other options ?<br>
</blockquote>
<div><br></div></div>
<div>Please refer to this note: <a href="https://gist.github.com/1165804#file_notes.md" target="_blank">https://gist.github.com/1165804#file_notes.md</a></div>
<div>I was supposed to put this up in the HotSpotInternals wiki, but somehow I haven&#39;t done it yet...oops.</div>
<div><br></div>
<div>- Kris</div>
<div class="im">
<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>
<div><br>&gt;&gt;<br>&gt;&gt;&gt; 3. if i am able to limit down to a specific method, i want to start<br>&gt;&gt;&gt; disabling optimizations, is there an option to disable all<br>&gt;&gt;&gt; optimizations in the c1 and c2 compilers, or i need to do it manually<br>
&gt;&gt;&gt; ?<br>&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; I don&#39;t think there&#39;s an all-in-one flag to turn all optimizations off. At least not for now.<br>&gt;&gt; See c1_globals.hpp and c2_globals.hpp to get an idea of what optimizations you can turn off.<br>
&gt;&gt;<br>&gt;&gt; - Kris<br>&gt;&gt;<br>&gt;&gt;&gt; Thanks<br>&gt;<br>&gt; Thank you very much Kris. This is very helpful.<br></div></div></blockquote></div></div><br></blockquote></div><br>