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

8244540: Print more information with -XX:+PrintSharedArchiveAndExit #3187

Closed
wants to merge 4 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

@@ -2249,23 +2249,24 @@ class SharedDictionaryPrinter : StackObj {

void do_value(const RunTimeSharedClassInfo* record) {
ResourceMark rm;
_st->print_cr("%4d: %s loaded by: %s", (_index++), record->_klass->external_name(),
_st->print_cr("%4d: %s %s", (_index++), record->_klass->external_name(),
class_loader_name_for_shared(record->_klass));
This conversation was marked as resolved by yminqi

This comment has been minimized.

@iklam

iklam Mar 25, 2021
Member

The "loaded by: xxx_loader" seems a bit verbose:

  23: java.lang.invoke.VarHandleLongs$FieldInstanceReadWrite loaded by: boot_loader
  24: java.util.Map loaded by: boot_loader

How about

  23: java.lang.invoke.VarHandleLongs$FieldInstanceReadWrite boot_loader
  24: java.util.Map boot_loader
}
int index() const { return _index; }
};

class SharedLambdaDictionaryPrinter : StackObj {
outputStream* _st;
int _index;
public:
SharedLambdaDictionaryPrinter(outputStream* st) : _st(st), _index(0) {}
SharedLambdaDictionaryPrinter(outputStream* st, int idx) : _st(st), _index(idx) {}

void do_value(const RunTimeLambdaProxyClassInfo* record) {
if (record->proxy_klass_head()->lambda_proxy_is_available()) {
ResourceMark rm;
Klass* k = record->proxy_klass_head();
while (k != nullptr) {
_st->print_cr("%4d: %s loaded by: %s", (++_index), k->external_name(),
_st->print_cr("%4d: %s %s", (++_index), k->external_name(),
class_loader_name_for_shared(k));
k = k->next_link();
}
@@ -2286,11 +2287,24 @@ void SystemDictionaryShared::print_on(const char* prefix,
unregistered_dictionary->iterate(&p);
if (!lambda_dictionary->empty()) {
st->print_cr("%sShared Lambda Dictionary", prefix);
SharedLambdaDictionaryPrinter ldp(st);
SharedLambdaDictionaryPrinter ldp(st, p.index());
lambda_dictionary->iterate(&ldp);
}
}

void SystemDictionaryShared::print_shared_archive(outputStream* st, bool is_static) {
if (UseSharedSpaces) {
if (is_static) {
print_on("", &_builtin_dictionary, &_unregistered_dictionary, &_lambda_proxy_class_dictionary, st);
} else {
if (DynamicArchive::is_mapped()) {
print_on("", &_dynamic_builtin_dictionary, &_dynamic_unregistered_dictionary,
&_dynamic_lambda_proxy_class_dictionary, st);
}
}
}
}

void SystemDictionaryShared::print_on(outputStream* st) {
if (UseSharedSpaces) {
print_on("", &_builtin_dictionary, &_unregistered_dictionary, &_lambda_proxy_class_dictionary, st);
@@ -316,6 +316,7 @@ class SystemDictionaryShared: public SystemDictionary {
static void serialize_vm_classes(class SerializeClosure* soc);
static void print() { return print_on(tty); }
static void print_on(outputStream* st) NOT_CDS_RETURN;
static void print_shared_archive(outputStream* st, bool is_static = true) NOT_CDS_RETURN;
static void print_table_statistics(outputStream* st) NOT_CDS_RETURN;
static bool empty_dumptime_table() NOT_CDS_RETURN_(true);
static void start_dumping() NOT_CDS_RETURN;
@@ -1403,13 +1403,13 @@ void MetaspaceShared::initialize_shared_spaces() {
tty->print_cr("Static archive version %d", static_mapinfo->version());
}

SystemDictionaryShared::print_shared_archive(tty);
if (dynamic_mapinfo != nullptr) {
tty->print_cr("\n\nDynamic archive name: %s", dynamic_mapinfo->full_path());
tty->print_cr("Dynamic archive version %d", dynamic_mapinfo->version());
SystemDictionaryShared::print_shared_archive(tty, false/*dynamic*/);
}

SystemDictionaryShared::print_on(tty);

// collect shared symbols and strings
CountSharedSymbols cl;
SymbolTable::shared_symbols_do(&cl);
@@ -76,9 +76,9 @@ public static void run(String... extra_runtime_args) throws Exception {
"-XX:+PrintSharedArchiveAndExit",
"HelloUnload", customJarPath, "true", "true"));
output.shouldMatch(".* archive version \\d+")
.shouldContain("java.lang.Object loaded by: boot_loader")
.shouldContain("HelloUnload loaded by: app_loader")
.shouldContain("CustomLoadee loaded by: unregistered_loader")
.shouldContain("java.lang.Object boot_loader")
.shouldContain("HelloUnload app_loader")
.shouldContain("CustomLoadee unregistered_loader")
.shouldContain("Shared Builtin Dictionary")
.shouldContain("Shared Unregistered Dictionary")
.shouldMatch("Number of shared symbols: \\d+")
@@ -86,9 +86,9 @@ public static void testPrtNExit() throws Exception {
.shouldMatch("Base archive name: .*.jsa") // given name ends with .jsa, maynot default name.
.shouldMatch("Dynamic archive name: .*" + ARCHIVE_NAME)
.shouldMatch("Base archive version \\d+")
.shouldContain("java.lang.Object loaded by: boot_loader")
.shouldContain("HelloUnload loaded by: app_loader")
.shouldContain("CustomLoadee loaded by: unregistered_loader")
.shouldContain("java.lang.Object boot_loader")
.shouldContain("HelloUnload app_loader")
.shouldContain("CustomLoadee unregistered_loader")
.shouldContain("Shared Builtin Dictionary")
.shouldContain("Shared Unregistered Dictionary")
.shouldMatch("Number of shared symbols: \\d+")
ProTip! Use n and p to navigate between commits in a pull request.