JDK-8313332 : Simplify lazy jmethodID cache in InstanceKlass
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-07-28
  • Updated: 2024-05-15
  • Resolved: 2024-04-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b18Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
InstanceKlass has a jmethodID cache that lazily grows after redefinition upon request for a new jmethodID.  This lazy growth is because for obsolete methods, the method idnum is incremented.
This lazy growth requires that jmethodIDs may have to be deleted if there's a race in creating them.
Since redefinition is at a safepoint, we can just extend the jmethodID cache then since we know the count.
Comments
Changeset: 21867c92 Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2024-04-04 13:15:12 +0000 URL: https://git.openjdk.org/jdk/commit/21867c929a2f2c961148f2cd1e79d672ac278d27
04-04-2024

A little bit of history: Looks like the jmethodID stuff was originally added via: JDK-6404550 Cannot implement late attach in NetBeans Profiler due to missing functionality in JVMTI integrated on 2006.05.03 in JDK6-B83 The code was modified quite a bit via: JDK-6447640 methodOopDesc::jmethod_id() can deadlock when used by the VMThread integrated on 2006.07.26 in JDK6-B93 The code was modified quite a bit via: JDK-6453355 new No_Safepoint_Verifier uses fail during GC integrated on 2008.01.25 in JDK7-B25. The code was modified via: JDK-6419370 new jmethodID code has tiny holes in synchronization integrated on 2009.09.21 in HSX-17-B02. There were some other minor bug fixes and the whole conversion of meta-data storage to use native memory, but I didn't want to further complicate the history with those fixes.
03-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18549 Date: 2024-03-29 15:25:48 +0000
01-04-2024

[~jbachorik] Since you are now an expert, I have a patch that simply resizes the InstanceKlass jmethodID cache during redefinition and not dynamically. Draft PR. Holding it because I was busy with other things. https://github.com/openjdk/jdk/pull/16865
28-11-2023