RFR: 8331311: C2: Big Endian Port of 8318446: optimize stores into primitive arrays by combining values into larger store [v4]

Richard Reingruber rrich at openjdk.org
Wed Jun 5 07:34:01 UTC 2024


On Wed, 5 Jun 2024 07:27:04 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>> I'm running testing again, but the code looks good now!
>> 
>> I just had another idea:
>> Could we use some sort of "byte reverse / shuffle" operation to do these use cases for both big/little-endian?
>> 
>> 
>>         storeBytes(bytes, offset, (byte)(value >> 8),
>>                                   (byte)(value >> 0));
>> 
>>         storeBytes(bytes, offset, (byte)(value >> 0),
>>                                   (byte)(value >> 8));
>> 
>> 
>> Not sure if that would be profitable or even available on all platforms. Could be a future RFE someone can work on after this. What do you think? It might make performance more predictable across platforms.
>
>> I'm running testing again, but the code looks good now!
>> 
>> I just had another idea: Could we use some sort of "byte reverse / shuffle" operation to do these use cases for both big/little-endian?
>> 
>> ```
>>         storeBytes(bytes, offset, (byte)(value >> 8),
>>                                   (byte)(value >> 0));
>> 
>>         storeBytes(bytes, offset, (byte)(value >> 0),
>>                                   (byte)(value >> 8));
>> ```
>> 
>> Not sure if that would be profitable or even available on all platforms. Could be a future RFE someone can work on after this. What do you think? It might make performance more predictable across platforms.
> 
> You mean to combine the stores even if the explicit ordering does not match the ordering of the store instruction, adding a `ReverseBytes[SIL]Node` iff supported in that case, right? I've been thinking about this, too. In my opinion it would be worthwhile.

> @reinrich please still wait until the JDK24 fork on Thrusday to integrate, so that we do not have to backport possible regression fixes - I had 3 or 4 with my original patch ;)

Thanks for the reviews @eme64 and @vnkozlov! I'll integrate after the code split if more local testing is successful.

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

PR Comment: https://git.openjdk.org/jdk/pull/19218#issuecomment-2149082168


More information about the hotspot-compiler-dev mailing list