// for debugging and hsfind(x) bool ClassLoaderDataGraph::contains(address x) { // I think we need the _metaspace_lock taken here because the class loader // data graph could be changing while we are walking it (new entries added, // new entries being unloaded, etc). if (DumpSharedSpaces) { // There are only two metaspaces to worry about. ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data(); return (ncld->ro_metaspace()->contains(x) || ncld->rw_metaspace()->contains(x)); } if (UseSharedSpaces && MetaspaceShared::is_in_shared_space(x)) { return true; } for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) { if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) { return true; } } // Could also be on an unloading list which is okay, ie. still allocated // for a little while. for (ClassLoaderData* ucld = _unloading; ucld != NULL; ucld = ucld->next()) { if (ucld->metaspace_or_null() != NULL && ucld->metaspace_or_null()->contains(x)) { return true; } } return false; }
bool ClassLoaderDataGraph::unload_list_contains(const void* x) { assert(SafepointSynchronize::is_at_safepoint(), "only safe to call at safepoint"); for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) { if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) { return true; } } return false; }