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

Christian Hagedorn chagedorn at openjdk.org
Fri Mar 14 09:40:56 UTC 2025


On Fri, 14 Mar 2025 09:36:41 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> 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) {
>>    ...
>> }
>
> I totally agree that there are other places where we have this mismatch - there are actually quite a few. This might require some more effort. I suggest to move forward with this small patch and file a separate RFE for revisiting other uses. What you do you think?

I guess there are also flags where we have this mismatch between global flag and compile command local flag. Maybe we should do a general pass over all the compile commands and check how we can align them better with their global flag.

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

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


More information about the hotspot-compiler-dev mailing list