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

8259070: Add jcmd option to dump CDS #2737

Closed
wants to merge 17 commits into from
Closed
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -3638,7 +3638,7 @@ const char* InstanceKlass::internal_name() const {
void InstanceKlass::print_class_load_logging(ClassLoaderData* loader_data,
const ModuleEntry* module_entry,
const ClassFileStream* cfs) const {
log_to_classlist(cfs);
log_to_classlist();

if (!log_is_enabled(Info, class, load)) {
return;
@@ -4237,25 +4237,26 @@ bool InstanceKlass::is_shareable() const {
if (!SystemDictionaryShared::is_sharing_possible(loader_data)) {
return false;
}
if (is_shared()) {
if (is_hidden()) {
// Don't include archived lambda proxy class in the classlist.
assert(!is_non_strong_hidden(), "unexpected non-strong hidden class");
return false;
}
} else {
// skip hidden class and unsafe anonymous class.
if (is_hidden() || unsafe_anonymous_host() != NULL) {
return false;
}

if (is_hidden() || unsafe_anonymous_host() != NULL) {
tty->print_cr("skip writing %s class %s to classlist file",
(is_hidden() ? "hidden" : "unsafe anonymous host"),
name()->as_C_string());
return false;
}

if (module()->is_patched()) {
tty->print_cr("skip writing class %s to classlist file, module patched",
name()->as_C_string());
return false;
}
return true;
#else
return false;
#endif
}

void InstanceKlass::log_to_classlist(const ClassFileStream* stream) const {
void InstanceKlass::log_to_classlist() const {
#if INCLUDE_CDS
ResourceMark rm;
if (ClassListWriter::is_enabled()) {
@@ -4265,42 +4266,9 @@ void InstanceKlass::log_to_classlist(const ClassFileStream* stream) const {
return;
}
if (is_shareable()) {
bool skip = false;
if (is_shared()) {
if (stream == nullptr) {
tty->print_cr("%s: shared class with stream?", name()->as_C_string());
return; // stream is nullptr will cause below operation fail.
}
} else {
if (stream != nullptr) {
oop class_loader = class_loader_data()->class_loader();
if (class_loader == NULL || SystemDictionary::is_platform_class_loader(class_loader)) {
// For the boot and platform class loaders, skip classes that are not found in the
// java runtime image, such as those found in the --patch-module entries.
// These classes can't be loaded from the archive during runtime.
if (!stream->from_boot_loader_modules_image() && strncmp(stream->source(), "jrt:", 4) != 0) {
skip = true;
}

if (class_loader == NULL && ClassLoader::contains_append_entry(stream->source())) {
// .. but don't skip the boot classes that are loaded from -Xbootclasspath/a
// as they can be loaded from the archive during runtime.
skip = false;
}
}
} else {
warning("non-shared class without stream, skipped");
return;
}
}
if (skip) {
tty->print_cr("skip writing class %s from source %s to classlist file",
name()->as_C_string(), stream->source());
} else {
ClassListWriter w;
w.stream()->print_cr("%s", name()->as_C_string());
w.stream()->flush();
}
ClassListWriter w;
w.stream()->print_cr("%s", name()->as_C_string());
w.stream()->flush();
}
}
#endif // INCLUDE_CDS
@@ -361,7 +361,7 @@ class InstanceKlass: public Klass {
return (_misc_flags & shared_loader_type_bits()) == 0;
}

// if can be shared in CDS, used by jcmd VM.cds
// Check if the class can be shared in CDS
bool is_shareable() const;

void clear_shared_class_loader_type() {
@@ -1262,7 +1262,7 @@ class InstanceKlass: public Klass {
void mark_newly_obsolete_methods(Array<Method*>* old_methods, int emcp_method_count);
#endif
// log class name to classlist
void log_to_classlist(const ClassFileStream* cfs) const;
void log_to_classlist() const;
public:
// CDS support - remove and restore oops from metadata. Oops are not shared.
virtual void remove_unshareable_info();
ProTip! Use n and p to navigate between commits in a pull request.