Is it possible to view the machine code generated by the JVM hotspot compiler?

bytecode, java, machine-code

Solution

Yes, with `-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly` the Hotspot VM can give you that information when it actually executes (compiles) a given bytecode method.

See for example HotSpotInternals Wiki:Print Assembly for details. It does require a disassembler module (hsdis-*.dll on Windows).

A bit more comfortable is using JITWatch (but it uses the same infrastructure from HotSpot).

Problem

I was wondering, is it possible to get eyes on the actual machine code that the HotSpot compiler generates when it compiles a given Java bytecode class or method?

Original source

Related problems