On Wed, 16 Oct 2024 05:58:08 GMT, Chen Liang <[email protected]> wrote:

>> src/java.base/share/classes/jdk/internal/classfile/impl/AbstractPoolEntry.java
>>  line 609:
>> 
>>> 607:             var mySym = this.sym;
>>> 608:             if (mySym != null)
>>> 609:                 return mySym.equals(symbol);
>> 
>> Note that `ClassEntry::asSymbol()` also caches array `ClassDesc`s in 
>> `ref1.typeSym` so that the symbol cache can be shared with `FieldRefEntry` 
>> and `ConstantDynamicEntry`.
>> 
>> --------------------------------------------------------------------------------
>> 
>> I suggest adding the following check:
>> 
>> if (ref1.typeSym instanceof ClassDesc ref1Sym && ref1Sym.isArray()) {
>>      return ref1Sym.equals(symbol);
>> }
>
> I think adding this on the sym present hot path might be too costly. A better 
> way is to pull in the sym before `ref1.equalsString` and push the compatible 
> symbol back to utf8 if we have `equals`.

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21526#discussion_r1803436476

Reply via email to