Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph #3323

Closed
wants to merge 6 commits into from
Closed
Changes from 2 commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -949,8 +949,8 @@ void ClassLoaderData::print_on(outputStream* out) const {
_holder.print_on(out);
out->print_cr("");
}
out->print_cr(" - class loader %p", _class_loader.ptr_raw());
out->print_cr(" - metaspace %p", _metaspace);
out->print_cr(" - class loader " PTR_FORMAT, p2i(_class_loader.ptr_raw()));

This comment has been minimized.

@dholmes-ora

dholmes-ora Apr 7, 2021
Member

I'm surprised the p2i's were added. If the values are pointers then p2i should not be needed. If using p2i then INTPTR_FORMAT is the correct format specifier to use.

This comment has been minimized.

@kelthuzadx

kelthuzadx Apr 7, 2021
Author Member

I'm not sure the original intentions of these two macros. It looks like the definitions of PRT_FORMAT and INTPTR_FORMAT are identical:

#ifdef _LP64
#define INTPTR_FORMAT "0x%016" PRIxPTR
#define PTR_FORMAT "0x%016" PRIxPTR
#else // !_LP64

Also I find many occurrences that using p2i while format specifier is PRT_FORMAT. If this is indeed wrong, I may fix them later.

This comment has been minimized.

@kelthuzadx

kelthuzadx Apr 7, 2021
Author Member

Even if a pointer is given, p2i is necessary for PRT_FORMAT and INTPTR_FORMAT specifier, the compiler will throw errors without p2i.

out->print_cr(" - metaspace " PTR_FORMAT, p2i(_metaspace));
out->print_cr(" - unloading %s", _unloading ? "true" : "false");
out->print_cr(" - class mirror holder %s", _has_class_mirror_holder ? "true" : "false");
out->print_cr(" - modified oops %s", _modified_oops ? "true" : "false");
@@ -969,17 +969,17 @@ void ClassLoaderData::print_on(outputStream* out) const {
PrintKlassClosure closure(out);
((ClassLoaderData*)this)->classes_do(&closure);
out->print_cr(" }");
out->print_cr(" - packages %p", _packages);
out->print_cr(" - module %p", _modules);
out->print_cr(" - unnamed module %p", _unnamed_module);
out->print_cr(" - dictionary %p", _dictionary);
out->print_cr(" - packages " PTR_FORMAT, p2i(_packages));
out->print_cr(" - module " PTR_FORMAT, p2i(_modules));
out->print_cr(" - unnamed module " PTR_FORMAT, p2i(_unnamed_module));
out->print_cr(" - dictionary " PTR_FORMAT, p2i(_dictionary));
if (_jmethod_ids != NULL) {
out->print (" - jmethod count ");
Method::print_jmethod_ids(this, out);
Method::print_jmethod_ids_counts(this, out);

This comment has been minimized.

@coleenp

coleenp Apr 6, 2021

Yes, this is good. It was interesting at one point (to me) how many jmethodIds were in each CLD.

This comment has been minimized.

@dholmes-ora

dholmes-ora Apr 7, 2021
Member

Okay by me too. But it should be count not counts.

out->print_cr("");
}
out->print_cr(" - deallocate list %p", _deallocate_list);
out->print_cr(" - next CLD %p", _next);
out->print_cr(" - deallocate list " PTR_FORMAT, p2i(_deallocate_list));
out->print_cr(" - next CLD " PTR_FORMAT, p2i(_next));
}
#endif // PRODUCT

@@ -673,6 +673,7 @@ void ClassLoaderDataGraph::verify() {
// callable from debugger
extern "C" int print_loader_data_graph() {
ResourceMark rm;
MutexLocker ml(ClassLoaderDataGraph_lock);
ClassLoaderDataGraph::print_on(tty);
return 0;
}
@@ -2255,7 +2255,7 @@ bool Method::is_valid_method(const Method* m) {
}

#ifndef PRODUCT
void Method::print_jmethod_ids(const ClassLoaderData* loader_data, outputStream* out) {
void Method::print_jmethod_ids_counts(const ClassLoaderData* loader_data, outputStream* out) {
out->print("%d", loader_data->jmethod_ids()->count_methods());
}
#endif // PRODUCT
@@ -822,7 +822,7 @@ class Method : public Metadata {

// Clear methods
static void clear_jmethod_ids(ClassLoaderData* loader_data);
static void print_jmethod_ids(const ClassLoaderData* loader_data, outputStream* out) PRODUCT_RETURN;
static void print_jmethod_ids_counts(const ClassLoaderData* loader_data, outputStream* out) PRODUCT_RETURN;

// Get this method's jmethodID -- allocate if it doesn't exist
jmethodID jmethod_id();
ProTip! Use n and p to navigate between commits in a pull request.