On Wed, 21 Aug 2024 20:25:07 GMT, Chen Liang <[email protected]> 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.
LGTM. Always a bit queasy to add a third to a nice pair of classes, but if this
ever shows up as a problem on benchmarks we can revisit and think of
alternatives (such as adding a rank field in each impl).
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).
-------------
Marked as reviewed by redestad (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20665#pullrequestreview-2329407468
PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1775916278