RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]

Yi Yang yyang at openjdk.java.net
Tue Apr 6 03:23:29 UTC 2021


On Tue, 6 Apr 2021 03:09:57 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> The type of jmethod_ids  is JNIMethodBlock, which is declared in `method.cpp`, we have to access its internal fields via print_jmethod_ids that declared in `method.hpp`.  But if we only want to show jmethod_ids's address, then we can remove Method::print_jmethod_ids and print it directly. I'm not sure if others think jmethod_ids._count is important for their debugging, so I keep unchanged :)
>
> Sorry I don't see your point. I am suggesting that this:
> 
> out->print   (" - jmethod count       ");
> Method::print_jmethod_ids(this, out);
> out->print_cr("");
> 
> be replaced by:
> 
> out->print_cr(" - jmethod count       %d", this->jmethod_ids()->count_methods());

Hi David,

I means, `count_methods()` is inaccessible from classLoaderDataGraph.cpp because `this->jmethod_ids()` is type of JNIMethodBlock, it was defined in **method.cpp**, i.e.:
// method.cpp
class JNIMethodBlock {
...
public:
int count_methods(){...}
}
In order to access count_methods, we have to add an API in method.hpp and method.cpp:
// method.cpp
class JNIMethodBlock {
...
int count_methods(){...}
}

void Method::print_jmethod_ids(JNIMethodBlock* block,...){
  block->count_methods();
  ....
}
// method.hpp
void Method::print_jmethod_ids(JNIMethodBlock* block,...);
Thanks~
Yang

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

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


More information about the hotspot-dev mailing list