8309753: Include array classes in the output of -XX:+PrintSharedArchiveAndExit
Reviewed-by: iklam, matsaave
This commit is contained in:
parent
e138685648
commit
14010876dc
@ -1357,6 +1357,10 @@ public:
|
||||
ResourceMark rm;
|
||||
_st->print_cr("%4d: %s %s", _index++, record->_klass->external_name(),
|
||||
class_loader_name_for_shared(record->_klass));
|
||||
if (record->_klass->array_klasses() != nullptr) {
|
||||
record->_klass->array_klasses()->cds_print_value_on(_st);
|
||||
_st->cr();
|
||||
}
|
||||
}
|
||||
int index() const { return _index; }
|
||||
};
|
||||
|
@ -183,6 +183,16 @@ void ArrayKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle p
|
||||
ak->restore_unshareable_info(loader_data, protection_domain, CHECK);
|
||||
}
|
||||
}
|
||||
|
||||
void ArrayKlass::cds_print_value_on(outputStream* st) const {
|
||||
assert(is_klass(), "must be klass");
|
||||
st->print(" - array: %s", internal_name());
|
||||
if (_higher_dimension != nullptr) {
|
||||
ArrayKlass* ak = ArrayKlass::cast(higher_dimension());
|
||||
st->cr();
|
||||
ak->cds_print_value_on(st);
|
||||
}
|
||||
}
|
||||
#endif // INCLUDE_CDS
|
||||
|
||||
// Printing
|
||||
|
@ -119,6 +119,7 @@ class ArrayKlass: public Klass {
|
||||
virtual void remove_unshareable_info();
|
||||
virtual void remove_java_mirror();
|
||||
void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
|
||||
void cds_print_value_on(outputStream* st) const;
|
||||
#endif
|
||||
|
||||
// Printing
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -43,21 +43,23 @@ public class PrintSharedArchiveAndExit {
|
||||
// (1) With a valid archive
|
||||
opts = (new CDSOptions())
|
||||
.setUseVersion(false)
|
||||
.addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
|
||||
.addSuffix("-XX:SharedArchiveFile=./" + archiveName,
|
||||
"-XX:+PrintSharedArchiveAndExit", "-version");
|
||||
CDSTestUtils.run(opts)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("archive is valid");
|
||||
output.shouldContain("[Ljava.lang.Object;");
|
||||
output.shouldNotContain("java version"); // Should not print JVM version
|
||||
});
|
||||
|
||||
opts = (new CDSOptions())
|
||||
.setUseVersion(false)
|
||||
.addSuffix( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
|
||||
.addSuffix("-XX:SharedArchiveFile=./" + archiveName,
|
||||
"-XX:+PrintSharedArchiveAndExit");
|
||||
CDSTestUtils.run(opts)
|
||||
.assertNormalExit(output -> {
|
||||
output.shouldContain("archive is valid");
|
||||
output.shouldContain("[Ljava.lang.Object;");
|
||||
output.shouldNotContain("Usage:"); // Should not print JVM help message
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user