Puzzled by a performance glitch? You might have to look at the generated code.

Examining generated code

The following HotSpot options (with an -XX: prefix on the command line) require OpenJDK 7 and an externally loadable disassembler plugin:

These flags are "diagnostic", meaning that they must be preceded by -XX:+UnlockDiagnosticVMOptions. On the command line, they must all be preceded by -XX:. They may also be placed in a flags file, .hotspotrc by default, or configurable as -XX:Flags=myhotspotrc.txt.

The plugin (minus the Gnu disassembler) is defined in the OpenJDK sources here:
http://hg.openjdk.java.net/jdk7/hotspot/hotspot/file/tip/src/share/tools/hsdis/

Look at the README for instructions on building. Pre-built binaries are available (TBD... help?).

Individual methods may be printed:

Reading the compiler's mind

The -XX:+LogCompilation flag produces a low-level XML file about compiler and runtime decisions, which may be interesting to some. The -XX:+UnlockDiagnosticVMOptions must come first. The dump is to hotspot.log in the current directory; use -XX:LogFile=foo.log to change this.