On Wed, 29 May 2024 03:21:27 GMT, Chen Liang <li...@openjdk.org> wrote:
>> 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. This is a cleanup/refactoring PR, so none of this is necessary. My motivation for the `Object[]` variant was to provide reusable functionality for methods like these: - https://github.com/openjdk/jdk/blob/0ef03f122866f010ebf50683097e9b92e41cdaad/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArrayList.java#L1076-L1083 - https://github.com/openjdk/jdk/blob/0ef03f122866f010ebf50683097e9b92e41cdaad/src/java.base/share/classes/java/util/ArrayList.java#L669-L680 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19414#discussion_r1618644177