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

Christian Hagedorn chagedorn at openjdk.org
Thu Sep 15 11:29:20 UTC 2022


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

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

Commit messages:
 - 8293849: PrintIdealPhase in compiler directives file is ignored when used with other compile commands

Changes: https://git.openjdk.org/jdk/pull/10283/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10283&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8293849
  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/10283.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10283/head:pull/10283

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


More information about the hotspot-compiler-dev mailing list