RFR: 8369167: C2: refactor LShiftINode/LShiftLNode Value/Identity/Ideal [v2]

Marc Chevalier mchevalier at openjdk.org
Fri Oct 10 12:20:38 UTC 2025


On Fri, 10 Oct 2025 08:44:24 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> This change refactor code that's similar for LShiftINode and
>> LShiftLNode into shared methods. I also added extra test cases to
>> cover all transformations.
>
> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   sort headers

Testing looks good (up to the now fixed inclusion order). I'm happy: it looks good, it's significant sharing, it's no giving some unreadable code that keeps making cases between long and int, nice new tests...

An idea (not a suggestion, just something that crossed my mind, take it more as a thought experiment): we could also parametrize everything not with a `BasicType` parameter but a template parameter (since `IdealIL` and co are invoked with literal values). It wouldn't change much, but for instance it would allow to replace the assert in `java_shift_left` and friends with static checks (I have a bias toward static checks).

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

Marked as reviewed by mchevalier (Committer).

PR Review: https://git.openjdk.org/jdk/pull/27725#pullrequestreview-3323043825


More information about the hotspot-dev mailing list