Tuesday, October 16, 2012

How to print disassembly from JIT code ?

In my previous post, I have shown you some disassembly from JIT native code. How to do the same at home ?

I found relevant informations in this wiki page.

 First, you need to get the dissasembler named
Put this disassembler into the bin directory of your JRE: C:\Program Files\Java\jre6\bin
Or for your JDK: C:\Program Files\Java\jdk1.6.0_35\jre\bin

Then launch your java command with the following options:
-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly

Then you will get:
"C:\Program Files (x86)\Java\jdk1.6.0_23\jre\bin\java" -server
-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly com.bempel.sandbox.TestJIT
Java HotSpot(TM) Server VM warning: PrintAssembly is enabled; turning on
DebugNonSafepoints to gain additional output
Loaded disassembler from hsdis-i386.dll
Decoding compiled method 0x02548708:
[Disassembling for mach='i386']
[Entry Point]
[Verified Entry Point]
  # {method} 'run' '()V' in 'com/bempel/sandbox/TestJIT$C'
Enjoy !

Updated : To get intel syntax over AT&T, use -XX:PrintAssemblyOptions=intel

No comments:

Post a Comment