RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]
David Holmes
dholmes at openjdk.java.net
Tue Apr 6 04:19:30 UTC 2021
On Tue, 6 Apr 2021 03:20:08 GMT, Yi Yang <yyang at openjdk.org> wrote:
>> 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
Ah I see. In that case I'd suggest adding an API to get the count. If external code knows enough about jmethod_ids that it knows to print the count, then the count is worth exposing IMO. Otherwise restore the actual "jmethod count" text to the print function so it's a stand-alone print function again.
Aside: print_jmethod_ids() is badly named given it doesn't print any id's.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3323
More information about the hotspot-dev
mailing list