How to inspect hotspot compiler results? hsdis binaries for Windows?

Vladimir Kozlov Vladimir.Kozlov at Sun.COM
Thu Nov 19 11:56:18 PST 2009


Look for PREFETCH instructions, klass store and slow path to _new_instance_Java

public class Test1 {
   int i;
   public Test1() {
        i = 5;
   }
   static Test1 test() {
        return new Test1();
   }
   public static void main(String[] args){
        for(int i = 0; i < 30000; i++){
           Test1 t = test();
        }
   }
}

000   B1: #     B4 B2 <- BLOCK HEAD IS JUNK   Freq: 1
000     # stack bang
         PUSHL  EBP
         SUB    ESP,8    # Create frame
00e     MOV    EBX, Thread::current()
016     MOV    EAX,[EBX + #68]
019     LEA    ECX,[EAX + #16]
01c     CMPu   ECX,[EBX + #76]
01f     Jnb,us B4  P=0.000100 C=-1.000000
01f
021   B2: #     B3 <- B1  Freq: 0.9999
021     MOV    [EBX + #68],ECX
024     PREFETCHNTA [ECX + #256]        ! Prefetch into non-temporal cache for write
02b     MOV    ECX,precise klass Test1: 0x082bf7d8:Constant:exact *
030     MOV    EBX,[ECX + #104]
033     MOV    [EAX],EBX
035     MOV    [EAX + #4],precise klass Test1: 0x082bf7d8:Constant:exact *
03c     MOV    [EAX + #12],#0
03c
043   B3: #     N1 <- B5 B2  Freq: 1
043     MOV    [EAX + #8],#5
04a
04a     #checkcastPP of EAX
04a     ADD    ESP,8    # Destroy frame
         POPL   EBP
         TEST   PollPage,EAX     ! Poll Safepoint

054     RET
054
055   B4: #     B6 B5 <- B1  Freq: 0.000100017
055     MOV    ECX,precise klass Test1: 0x082bf7d8:Constant:exact *
05a     NOP     # 1 bytes pad for loops and calls
05b     CALL,static  wrapper for: _new_instance_Java
         # Test1::test @ bci:0
         # OopMap{off=96}
060
060   B5: #     B3 <- B4  Freq: 0.000100015
         # Block is sole successor of call
060     JMP,s  B3


Dennis Byrne wrote:
> How do we isolate the instructions for a constructor?
> 
> Dennis Byrne
> 
> On Thu, Nov 19, 2009 at 12:57 PM, Vladimir Kozlov
> <Vladimir.Kozlov at sun.com> wrote:
>> Yes, for older jdk versions you have to use "/" and "," as Chuck said
>> and for jdk 7 they both work.
>>
>> Vladimir
>>
>> Chuck Rasbold wrote:
>>> I suggest using / as a separator like so:
>>>
>>>
>>> -XX:CompileCommand=print,sun/nio/cs/ext/EUC_TW_C_d_b_codeToBuffer4/Decoder,decodeArrayLoop
>>>
>>> -- Chuck
>>>
>>>
>>>
>>> On Thu, Nov 19, 2009 at 10:37 AM, Vladimir Kozlov <Vladimir.Kozlov at sun.com
>>> <mailto:Vladimir.Kozlov at sun.com>> wrote:
>>>
>>>    Separate method name by "::" instead of ".":
>>>
>>>    ::decodeArrayLoop
>>>
>>>    And, it seems, we have bug here since it can't parse the class
>>>    name with more then one dot without specified method name:
>>>
>>>    % gamma -XX:CompileCommand=print,sun.nio.cs -Xcomp t
>>>    VM option 'CompileCommand=print,sun.nio.cs'
>>>    CompilerOracle: unrecognized line
>>>     "print sun nio cs"
>>>
>>>     Unrecognized text after command:  cs
>>>
>>>    Vladimir
>>>
>>>
>>>    Ulf Zibis wrote:
>>>
>>>        Vladimir, thanks for your answer.
>>>
>>>        I tried:
>>>
>>>  -XX:CompileCommand=print,sun.nio.cs.ext.EUC_TW_C_d_b_codeToBuffer4.Decoder.decodeArrayLoop
>>>
>>>
>>>        ... but got:
>>>        CompilerOracle: unrecognized line
>>>        VM option
>>>
>>>  'CompileCommand=print,sun.nio.cs.ext.EUC_TW_C_d_b_codeToBuffer4.Decoder.decodeArrayLoop'
>>>
>>>         "print sun nio cs ext EUC_TW_C_d_b_codeToBuffer4 Decoder
>>>        decodeArrayLoop"
>>>         Unrecognized text after command:  cs ext
>>>        EUC_TW_C_d_b_codeToBuffer4 Decoder decodeArrayLoop
>>>
>>>
>>>        java.vm.version : 17.0-b05-fastdebug
>>>
>>>        -Ulf
>>>
>>>
>>>        Am 19.11.2009 18:58, Vladimir Kozlov schrieb:
>>>
>>>            Don't use '*' in class name if you want to look on one
>>>            particular class. You correctly used CompileCommand=print but
>>>            don't specify PrintOptoAssembly if you want to print only
>>>            one method.
>>>
>>>            Vladimir
>>>
>>>            Ulf Zibis wrote:
>>>
>>>                Yes,  "-XX:+PrintOptoAssembly" option works on Windows
>>>                too (using fastdebug-build). :-)
>>>                Now I get very loooong output, so next question is, how
>>>                to reduce the output to a single method???
>>>                I've tried "-XX:CompileCommand=print,*...", but as
>>>                expected, it was ignored.
>>>                When "-Xbatch" is needed?
>>>
>>>                BTW, there is no docu for "-XX:+PrintOptoAssembly" on
>>>
>>>  http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
>>>
>>>                -Ulf
>>>
>>>
>>>
>>>                Am 18.11.2009 18:13, Dennis Byrne schrieb:
>>>
>>>                    It works on Windows but it is not quite as low level
>>>                    as PrintAssembly.
>>>                     For example you will see things like "fastlock" or
>>>                    "MEMBAR-release"
>>>                    but not the actual instructions behind these
>>> operations.
>>>
>>>                    Dennis Byrne
>>>
>>>                    On Wed, Nov 18, 2009 at 10:56 AM, Clemens Eisserer
>>>                    <linuxhippy at gmail.com <mailto:linuxhippy at gmail.com>>
>>>                    wrote:
>>>
>>>                        Hi Ulf,
>>>
>>>                        As far as I know the fastdebug-builds support
>>>                        this right out of the
>>>                        box, it can be enabled using the
>>>                         "-XX:+PrintOptoAssembly" option.
>>>                        However I don't know wether this works on
>>>                        Windows too.
>>>
>>>                        - Clemens
>>>
>>>                        2009/11/18 Ulf Zibis <Ulf.Zibis at gmx.de
>>>                        <mailto:Ulf.Zibis at gmx.de>>:
>>>
>>>                            Am 18.11.2009 10:21, Christian Thalinger
>>>                            schrieb:
>>>
>>>                                I could upload plugins for Linux and
>>>                                Solaris (both 32 and 64-bit) based
>>>                                on binutils-2.19.1.  I actually never
>>>                                tried base-hsdis.
>>>
>>>
>>>                            Would be great!
>>>
>>>                            Any volunteer to build the windows plugin ?
>>>                            (I not experienced in GNU build environment
>>>                            on Windows and don't possess MS
>>>                            Visual Studio 2008 enterprise licence)
>>>                            Maybe by help of mingw cross compiler on linux.
>>>
>>>                            Would be extremely great!!!
>>>
>>>
>>>
>>>                                Please, feel free to edit the wiki page
>>>                                for clarity or to fill in missing
>>>                                information.
>>>
>>>                            Done.
>>>
>>>                            -Ulf
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
> 
> 
> 


More information about the hotspot-dev mailing list