debug in hotspot

Xin Tong xerox.time.tech at gmail.com
Mon May 21 14:30:44 PDT 2012


On Thu, May 3, 2012 at 9:35 PM, Krystal Mok <rednaxelafx at gmail.com> wrote:

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

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 ?

Xin


>
>
>> and how do i
>> know which compiler is used to compile a method in the
>> PrintCompilation log  or through any other options ?
>>
>
> Please refer to this note: https://gist.github.com/1165804#file_notes.md
> I was supposed to put this up in the HotSpotInternals wiki, but somehow I
> haven't done it yet...oops.
>
> - Kris
>
>
>>
>> >>
>> >>> 3. if i am able to limit down to a specific method, i want to start
>> >>> disabling optimizations, is there an option to disable all
>> >>> optimizations in the c1 and c2 compilers, or i need to do it manually
>> >>> ?
>> >>>
>> >>
>> >> I don't think there's an all-in-one flag to turn all optimizations
>> off. At least not for now.
>> >> See c1_globals.hpp and c2_globals.hpp to get an idea of what
>> optimizations you can turn off.
>> >>
>> >> - Kris
>> >>
>> >>> Thanks
>> >
>> > Thank you very much Kris. This is very helpful.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20120521/474750cc/attachment.html 


More information about the hotspot-compiler-dev mailing list