RFR: 8335252: ForceInline j.u.Formatter.Conversion#isValid [v3]

Claes Redestad redestad at openjdk.org
Fri Jun 28 12:36:24 UTC 2024


On Fri, 28 Jun 2024 11:27:47 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> Currently, the java.util.Formatter$Conversion::isValid method is implemented based on switch, which cannot be inlined because codeSize > 325. This problem can be avoided by implementing it with ImmutableBitSetPredicate.
>> 
>> use `-XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining` to see the master branch:
>> 
>> @ 109   java.util.Formatter$Conversion::isValid (358 bytes)   failed to inline: hot method too big
>> 
>> 
>> current version
>> 
>> @ 109   java.util.Formatter$Conversion::isValid (10 bytes)   inline (hot)
>>   @ 4   jdk.internal.util.ImmutableBitSetPredicate$SmallImmutableBitSetPredicate::test (50 bytes)   inline (hot)
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove ForceInline

This looks better. Avoids a branch up front, minimized code changes. The comment is good, but perhaps move it down into the default case? 

Update bug description to something like "Reduce size of j.u.Formatter.Conversion#isValid" ?

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

PR Comment: https://git.openjdk.org/jdk/pull/19926#issuecomment-2196808696


More information about the core-libs-dev mailing list