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

Christian Hagedorn chagedorn at openjdk.org
Wed Nov 19 09:22:04 UTC 2025


On Wed, 19 Nov 2025 08:51:58 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

> 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).

Looks good!

Not something for this PR: What I find confusing is the non-matching flag and compile command name:
- `PrintPhaseLevel` vs. `PhasePrintLevel`
- `PrintIdealGraphLevel` vs `IGVPrintLevel`

I would advocate to use matching names.

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28386#pullrequestreview-3481653131


More information about the hotspot-compiler-dev mailing list