RFR: 8319813: Remove upper limit on number of compiler phases in phasetype.hpp

Christian Hagedorn chagedorn at openjdk.org
Mon Nov 20 11:50:31 UTC 2023


On Mon, 20 Nov 2023 09:04:27 GMT, Daniel Lundén <duke at openjdk.org> wrote:

> This changeset removes the implicit upper limit on the number of compiler phases in `phasetype.hpp`. The limit was due to the 64-bit mask used in `Compile::should_print_phase`, causing the `assert(cpt < 64, "out of bounds");` in `phasetype.hpp` to trigger when increasing the number of phases to more than 64.
> 
> Changes:
> - Replace the 64-bit mask with a bit map (`utilities/bitMap.hpp`).
> - Clean up the `PhaseNameValidator` interface by allocating the mask internally.
> - Move the check for whether a mask is non-zero ("is set") into `PhaseNameValidator`.
> - Add a method `should_print_phase` to `DirectiveSet`, simplifying the `if`-condition in `Compile::should_print_phase`.
> 
> ### Testing
> Platforms: windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64.
> - `tier1`
> - HotSpot parts of `tier2` and `tier3`

Looks good!

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

> 159:   CHeapBitMap _mask;
> 160:   bool _valid;
> 161:   bool _set;

I suggest to also name this field `_mask_set` to match the accessor function `is_mask_set()`. 
Suggestion:

  bool _mask_set;

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

> 180:         _valid = false;
> 181:       } else if (PHASE_ALL == cpt) {
> 182:         _mask.set_range(0,PHASE_NUM_TYPES);

Suggestion:

        _mask.set_range(0, PHASE_NUM_TYPES);

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16729#pullrequestreview-1739620419
PR Review Comment: https://git.openjdk.org/jdk/pull/16729#discussion_r1399083830
PR Review Comment: https://git.openjdk.org/jdk/pull/16729#discussion_r1399084597


More information about the hotspot-compiler-dev mailing list