RFR: 8353551: C2: Constant folding for ReverseBytes nodes [v2]
Hannes Greule
hgreule at openjdk.org
Thu Apr 10 06:55:25 UTC 2025
On Wed, 9 Apr 2025 17:56:06 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>>> And I assume that should be a TypeNode then?
>>
>> Why do you think it benefits from becoming a `TypeNode`?
>>
>>> In that case, as ReverseBytes*Nodes are InvolutionNodes, would InvolutionNode need to be a TypeNode? Or can I use multiple inheritance?
>>
>> We try to avoid multiple inheritance in JVM and C2 doesn't use any AFAIK.
>>
>> Actually, I had an afterthought about `InvolutionNode` after approving it. It looks a bit weird to model "involution" property through inheritance. (Primarily, because it's hard to mix multiple properties.) Node flags would be a better fit IMO.
>
> For now, I suggest to just add a superclass`ReverseBytesNode` which extends `InvolutionNode` and place `Value` there.
> Why do you think it benefits from becoming a `TypeNode`?
Oh yeah I somehow confused myself there successfully.
> Actually, I had an afterthought about `InvolutionNode` after approving it. It looks a bit weird to model "involution" property through inheritance. (Primarily, because it's hard to mix multiple properties.) Node flags would be a better fit IMO.
That would work, although it would make the common implementation more difficult I think. Also AddNode similarly models the "addition in a (semi)-ring" property, but there's clearly more shared code there (and the property can't be modeled as a flag there because the respective multiplicative operation is defined there too).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24382#discussion_r2036632744
More information about the hotspot-compiler-dev
mailing list