RFR: 8351468: C2: array fill optimization assigns wrong type to intrinsic call
Quan Anh Mai
qamai at openjdk.org
Thu Mar 13 15:23:55 UTC 2025
On Thu, 13 Mar 2025 12:31:14 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:
>>> A store of a char value into a long[] array would be represented at the IR level as a conversion (ConvI2L) followed by a StoreL, no?
>>
>> No, a code such as this `MemorySegment.ofArray(longArray).set(ValueLayout.JAVA_SHORT, offset, c)` would produce a `StoreC` into a `long[]`.
>
>> > A store of a char value into a long[] array would be represented at the IR level as a conversion (ConvI2L) followed by a StoreL, no?
>>
>> No, a code such as this `MemorySegment.ofArray(longArray).set(ValueLayout.JAVA_SHORT, offset, c)` would produce a `StoreC` into a `long[]`.
>
> Right, in this case I interpret from the [comment at the declaration of `MemNode::memory_type()`](https://github.com/openjdk/jdk/blob/375722f4ab62865c45d8d76f01dc9c7209be57c8/src/hotspot/share/opto/memnode.hpp#L136) that the `memory_type()` of the StoreC node should be `T_SHORT` (the type of the value stored by the node), as opposed to the current `T_CHAR`. I propose to address this in a separate RFE.
@robcasloz I disagree, I would expect the `memory_type` of a `StoreC` into a `long[]` to be something that means "a part of a `long[]`", which should be `T_LONG` if the store is guaranteed to be enclosed in a single `long`, or `T_VOID` otherwise.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24005#issuecomment-2721644366
More information about the hotspot-compiler-dev
mailing list