RFR: 8340456: Reduce overhead of proxying Object methods in ProxyGenerator

Claes Redestad redestad at openjdk.org
Thu Sep 19 14:15:21 UTC 2024


This PR changes proxy code gen to avoid generating `Class.forName("java.lang.Object")`, instead emitting an ldc for the class literal, `ldc(CD_Object)`, java code equivalent `Object.class`. 

More types could profitably use `ldc(ClassDesc/-Entry)`, taking cues from `InvokerBytecodeGenerator.isStaticallyInvocable`, but just addressing the `Object` methods gets rid of most `Class.forName` emits. It's not terribly important for throughput performance since these are called in the generated `clinit`, so getting a quick win with few additional checks is a good starting point.

Added a few unrelated minor refactors/improvements, guided by diagnostic runs of the now fixed microbenchmark.

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

Commit messages:
 - Merge branch 'master' into proxy_codeClass_ProxyPerf
 - Minor improvements
 - Refactor
 - Tune warmup and measurement time for ProxyGeneratorBench
 - rename and improve Proxy micros
 - Fix ProxyPerf microbenchmark and micro-optimize codeClassForName

Changes: https://git.openjdk.org/jdk/pull/21090/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21090&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8340456
  Stats: 327 lines in 4 files changed: 146 ins; 166 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/21090.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21090/head:pull/21090

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


More information about the core-libs-dev mailing list