PrintAssembly at runtime / to different target

Stefan Reich stefan.reich.maker.of.eye at
Mon Sep 16 16:18:09 UTC 2019

Hi Aleksey!

> -XX:LogCompilation is your friend here.

How can I get assembly output in hotspot.log though? I only ever see it on
STDOUT, even with LogCompilation enabled.

On Mon, Sep 16, 2019, 15:15 Aleksey Shipilev <shade at> wrote:

> 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:
> --
> Thanks,
> -Aleksey

More information about the hotspot-dev mailing list