< prev index next >
src/share/vm/classfile/classLoaderData.cpp
Print this page
rev 13180 : imported patch 8181917-refactor-ul-logstream
*** 55,64 ****
--- 55,65 ----
#include "classfile/packageEntry.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "gc/shared/gcLocker.hpp"
#include "logging/log.hpp"
+ #include "logging/logStream.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/objArrayOop.inline.hpp"
*** 474,493 ****
_unloading = true;
// Tell serviceability tools these classes are unloading
classes_do(InstanceKlass::notify_unload_class);
! if (log_is_enabled(Debug, class, loader, data)) {
ResourceMark rm;
! outputStream* log = Log(class, loader, data)::debug_stream();
! log->print(": unload loader data " INTPTR_FORMAT, p2i(this));
! log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()),
loader_name());
if (is_anonymous()) {
! log->print(" for anonymous class " INTPTR_FORMAT " ", p2i(_klasses));
}
! log->cr();
}
// In some rare cases items added to this list will not be freed elsewhere.
// To keep it simple, just free everything in it here.
free_deallocate_list();
--- 475,495 ----
_unloading = true;
// Tell serviceability tools these classes are unloading
classes_do(InstanceKlass::notify_unload_class);
! LogTarget(Debug, class, loader, data) lt;
! if (lt.is_enabled()) {
ResourceMark rm;
! LogStream ls(lt);
! ls.print(": unload loader data " INTPTR_FORMAT, p2i(this));
! ls.print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()),
loader_name());
if (is_anonymous()) {
! ls.print(" for anonymous class " INTPTR_FORMAT " ", p2i(_klasses));
}
! ls.cr();
}
// In some rare cases items added to this list will not be freed elsewhere.
// To keep it simple, just free everything in it here.
free_deallocate_list();
*** 801,821 ****
do {
cld->set_next(next);
ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next);
if (exchanged == next) {
! if (log_is_enabled(Debug, class, loader, data)) {
PauseNoSafepointVerifier pnsv(&no_safepoints); // Need safe points for JavaCalls::call_virtual
! log_creation(loader, cld, CHECK_NULL);
}
return cld;
}
next = exchanged;
} while (true);
}
! void ClassLoaderDataGraph::log_creation(Handle loader, ClassLoaderData* cld, TRAPS) {
Handle string;
if (loader.not_null()) {
// Include the result of loader.toString() in the output. This allows
// the user of the log to identify the class loader instance.
JavaValue result(T_OBJECT);
--- 803,825 ----
do {
cld->set_next(next);
ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next);
if (exchanged == next) {
! LogTarget(Debug, class, loader, data) lt;
! if (lt.is_enabled()) {
PauseNoSafepointVerifier pnsv(&no_safepoints); // Need safe points for JavaCalls::call_virtual
! LogStream ls(lt);
! print_creation(&ls, loader, cld, CHECK_NULL);
}
return cld;
}
next = exchanged;
} while (true);
}
! void ClassLoaderDataGraph::print_creation(outputStream* out, Handle loader, ClassLoaderData* cld, TRAPS) {
Handle string;
if (loader.not_null()) {
// Include the result of loader.toString() in the output. This allows
// the user of the log to identify the class loader instance.
JavaValue result(T_OBJECT);
*** 829,848 ****
assert(result.get_type() == T_OBJECT, "just checking");
string = Handle(THREAD, (oop)result.get_jobject());
}
ResourceMark rm;
! outputStream* log = Log(class, loader, data)::debug_stream();
! log->print("create class loader data " INTPTR_FORMAT, p2i(cld));
! log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
cld->loader_name());
if (string.not_null()) {
! log->print(": ");
! java_lang_String::print(string(), log);
}
! log->cr();
}
void ClassLoaderDataGraph::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
--- 833,851 ----
assert(result.get_type() == T_OBJECT, "just checking");
string = Handle(THREAD, (oop)result.get_jobject());
}
ResourceMark rm;
! out->print("create class loader data " INTPTR_FORMAT, p2i(cld));
! out->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
cld->loader_name());
if (string.not_null()) {
! out->print(": ");
! java_lang_String::print(string(), out);
}
! out->cr();
}
void ClassLoaderDataGraph::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
*** 979,994 ****
// The CLDs in [_head, _saved_head] were all added during last call to remember_new_clds(true);
ClassLoaderData* curr = _head;
while (curr != _saved_head) {
if (!curr->claimed()) {
array->push(curr);
!
! if (log_is_enabled(Debug, class, loader, data)) {
! outputStream* log = Log(class, loader, data)::debug_stream();
! log->print("found new CLD: ");
! curr->print_value_on(log);
! log->cr();
}
}
curr = curr->_next;
}
--- 982,997 ----
// The CLDs in [_head, _saved_head] were all added during last call to remember_new_clds(true);
ClassLoaderData* curr = _head;
while (curr != _saved_head) {
if (!curr->claimed()) {
array->push(curr);
! LogTarget(Debug, class, loader, data) lt;
! if (lt.is_enabled()) {
! LogStream ls(lt);
! ls.print("found new CLD: ");
! curr->print_value_on(&ls);
! ls.cr();
}
}
curr = curr->_next;
}
< prev index next >