RFR: 8339132: Make DirectCodeBuilder write through without allocating instruction objects

Andrey Turbanov aturbanov at openjdk.org
Wed Aug 28 19:30:21 UTC 2024


On Wed, 28 Aug 2024 01:49:21 GMT, Chen Liang <liach at openjdk.org> wrote:

> Make `DirectCodeBuilder` write instructions actually directly without allocating extra objects. This speed up a lot of simple Class-File building cases that never go through intermediate transforms.

src/java.base/share/classes/java/lang/classfile/CodeBuilder.java line 657:

> 655:                 };
> 656:             if (value instanceof Long lVal)
> 657:                 return lVal == 0l ? lconst_0()

Suggestion:

                return lVal == 0L ? lconst_0()

src/java.base/share/classes/java/lang/classfile/CodeBuilder.java line 658:

> 656:             if (value instanceof Long lVal)
> 657:                 return lVal == 0l ? lconst_0()
> 658:                         : lVal == 1l ? lconst_1()

Suggestion:

                        : lVal == 1L ? lconst_1()

src/java.base/share/classes/java/lang/classfile/CodeBuilder.java line 666:

> 664:                         : ldc(constantPool().floatEntry(fVal));
> 665:             if (value instanceof Double dVal)
> 666:                 return Double.doubleToRawLongBits(dVal) == 0l ? dconst_0()

Suggestion:

                return Double.doubleToRawLongBits(dVal) == 0L ? dconst_0()

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20738#discussion_r1735187162
PR Review Comment: https://git.openjdk.org/jdk/pull/20738#discussion_r1735187339
PR Review Comment: https://git.openjdk.org/jdk/pull/20738#discussion_r1735187623


More information about the core-libs-dev mailing list