<i18n dev> RFR: 8332826: Make hashCode methods in ArraysSupport friendlier [v2]

Claes Redestad redestad at openjdk.org
Tue May 28 20:24:01 UTC 2024


On Tue, 28 May 2024 19:19:51 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix incorrect utf16 hashCode adaptation
>
> test/hotspot/jtreg/compiler/intrinsics/TestArraysHashCode.java line 88:
> 
>> 86:     private static int testIntrinsic(byte[] bytes, int type)
>> 87:             throws InvocationTargetException, IllegalAccessException {
>> 88:         return (int) vectorizedHashCode.invoke(null, bytes, 0, 256, 1, type);
> 
> Better to just call `hashCodeOfUnsigned` here I think.
> 
> The test for the non-constant type could be dropped. That is no longer a part of the 'API' of `ArraySupport`. It looks like the intrinsic bails out when the basic type is not constant any ways: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/library_call.cpp#L6401-L6404

The non-constant test was added because that very bailout caused a crash. The other test is actually less interesting since it'll likely be covered indirectly by regular use. But as we are hiding these away this gets ever more obscure and perhaps the test could be dropped entirely.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19414#discussion_r1617848032


More information about the i18n-dev mailing list