RFR: 8339799: Reduce work done in j.l.invoke bytecode generators

Claes Redestad redestad at openjdk.org
Mon Sep 9 22:59:32 UTC 2024


Misc improvements to InnerClassLambdaMetafactory and InvokerBytecodeGenerator:
- Define `ClassEntry` early, use it when profitable (there are some warts in the API where using `ce.name(), ce.type()` in a few places means we drop the link to the `ClassDesc` which will then be re-spun in later - should be revisited)
- Use `mh.invokeBasic()` for zero-arg non-capturing lambda constructor calls(!) 
- Narrow name validation to the name passed in
- We were calling `classDesc` twice per factoryType argument, refactored to reuse `argDescs`. 

Interpreter instrumentation sees 1.5% less bytecode executed on netty startup tests, -2.5% on minimal lambda test. Part of the https://bugs.openjdk.org/browse/JDK-8338542 ClassFile API startup work.

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

Commit messages:
 - Fix comment
 - Use invokeBasic for non-capturing lambdas, other minor opts
 - Improve reuse of ClassEntry in j.l.invoke class builders

Changes: https://git.openjdk.org/jdk/pull/20925/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20925&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8339799
  Stats: 26 lines in 2 files changed: 5 ins; 1 del; 20 mod
  Patch: https://git.openjdk.org/jdk/pull/20925.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20925/head:pull/20925

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


More information about the core-libs-dev mailing list