RFR: 8338544: Dedicated Array class descriptor implementation

Chen Liang liach at openjdk.org
Wed Sep 25 20:03:35 UTC 2024


On Wed, 25 Sep 2024 19:53:13 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> @cl4es discovered that Stack Map generation in ClassFile API uses `componentType` and `arrayType` for `aaload` `aastore` instructions, which are currently quite slow. We can split out array class descriptors from class or interfaces to support faster `arrayType` and `componentType` operations.
>> 
>> Tentative, as I currently have no way to measure the actual impact of this patch on the startup performance; however, this made the `ClassDesc` implementations much cleaner.
>
> src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java line 79:
> 
>> 77:     private static final ClassDesc CD_LambdaForm_Name = ReferenceClassDescImpl.ofValidated("Ljava/lang/invoke/LambdaForm$Name;");
>> 78:     private static final ClassDesc CD_LoopClauses = ReferenceClassDescImpl.ofValidated("Ljava/lang/invoke/MethodHandleImpl$LoopClauses;");
>> 79:     private static final ClassDesc CD_Object_array  = CD_Object.arrayType();
> 
> I guess `CD_Object.arrayType()` shows up often enough now - even once _in_ `java.lang.constant.ConstantDescs` - that we might as well pin it down as a constant somewhere (`ConstantDescs` is a candidate location, but that will take a CSR).

This patch already has a CSR for trivial signature changes. The real difficulty lies in how we should name our new array class descriptors, `Object_array` or `ObjectArray` or what else?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1775924591


More information about the core-libs-dev mailing list