RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]

Claes Redestad redestad at openjdk.org
Tue Dec 20 19:57:55 UTC 2022


On Fri, 16 Dec 2022 22:58:23 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Missing & 0xff in StringLatin1::hashCode
>
> src/hotspot/cpu/x86/vm_version_x86.cpp line 1671:
> 
>> 1669:   }
>> 1670:   if (UseAVX >= 2) {
>> 1671:     FLAG_SET_ERGO_IF_DEFAULT(UseVectorizedHashCodeIntrinsic, true);
> 
> This could be just FLAG_SET_DEFAULT instead of FLAG_SET_ERGO_IF_DEFAULT.

Right, it seems HW-dependent intrinsics in generally doesn't mark that they've been enabled ergonomically, rather just make it on "by default" when support is available.

> src/java.base/share/classes/java/lang/StringUTF16.java line 418:
> 
>> 416:             return 0;
>> 417:         } else {
>> 418:             return ArraysSupport.vectorizedHashCode(value, ArraysSupport.UTF16);
> 
> Special case for 1 missing here.

Intentionally left out. Array length is always even for `UTF16` arrays, but we could add a case for `2` that'd return `getChar(bytes, 0)` but I didn't see much of a win when I tested this.

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

PR: https://git.openjdk.org/jdk/pull/10847


More information about the hotspot-dev mailing list