How can I see the code that HotSpot generates after optimizing? [duplicate]

时光毁灭记忆、已成空白 提交于 2019-12-18 04:11:42

问题


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?


回答1:


You will need to start the JVM with the options -XX:+PrintAssembly and -XX:UnlockDiagnosticVMOptions, but PrintAssembly requires the JVM to have the hsdis binary (HotSpot disassembler). The hsdis binary is not distributed with the JVM due to license incompatibility, so you will need to compile hsdis yourself or find a prebuilt hsdis binary from an unofficial web site.

To make sense of the output, a tool like JITWatch is useful. Follow its instructions to write the debug information to a log file which can be analyzed in JITWatch.




回答2:


http://mail.openjdk.java.net/pipermail/hotspot-dev/2009-February/001255.html



来源:https://stackoverflow.com/questions/1551781/how-can-i-see-the-code-that-hotspot-generates-after-optimizing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!