RFR: 8293849: PrintIdealPhase in compiler directives file is ignored when used with other compile commands

Christian Hagedorn chagedorn at openjdk.org
Mon Sep 19 10:16:56 UTC 2022


On Thu, 15 Sep 2022 11:20:06 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> When using a compiler directives file with `PrintIdealPhase`:
> 
> 
> [
>   {
>     match : "Test::*",
>     log : true,
>     PrintIdealPhase : "BEFORE_MATCHING"
>   }
> ]
> 
> 
> together with other compile commands specified in `compilerdirectives_common_flags` and/or `compilerdirectives_c2_flags`:
> https://github.com/openjdk/jdk/blob/aff5ff14b208b3c2be93d7b4fab8b07c5be12f3e/src/hotspot/share/compiler/compilerDirectives.hpp#L38-L39
> https://github.com/openjdk/jdk/blob/aff5ff14b208b3c2be93d7b4fab8b07c5be12f3e/src/hotspot/share/compiler/compilerDirectives.hpp#L63-L64
> 
> then the `PrintIdealPhase` option is ignored. 
> 
> The reason is that when cloning the `DirectiveSet` for the current compilation in `DirectiveSet::clone()`, we only set `PrintIdealPhaseOption` but forget to also set `_ideal_phase_name_mask` which is used when deciding if a compile phase should be dumped or not. As a result, the mask keeps its default value zero and nothing is dumped because `Compile::shoud_print_phase()` returns false:
> 
> https://github.com/openjdk/jdk/blob/aff5ff14b208b3c2be93d7b4fab8b07c5be12f3e/src/hotspot/share/opto/compile.cpp#L5060-L5067
> 
> 
> The fix is to also clone the old value of `_ideal_phase_name_mask`. 
> 
> Thanks,
> Christian

Thanks Vladimir for your review!

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

PR: https://git.openjdk.org/jdk/pull/10283


More information about the hotspot-compiler-dev mailing list