RFR: 8351938: C2: Print compilation bailouts with PrintCompilation compile command

Galder Zamarreño galder at openjdk.org
Thu Mar 13 18:21:53 UTC 2025


On Thu, 13 Mar 2025 12:07:50 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> We currently only print a compilation bailout with `-XX:+PrintCompilation`:
> 
> 7782 90 b 4 Test::main (19 bytes)
> 7792 90 b 4 Test::main (19 bytes) COMPILE SKIPPED: StressBailout
> 
> But not when using `-XX:CompileCommand=printcompilation,*::*`. This patch enables this.
> 
> Thanks,
> Christian

src/hotspot/share/compiler/compileBroker.cpp line 2377:

> 2375:       CompilationLog::log()->log_failure(thread, task, failure_reason, retry_message);
> 2376:     }
> 2377:     if (PrintCompilation || task->directive()->PrintCompilationOption) {

Sounds like a good idea, but is this the only place where we want to do something when either `-XX:+PrintCompilation` or `-XX:CompileCommand=printcompilation,*::*` is set? IOW, shouldn't other checks for `PrintCompilation` also take `-XX:CompileCommand=printcompilation,*::*` into account?

E.g. line 2182 above does:


  if (directive->PrintCompilationOption) {
    ResourceMark rm;
    task->print_tty();
  }


Shouldn't that be:


if (PrintCompilation || directive->PrintCompilationOption) {
   ...
}

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24031#discussion_r1994087988


More information about the hotspot-compiler-dev mailing list