RFR: 8340710: Optimize DirectClassBuilder::build
Shaojin Wen
swen at openjdk.org
Tue Sep 24 01:15:16 UTC 2024
On Mon, 23 Sep 2024 00:33:26 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Do some refactoring so that the code can be inlined by the C1/C2 optimizer.
>>
>> 1. DirectClassBuilder::build codeSize 361 -> 315
>> 2. DirectCodeBuilder::writeExceptionHandlers codeSize 183 -> 31
>> 3. BufWriterImpl::writeIndex codeSize 62 -> 37 (forceinline)
>> 4. BufWriterImpl::writeU2 (forceinline)
>> 5. Util::writeAttributes codSize 45 -> 40 (forceinline)
>> 6. Util::writeList codSize 47 -> 42 (forceinline)
>
> src/java.base/share/classes/jdk/internal/classfile/impl/BufWriterImpl.java line 99:
>
>> 97: }
>> 98:
>> 99: void writeMagic(int minorVersion, int majorVersion) {
>
> Can we call this `writeHeader` as this writes both the magic and the version?
Now, through the local variable constantPool, codeSize < 325 can be achieved without extracting a separate method.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21118#discussion_r1771513668
More information about the core-libs-dev
mailing list