< prev index next >
src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp
Print this page
*** 127,137 ****
};
class LoaderTreeNode : public ResourceObj {
! // We walk the CLDG and, for each CLD which is non-unsafe_anonymous, add
// a tree node.
// To add a node we need its parent node; if the parent node does not yet
// exist - because we have not yet encountered the CLD for the parent loader -
// we add a preliminary empty LoaderTreeNode for it. This preliminary node
// just contains the loader oop and nothing else. Once we encounter the CLD of
--- 127,137 ----
};
class LoaderTreeNode : public ResourceObj {
! // We walk the CLDG and, for each CLD which is findable, add
// a tree node.
// To add a node we need its parent node; if the parent node does not yet
// exist - because we have not yet encountered the CLD for the parent loader -
// we add a preliminary empty LoaderTreeNode for it. This preliminary node
// just contains the loader oop and nothing else. Once we encounter the CLD of
*** 218,228 ****
}
if (print_classes) {
if (_classes != NULL) {
for (LoadedClassInfo* lci = _classes; lci; lci = lci->_next) {
! // Non-unsafe anonymous classes should live in the primary CLD of its loader
assert(lci->_cld == _cld, "must be");
branchtracker.print(st);
if (lci == _classes) { // first iteration
st->print("%*s ", indentation, "Classes:");
--- 218,228 ----
}
if (print_classes) {
if (_classes != NULL) {
for (LoadedClassInfo* lci = _classes; lci; lci = lci->_next) {
! // Hidden and unsafe anonymous classes should live in the primary CLD of its loader
assert(lci->_cld == _cld, "must be");
branchtracker.print(st);
if (lci == _classes) { // first iteration
st->print("%*s ", indentation, "Classes:");
*** 256,266 ****
st->print("%*s ", indentation, "Unsafe Anonymous Classes:");
} else {
st->print("%*s ", indentation, "");
}
st->print("%s", lci->_klass->external_name());
! // For unsafe anonymous classes, also print CLD if verbose. Should be a different one than the primary CLD.
assert(lci->_cld != _cld, "must be");
if (verbose) {
st->print(" (Loader Data: " PTR_FORMAT ")", p2i(lci->_cld));
}
st->cr();
--- 256,266 ----
st->print("%*s ", indentation, "Unsafe Anonymous Classes:");
} else {
st->print("%*s ", indentation, "");
}
st->print("%s", lci->_klass->external_name());
! // For hidden and unsafe anonymous classes, also print CLD if verbose. Should be a different one than the primary CLD.
assert(lci->_cld != _cld, "must be");
if (verbose) {
st->print(" (Loader Data: " PTR_FORMAT ")", p2i(lci->_cld));
}
st->cr();
*** 317,334 ****
assert(info->_next == NULL, "must be");
info->_next = _next;
_next = info;
}
! void add_classes(LoadedClassInfo* first_class, int num_classes, bool is_unsafe_anonymous) {
! LoadedClassInfo** p_list_to_add_to = is_unsafe_anonymous ? &_anon_classes : &_classes;
// Search tail.
while ((*p_list_to_add_to) != NULL) {
p_list_to_add_to = &(*p_list_to_add_to)->_next;
}
*p_list_to_add_to = first_class;
! if (is_unsafe_anonymous) {
_num_anon_classes += num_classes;
} else {
_num_classes += num_classes;
}
}
--- 317,334 ----
assert(info->_next == NULL, "must be");
info->_next = _next;
_next = info;
}
! void add_classes(LoadedClassInfo* first_class, int num_classes, bool is_hidden) {
! LoadedClassInfo** p_list_to_add_to = is_hidden ? &_anon_classes : &_classes;
// Search tail.
while ((*p_list_to_add_to) != NULL) {
p_list_to_add_to = &(*p_list_to_add_to)->_next;
}
*p_list_to_add_to = first_class;
! if (is_hidden) {
_num_anon_classes += num_classes;
} else {
_num_classes += num_classes;
}
}
*** 419,429 ****
static void fill_in_classes(LoaderTreeNode* info, const ClassLoaderData* cld) {
assert(info != NULL && cld != NULL, "must be");
LoadedClassCollectClosure lccc(cld);
const_cast<ClassLoaderData*>(cld)->classes_do(&lccc);
if (lccc._num_classes > 0) {
! info->add_classes(lccc._list, lccc._num_classes, cld->is_unsafe_anonymous());
}
}
LoaderTreeNode* find_node_or_add_empty_node(oop loader_oop) {
--- 419,429 ----
static void fill_in_classes(LoaderTreeNode* info, const ClassLoaderData* cld) {
assert(info != NULL && cld != NULL, "must be");
LoadedClassCollectClosure lccc(cld);
const_cast<ClassLoaderData*>(cld)->classes_do(&lccc);
if (lccc._num_classes > 0) {
! info->add_classes(lccc._list, lccc._num_classes, cld->is_shortlived());
}
}
LoaderTreeNode* find_node_or_add_empty_node(oop loader_oop) {
*** 479,489 ****
LoaderTreeNode* info = find_node_or_add_empty_node(loader_oop);
assert(info != NULL, "must be");
// Update CLD in node, but only if this is the primary CLD for this loader.
! if (cld->is_unsafe_anonymous() == false) {
assert(info->cld() == NULL, "there should be only one primary CLD per loader");
info->set_cld(cld);
}
// Add classes.
--- 479,489 ----
LoaderTreeNode* info = find_node_or_add_empty_node(loader_oop);
assert(info != NULL, "must be");
// Update CLD in node, but only if this is the primary CLD for this loader.
! if (cld->is_shortlived() == false) {
assert(info->cld() == NULL, "there should be only one primary CLD per loader");
info->set_cld(cld);
}
// Add classes.
< prev index next >