Alex Rivera | Logout

How to see JIT-compiled code in JVM?

Asked 2009-10-01T11:45:16.470
97

Is there some way to see the native code produces by the JIT in a JVM?

Edit
Report

1 Answer

46

Assuming you're using the Sun Hotspot JVM (i.e. the one provided on java.com by Oracle), you can add the flag

-XX:+PrintOptoAssembly

when running your code. This will print out the optimized code generated by the JIT compiler and leaves out the rest.

If you want see the entire bytecode, including the unoptimized parts, add

-XX:CompileThreshold=#

when you're running your code.

You can read more about this command and the functionality of JIT in general here.

answered 2009-10-01T13:20:49.630

Your Answer