JDK-8335252 : Reduce size of j.u.Formatter.Conversion#isValid
  • Type: Enhancement
  • Component: core-libs
  • Affected Version: 17,21,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-06-27
  • Updated: 2025-06-16
  • 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 17 JDK 21 JDK 24
17.0.17Fixed 21.0.9Fixed 24 b05Fixed
Related Reports
Relates :  
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
[jdk21u-fix-request] Approval Request from Paul Hohensee Clean backport to fix a regression resulting from [JDK-8263038](https://bugs.openjdk.org/browse/JDK-8263038). No semantic change, test/jdk/java/util/Formatter tests pass.
23-05-2025

[jdk17u-fix-request] Approval Request from Paul Hohensee Clean backport to fix a regression resulting from [JDK-8263038](https://bugs.openjdk.org/browse/JDK-8263038). No semantic change, test/jdk/java/util/Formatter tests pass.
23-05-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/1827 Date: 2025-05-22 20:59:08 +0000
22-05-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/3609 Date: 2025-05-22 20:54:37 +0000
22-05-2025

This looks like a fix for regression from JDK-8263038.
11-07-2024

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