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

John Rose John.Rose at Sun.COM
Sun Nov 22 17:05:16 PST 2009


On Nov 20, 2009, at 12:16 PM, John Rose wrote:

> This PrintOptoAssembly stuff is primarily intended for server compiler developers.  If it is readable to others, that is mostly by accident.
> 
> The disassembler plugin produces a more canonical display of code.  The only reason it isn't better decorated in product builds is some of the symbolic display logic is specific to the (fast-)debug builds, but this can be readily fixed.  For a start on such a fix, see the src/share/vm/compiler/disassembler.cpp chunk in this patch:
>  http://hg.openjdk.java.net/mlvm/mlvm/hotspot/file/tip/dynopt.patch
> 
> -- John

To get more debugging information from PrintOptoAssembly, including symbolic field references, try turning on -XX:+DebugNonSafepoints .

It requires -XX:+UnlockDiagnosticVMOptions.  This will give -XX:+PrintOptoAssembly more code-comments to print.

See below for an example dump of java.lang.AbstractStringBuilder::append from a run of the product JVM.

I am working on pulling some of the header information printed by the debug version into the product version.

The DebugNonSafepoints is in there to support profilers.  It comes with the usual caveats about debugging optimized code.

-- John

Decoding compiled method 0x0285a048:
Code:
[Disassembling for mach='i386(base-hsdis)']
[Entry Point]
  0x0285a140: cmp	eax, [ecx+0x4]
  0x0285a143: jnz	0x0282ce20      ;   {runtime_call}
  0x0285a149: nop
[Verified Entry Point]
  0x0285a14c: mov	[esp-0x3000], eax
  0x0285a153: push	ebp
  0x0285a154: sub	esp, 0x00000028  ;*synchronization entry
                                        ; - java.lang.AbstractStringBuilder::append at -1 (line 401)
  0x0285a15a: mov	ebp, ecx
  0x0285a15c: mov	[esp+0xC], edx
  0x0285a160: mov	eax, [edx+0x10]  ;*getfield count
                                        ; - java.lang.String::length at 1 (line 659)
                                        ; - java.lang.AbstractStringBuilder::append at 8 (line 402)
                                        ; implicit exception: dispatches to 0x0285a1e5
  0x0285a163: test	eax, eax
  0x0285a165: jz	0x0285a1b7      ;*ifne
                                        ; - java.lang.AbstractStringBuilder::append at 13 (line 403)
  0x0285a167: mov	edi, [ecx+0xC]  ;*getfield value
                                        ; - java.lang.AbstractStringBuilder::append at 27 (line 405)
  0x0285a16a: mov	ecx, [edi+0x8]  ; implicit exception: dispatches to 0x0285a1d3
  0x0285a16d: mov	ebx, [ebp+0x8]  ;*getfield count
                                        ; - java.lang.AbstractStringBuilder::append at 19 (line 404)
  0x0285a170: mov	[esp+0x10], eax
  0x0285a174: add	eax, ebx        ;*iadd
                                        ; - java.lang.AbstractStringBuilder::append at 23 (line 404)
  0x0285a176: mov	[esp+0x14], eax
  0x0285a17a: cmp	eax, ecx
  0x0285a17c: jle	0x0285a190      ;*if_icmple
                                        ; - java.lang.AbstractStringBuilder::append at 31 (line 405)
  0x0285a17e: mov	ecx, ebp
  0x0285a180: mov	edx, eax
  0x0285a182: nop
  0x0285a183: call	0x0282d060      ; OopMap{ebp=Oop [12]=Oop off=72}
                                        ;*invokevirtual expandCapacity
                                        ; - java.lang.AbstractStringBuilder::append at 36 (line 406)
                                        ;   {optimized virtual_call}
  0x0285a188: mov	eax, [ebp+0x8]  ;*getfield count
                                        ; - java.lang.AbstractStringBuilder::append at 47 (line 407)
  0x0285a18b: mov	ebx, [ebp+0xC]  ;*getfield value
                                        ; - java.lang.AbstractStringBuilder::append at 43 (line 407)
  0x0285a18e: jmp	0x0285a194
  0x0285a190: mov	eax, ebx
  0x0285a192: mov	ebx, edi        ;*getfield count
                                        ; - java.lang.AbstractStringBuilder::append at 47 (line 407)
  0x0285a194: xor	edx, edx
  0x0285a196: mov	ecx, [esp+0xC]
  0x0285a19a: push	[esp+0x10]
  0x0285a19e: pop	[esp]
  0x0285a1a1: mov	[esp+0x4], ebx
  0x0285a1a5: mov	[esp+0x8], eax
  0x0285a1a9: nop
  0x0285a1ab: call	0x0282d060      ; OopMap{ebp=Oop off=112}
                                        ;*invokevirtual getChars
                                        ; - java.lang.AbstractStringBuilder::append at 50 (line 407)
                                        ;   {optimized virtual_call}
  0x0285a1b0: mov	ebx, [esp+0x14]
  0x0285a1b4: mov	[ebp+0x8], ebx  ;*synchronization entry
                                        ; - java.lang.AbstractStringBuilder::append at -1 (line 401)
  0x0285a1b7: mov	eax, ebp
  0x0285a1b9: add	esp, 0x00000028
  0x0285a1bc: pop	ebp
  0x0285a1bd: test	[0x70000], eax  ;   {poll_return}
  0x0285a1c3: ret                       ;*invokevirtual getChars
                                        ; - java.lang.AbstractStringBuilder::append at 50 (line 407)
  0x0285a1c4: mov	ecx, eax
  0x0285a1c6: jmp	0x0285a1ca      ;*invokevirtual expandCapacity
                                        ; - java.lang.AbstractStringBuilder::append at 36 (line 406)
  0x0285a1c8: mov	ecx, eax        ;*invokevirtual getChars
                                        ; - java.lang.AbstractStringBuilder::append at 50 (line 407)
  0x0285a1ca: add	esp, 0x00000028
  0x0285a1cd: pop	ebp
  0x0285a1ce: jmp	0x028540a0      ;   {runtime_call}
  0x0285a1d3: mov	ecx, 0xfffffff6
  0x0285a1d8: nop
  0x0285a1db: call	0x0282c6a0      ; OopMap{off=160}
                                        ;*arraylength
                                        ; - java.lang.AbstractStringBuilder::append at 30 (line 405)
                                        ;   {runtime_call}
  0x0285a1e0: call	0x01570d10      ;*arraylength
                                        ; - java.lang.AbstractStringBuilder::append at 30 (line 405)
                                        ;   {runtime_call}
  0x0285a1e5: mov	ecx, 0xffffffb5
  0x0285a1ea: nop
  0x0285a1eb: call	0x0282c6a0      ; OopMap{ebp=Oop [12]=Oop off=176}
                                        ;*ifnonnull
                                        ; - java.lang.AbstractStringBuilder::append at 1 (line 401)
                                        ;   {runtime_call}
  0x0285a1f0: call	0x01570d10      ;*ifnonnull
                                        ; - java.lang.AbstractStringBuilder::append at 1 (line 401)
                                        ;   {runtime_call}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20091122/04e14ee4/attachment-0001.html 


More information about the hotspot-dev mailing list