JDK-8335252 : Reduce size of j.u.Formatter.Conversion#isValid
  • Type: Enhancement
  • Component: core-libs
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-06-27
  • Updated: 2024-06-28
  • Resolved: 2024-06-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 masterFixed
Description
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)
Comments
Changeset: 5d866bf1 Author: Shaojin Wen <shaojin.wensj@alibaba-inc.com> Committer: Chen Liang <liach@openjdk.org> Date: 2024-06-28 22:27:34 +0000 URL: https://git.openjdk.org/jdk/commit/5d866bf17d96bd0f0e4545d7eee5912eda2e3a94
28-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/19926 Date: 2024-06-27 11:14:30 +0000
27-06-2024