RFR: 8338544: Dedicated Array class descriptor implementation [v2]

Mandy Chung mchung at openjdk.org
Tue Oct 8 18:30:03 UTC 2024


On Tue, 8 Oct 2024 01:13:37 GMT, Chen Liang <liach 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.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains nine commits:
> 
>  - class or interface descriptor renamed for clarity
>  - Merge branch 'master' of https://github.com/openjdk/jdk into feature/array-cd
>  - Cleanup after merge
>  - Merge branch 'master' of https://github.com/openjdk/jdk into feature/array-cd
>  - Merge branch 'master' of https://github.com/openjdk/jdk into feature/array-cd
>  - Compile error
>  - Redundant import
>  - Merge branch 'master' of https://github.com/openjdk/jdk into feature/array-cd
>  - 8338544: Dedicated Array class descriptor implementation

Looks good with minor suggestion.  I agree having a separate implementation class for array type and class/interface allows a cleaner subclass implementation.

src/java.base/share/classes/jdk/internal/constant/ArrayClassDescImpl.java line 45:

> 43:  */
> 44: public final class ArrayClassDescImpl implements ClassDesc {
> 45:     private final ClassDesc element;

Suggestion:

    private final ClassDesc elementType;

src/java.base/share/classes/jdk/internal/constant/ArrayClassDescImpl.java line 81:

> 79:             throw new IllegalStateException(
> 80:                 "Cannot create an array type descriptor with more than "
> 81:                         + MAX_ARRAY_TYPE_DESC_DIMENSIONS + " dimensions");

Suggestion:

        ConstantUtils.validateArrayDepth(rank + 1);

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

Marked as reviewed by mchung (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20665#pullrequestreview-2355186246
PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1792299237
PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1792314209


More information about the core-libs-dev mailing list