RFR: 8341141: Optimize DirectCodeBuilder [v19]

Chen Liang liach at openjdk.org
Thu Oct 3 13:10:39 UTC 2024


On Wed, 2 Oct 2024 04:32:10 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Some DirectCodeBuilder related optimizations to improve startup and running performance:
>> 1. Merge calls, merge writeU1 and writeU2 into writeU3
>> 2. Merge calls, merge writeU1 and writeIndex operations
>> 3. Directly use writeU1 instead of writeBytecode
>> 4. Rewrite the implementation of load and store
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix merge error

src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java line 33:

> 31: 
> 32: public class AttributeHolder {
> 33:     private static Attribute<?>[] EMPTY_ATTRIBUTE_ARRAY = {};

Suggestion:

    private static final Attribute<?>[] EMPTY_ATTRIBUTE_ARRAY = {};

src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java line 51:

> 49:                     attributesCount--;
> 50:                     System.arraycopy(attributes, i + 1, attributes, i, attributesCount - i);
> 51:                 }

Suggestion:

                    break;
                }

We can just break when wew find the attribute as thia mapper already prevents the attribute from appearing more than once.```

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21243#discussion_r1786189079
PR Review Comment: https://git.openjdk.org/jdk/pull/21243#discussion_r1786192222


More information about the core-libs-dev mailing list