RFR: 8354196: C2: reorder and capitalize phase definition

Christian Hagedorn chagedorn at openjdk.org
Thu Jun 12 11:45:30 UTC 2025


On Thu, 12 Jun 2025 11:10:38 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:

> This PR performs some cleanup and formatting around the phase definitions in C2:
>  - the phase descriptions are capitalized according to the [MLA Handbook title case rules](https://en.wikipedia.org/wiki/Title_case#Modern_Language_Association_(MLA)_Handbook),
>  - the phases are reordered to be more or less in the order of execution or occurrence in the code,
>  - the definitions in `phasetype.hpp` and `CompilePhase.java` are synced,
>  - `CompilePhase.java` is aligned for better readability.
> 
> This change was tested on:
>  - [x] [Github Actions](https://github.com/mhaessig/jdk/actions/runs/15605662671)
>  - [x] tier1 plus some Oracle internal testing

Thanks for cleaning it up, looks good!

src/hotspot/share/opto/phasetype.hpp line 54:

> 52:   flags(PHASEIDEAL_BEFORE_EA,           "PhaseIdealLoop before EA") \
> 53:   flags(AFTER_EA,                       "After Escape Analysis") \
> 54:   flags(ITER_GVN_AFTER_EA,              "Iter GVN after EA") \

Not sure if this should be also part of this change but we might want to consider "Iter GVN" -> IGVN (same for left hand sides of `flags()`.

src/hotspot/share/opto/phasetype.hpp line 100:

> 98:   flags(OPTIMIZE_FINISHED,              "Optimize Finished") \
> 99:   flags(BEFORE_MATCHING,                "Before Matching") \
> 100:   flags(MATCHING,                       "After Matching") \

Could be name "AFTER_MATCHING" to match the name but as above, could also be part of a separate task.

test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java line 73:

> 71:     AFTER_LOOP_UNROLLING(           "After Loop Unrolling"),
> 72:     BEFORE_SPLIT_IF(                "Before Split-if"),
> 73:     AFTER_SPLIT_IF(                 "After Split-if"),

Nit: We might want to name it "Split-If" as being a name? At least we also call it as such in `TraceLoopOpts`:
https://github.com/openjdk/jdk/blob/65e63b6ab4241fc9d683e2ffa5bfe6e1a30059b6/src/hotspot/share/opto/loopopts.cpp#L1465
(same for `phasetype.hpp`)

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25778#pullrequestreview-2920735764
PR Review Comment: https://git.openjdk.org/jdk/pull/25778#discussion_r2142479956
PR Review Comment: https://git.openjdk.org/jdk/pull/25778#discussion_r2142483500
PR Review Comment: https://git.openjdk.org/jdk/pull/25778#discussion_r2142495035


More information about the hotspot-compiler-dev mailing list