On Mon, 27 May 2024 20:55:29 GMT, Pavel Rappo <pra...@openjdk.org> wrote:

>> Please review this PR, which supersedes a now withdrawn 
>> https://github.com/openjdk/jdk/pull/14831.
>> 
>> This PR replaces `ArraysSupport.vectorizedHashCode` with a set of more 
>> user-friendly methods. Here's a summary:
>> 
>> - Made the operand constants (i.e. `T_BOOLEAN` and friends) and the 
>> `vectorizedHashCode` method private
>> 
>> - Made the `vectorizedHashCode` method private, but didn't rename it. 
>> Renaming would dramatically increase this PR review cost, because that 
>> method's name is used by a lot of VM code. On a bright side, since the 
>> method is now private, it's no longer callable by clients of 
>> `ArraysSupport`, thus a problem of an inaccurate name is less severe.
>> 
>> - Made the `ArraysSupport.utf16HashCode` method private
>> 
>> - Moved tiny cases (i.e. 0, 1, 2) to `ArraysSupport`
>
> Pavel Rappo has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fix incorrect utf16 hashCode adaptation

src/java.base/share/classes/jdk/internal/util/ArraysSupport.java line 320:

> 318:      * @return the calculated hash value
> 319:      */
> 320:     public static int hashCode(Object[] a, int fromIndex, int length, 
> int initialValue) {

Is the object variant necessary here? The object version is hard for JIT to 
profile as it's quite polymorphic compared to other arrays, and the initial 
value is always 1.

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

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

Reply via email to