RFR: 8331291: java.lang.classfile.Attributes class performs a lot of static initializations
Brian Goetz
brian.goetz at oracle.com
Tue Apr 30 12:44:34 UTC 2024
StableValue is coming soon, and the attributes is a great candidate for
a lazy StableValue map.
On 4/30/2024 7:58 AM, Adam Sotona wrote:
>
> Hi,
> During performance optimization work on Class-File API as JDK lambda
> generator we found some static initialization killers.
> One of them is `java.lang.classfile.Attributes` with tens of static
> fields initialized with individual attribute mappers, and common set
> of all mappers, and static map from attribute names to the mappers.
>
> I propose to turn all the static fields into lazy-initialized static
> methods and remove `PREDEFINED_ATTRIBUTES` and
> `standardAttribute(Utf8Entry name)` static mapping method from the
> `Attributes` API class.
>
> Please let me know your comments or objections and please review the
> [PR](https://github.com/openjdk/jdk/pull/19006) and
> [CSR](https://bugs.openjdk.org/browse/JDK-8331414), so we can make it
> into 23.
>
> Thank you,
> Adam
>
> -------------
>
> Commit messages:
> - added impl comment
> - removed list of predefined attributes
> - move mappers implementations to AbstractAttributeMapper
> - 8331291: java.lang.classfile.Attributes class performs a lot of
> static initializations
>
> Changes: https://git.openjdk.org/jdk/pull/19006/files
> Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19006&range=00
> <https://webrevs.openjdk.org/?repo=jdk&pr=19006&range=00>
> Issue: https://bugs.openjdk.org/browse/JDK-8331291
>
> CSR: https://bugs.openjdk.org/browse/JDK-8331414
> Stats: 2029 lines in 47 files changed: 904 ins; 619 del; 506 mod
> Patch: https://git.openjdk.org/jdk/pull/19006.diff
> Fetch: git fetch https://git.openjdk.org/jdk.git
> pull/19006/head:pull/19006
>
> PR: https://git.openjdk.org/jdk/pull/19006
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20240430/700fc0a4/attachment.htm>
More information about the classfile-api-dev
mailing list