views:

127

answers:

3

I'd like to have a better understanding of what optimizations HotSpot might generate for my Java code at run time.

Is there a way to see the optimized code that HotSpot is using after it's been running for a while?

+6  A: 

You would need to use a debug build of the JVM. Then you can use some additional JVM parameters (such as -XX:+LogCompilation and -XX:+PrintOptoAssembly) which make the JVM to print out its optimizations.

Esko Luontola
Yep, -XX:+PrintOptoAssembly is the key.
David Crawshaw
A: 

rewrite due to poor work and downvotes

Iced Tea

provides one avenue of approach.

Nicholas Jordan
That only shows you the Java bytecode that the Java compiler generates, not the native machine code that the HotSpot JIT makes out of the bytecode.
Jesper
Correct, my bad.
Nicholas Jordan
Humble pie: http://weblogs.java.net/blog/2008/03/30/deep-dive-assembly-code-java
Nicholas Jordan