RFR: JDK-8268088: Clarify Method::clear_jmethod_ids() related comments in ClassLoaderData::~ClassLoaderData()

Evgeny Astigeevich github.com+42899633+eastig at openjdk.java.net
Mon Jun 7 11:26:12 UTC 2021


On Mon, 7 Jun 2021 03:31:58 GMT, Jiangli Zhou <jiangli at openjdk.org> wrote:

> This PR clarifies Method::clear_jmethod_ids() related comments in ClassLoaderData::~ClassLoaderData(). It adds more explanations on why Method::clear_jmethod_ids only sets the jmethod_ids to NULL without releasing the memory for related JNIMethodBlocks and JNIMethodBlockNodes.

src/hotspot/share/classfile/classLoaderData.cpp line 699:

> 697:   // Method::clear_jmethod_ids only sets the jmethod_ids to NULL without
> 698:   // releasing the memory for related JNIMethodBlocks and JNIMethodBlockNodes.
> 699:   // This is done intentionally because native code (e.g. JVMTI agent) obtains

Maybe rewriting to "native code (...) holding jmethod_ids may access..." would be clearer?

src/hotspot/share/classfile/classLoaderData.cpp line 701:

> 699:   // This is done intentionally because native code (e.g. JVMTI agent) obtains
> 700:   // jmethod_ids may access them after the associated classes and class loader
> 701:   // are unloaded. The Java native Interface Specification says "method ID

"native" -> "Native"

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

PR: https://git.openjdk.java.net/jdk/pull/4383


More information about the hotspot-runtime-dev mailing list