RFR: 8372097: C2: PhasePrintLevel requires setting PrintPhaseLevel explicitly to be active

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Wed Nov 19 09:01:52 UTC 2025


This changeset aligns the behavior of `PrintPhaseLevel` with its description in `c2_globals.hpp` in the default case of `-XX:PrintPhaseLevel=0`. In particular, after the changeset, running `java -XX:CompileCommand=PhasePrintLevel,*::*,N` does print the phase names corresponding to level `N` for the matched methods, as expected:


$ java -Xbatch -XX:CompileCommand=PhasePrintLevel,java.lang.StringLatin1::equals,2
CompileCommand: PhasePrintLevel java/lang/StringLatin1.equals intx PhasePrintLevel = 2
1.	After Parsing
2.	Iter GVN 1
3.	Incremental Inline
4.	Incremental Boxing Inline
5.	Before Loop Optimizations
6.	PhaseIdealLoop 1
7.	PhaseIdealLoop 2
...


The changeset makes the behavior of the `PrintPhaseLevel` flag and `PhasePrintLevel` compile command consistent with the behavior of the pre-existing, analogous `PrintIdealGraphLevel` flag and `IGVPrintLevel` compile command. The changeset adds tests covering and documenting different combinations of flag and compile-command-specified print levels, and fixes a typo in the flag description in `c2_globals.hpp`.

**Testing:** tier1-3 (linux-x64, windows-x64, macosx-x64, linux-aarch64, macosx-aarch64).

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

Commit messages:
 - Restrict compilation to test method, add bug number
 - Fix typo in description of PrintPhaseLevel
 - Add tests
 - Relax condition in Compile::should_print_phase

Changes: https://git.openjdk.org/jdk/pull/28386/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28386&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372097
  Stats: 112 lines in 3 files changed: 110 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/28386.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28386/head:pull/28386

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


More information about the hotspot-compiler-dev mailing list