RFR: 8316587: Use ArraysSupport.vectorizedHashCode in Utf8EntryImpl [v2]
Claes Redestad
redestad at openjdk.org
Thu Sep 21 19:35:11 UTC 2023
On Thu, 21 Sep 2023 13:55:18 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/classfile/impl/AbstractPoolEntry.java line 236:
>>
>>> 234: private void inflate() {
>>> 235: int singleBytes = JLA.countPositives(rawBytes, offset, rawLen);
>>> 236: int hash = ArraysSupport.vectorizedHashCode(rawBytes, offset, singleBytes, 0, ArraysSupport.T_BOOLEAN);
>>
>> We should keep in mind that this code is on lambdas bootstrap critical path.
>> Any foreign code may involve lambdas or method references and cause dead end in lambdas initialization after JDK-8294960.
>
> This is safe: these two functions are already used in String itself (see StringLatin1) which is definitely loaded and initialized before Classfile API and its implementations are.
Agreed w.r.t bootstrap safety: `countPositives` and `vectorizedHashCode` are straightforward java routines used by `String` and others very early in the bootstrap sequence. The speed-up they bring come from being intrinsified by the JIT.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15837#discussion_r1333516133
More information about the core-libs-dev
mailing list