PrintAssembly at runtime / to different target
Aleksey Shipilev
shade at redhat.com
Mon Sep 16 13:15:24 UTC 2019
On 9/16/19 3:04 PM, Stefan Reich wrote:
> the PrintAssembly option is of course a valuable tool for a serious Java
> developer. I can live with the fact that it requires a debug build of the
> JDK (just made one).
You don't need debug build. You need hsdis to disassemble the code, which works both fastdebug and
release modes. In fact, the generated code in fast/slowdebug mode can be different, because it may
include calls to debugging facilities.
> However, what I would really like is a way to selectively enable
> PrintAssembly at runtime, from within the JVM.
You can enable it selectively with -XX:CompileCommand=...; that said, in many cases interesting
methods are inlined into larger ones, and you can miss some interesting cases with selective filters.
> Also, it would be great to
> get the output in a buffer, not just on STDOUT. As it is, the disassembly
> actually mixes in with whatever the program prints, sometimes on the same
> line.
-XX:LogCompilation is your friend here. I don't think you can enable it at runtime, but it
definitely solves dumping the assembly data to stdout. In any case, assembly is printed during code
compilation, so even if you are able to turn it on in runtime, you might already be too late for the
dump.
This is actually written here:
https://wiki.openjdk.java.net/display/HotSpot/PrintAssembly
--
Thanks,
-Aleksey
More information about the hotspot-dev
mailing list