RFR: 8330681: Explicit hashCode and equals for java.lang.runtime.SwitchBootstraps$TypePairs

Claes Redestad redestad at openjdk.org
Fri Apr 19 13:30:27 UTC 2024


We can reduce overhead of first use of a switch bootstrap by moving `typePairToName` into `TypePairs` and by explicitly overriding `hashCode` and `equals`. The first change avoids loading and initializing the `TypePairs` class in actual cases, the second remove some excess code generation from happening on first use.

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

Commit messages:
 - Move typePairToName to TypePairs to make this lazy loaded
 - Explicit hashCode and equals for SwitchBootstraps

Changes: https://git.openjdk.org/jdk/pull/18865/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18865&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8330681
  Stats: 18 lines in 1 file changed: 14 ins; 3 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/18865.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18865/head:pull/18865

PR: https://git.openjdk.org/jdk/pull/18865


More information about the core-libs-dev mailing list