On Wed, 21 Aug 2024 20:25:07 GMT, Chen Liang <li...@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.

Apparently, changing method `default`‑ness requires a CSR (even for fully 
sealed hierarchies), but I can’t find the PR where I was informed of this.

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

Using `return this instanceof <type>ClassDescImpl` might allow **C2** to better 
avoid megamorphic virtual invocations (see [GH‑17488]), but this needs to be 
benchmarked:

[GH‑17488]: https://github.com/openjdk/jdk/pull/17488

src/java.base/share/classes/java/lang/constant/ClassDesc.java line 237:

> 235:      */
> 236:     default boolean isArray() {
> 237:         return false;

Suggestion:

        return this instanceof ArrayClassDescImpl;

src/java.base/share/classes/java/lang/constant/ClassDesc.java line 246:

> 244:      */
> 245:     default boolean isPrimitive() {
> 246:         return false;

Suggestion:

        return this instanceof PrimitiveClassDescImpl;

src/java.base/share/classes/java/lang/constant/ClassDesc.java line 255:

> 253:      */
> 254:     default boolean isClassOrInterface() {
> 255:         return false;

Suggestion:

        return this instanceof ReferenceClassDescImpl;

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

PR Review: https://git.openjdk.org/jdk/pull/20665#pullrequestreview-2263259130
PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1732794261
PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1732794721
PR Review Comment: https://git.openjdk.org/jdk/pull/20665#discussion_r1732795070

Reply via email to