RFR: 8313332: Simplify lazy jmethodID cache in InstanceKlass

Coleen Phillimore coleenp at openjdk.org
Mon Apr 1 12:15:57 UTC 2024


This change simplifies the code that grows the jmethodID cache in InstanceKlass.  Instead of lazily, when there's a rare request for a jmethodID for an obsolete method, the jmethodID cache is grown during the RedefineClasses safepoint.  The InstanceKlass's jmethodID cache is lazily allocated when there's a jmethodID allocated, so not every InstanceKlass has a cache, but the growth now only happens in a safepoint.  This code will become racy with the potential change for deallocating jmethodIDs.

Tested with tier1-4, vmTestbase/nsk/jvmti java/lang/instrument tests (in case they're not in tier1-4).

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

Commit messages:
 - Add Safepoint assert, don't use order accessors because they're not needed.
 - 8313332: Simplify lazy jmethodID cache in InstanceKlass

Changes: https://git.openjdk.org/jdk/pull/18549/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18549&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8313332
  Stats: 222 lines in 7 files changed: 41 ins; 144 del; 37 mod
  Patch: https://git.openjdk.org/jdk/pull/18549.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18549/head:pull/18549

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


More information about the serviceability-dev mailing list