RFR: 8338906: Avoid passing EnumDescs and extra classes to type switch methods that don't use them

Claes Redestad redestad at openjdk.org
Fri Aug 23 12:38:11 UTC 2024


This PR refactors SwitchBootstraps so that extra EnumDescs and classes are only passed into bootstraps when needed. Benchmarking shows that in many cases these are not needed, and avoiding passing them (via binding in the lists via `MethodHandle::insertArguments`) avoids some auxiliary MH combinator generation during bootstrap. 

Additional cleanups and refactoring further reduce bootstrap overhead and number of classes loaded.

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

Commit messages:
 - Logic fix, improve documentation
 - Improve comments, remove stray debug scaffolding
 - Avoid binding in lists of EnumDesc and extra classes in type switches when not needed

Changes: https://git.openjdk.org/jdk/pull/20693/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20693&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8338906
  Stats: 95 lines in 1 file changed: 44 ins; 10 del; 41 mod
  Patch: https://git.openjdk.org/jdk/pull/20693.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20693/head:pull/20693

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


More information about the core-libs-dev mailing list