mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8244540: Print more information with -XX:+PrintSharedArchiveAndExit
Reviewed-by: iklam, ccheung
This commit is contained in:
parent
e073486ffe
commit
928fa5b5f9
8 changed files with 294 additions and 11 deletions
|
@ -2224,6 +2224,24 @@ void SystemDictionaryShared::update_shared_entry(InstanceKlass* k, int id) {
|
|||
info->_id = id;
|
||||
}
|
||||
|
||||
const char* class_loader_name_for_shared(Klass* k) {
|
||||
assert(k != nullptr, "Sanity");
|
||||
assert(k->is_shared(), "Must be");
|
||||
assert(k->is_instance_klass(), "Must be");
|
||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
||||
if (ik->is_shared_boot_class()) {
|
||||
return "boot_loader";
|
||||
} else if (ik->is_shared_platform_class()) {
|
||||
return "platform_loader";
|
||||
} else if (ik->is_shared_app_class()) {
|
||||
return "app_loader";
|
||||
} else if (ik->is_shared_unregistered_class()) {
|
||||
return "unregistered_loader";
|
||||
} else {
|
||||
return "unknown loader";
|
||||
}
|
||||
}
|
||||
|
||||
class SharedDictionaryPrinter : StackObj {
|
||||
outputStream* _st;
|
||||
int _index;
|
||||
|
@ -2232,23 +2250,25 @@ public:
|
|||
|
||||
void do_value(const RunTimeSharedClassInfo* record) {
|
||||
ResourceMark rm;
|
||||
_st->print_cr("%4d: %s", (_index++), record->_klass->external_name());
|
||||
_st->print_cr("%4d: %s %s", (_index++), record->_klass->external_name(),
|
||||
class_loader_name_for_shared(record->_klass));
|
||||
}
|
||||
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;
|
||||
_st->print_cr("%4d: %s", (_index++), record->proxy_klass_head()->external_name());
|
||||
Klass* k = record->proxy_klass_head()->next_link();
|
||||
while (k != NULL) {
|
||||
_st->print_cr("%4d: %s", (_index++), k->external_name());
|
||||
Klass* k = record->proxy_klass_head();
|
||||
while (k != nullptr) {
|
||||
_st->print_cr("%4d: %s %s", (++_index), k->external_name(),
|
||||
class_loader_name_for_shared(k));
|
||||
k = k->next_link();
|
||||
}
|
||||
}
|
||||
|
@ -2262,15 +2282,30 @@ void SystemDictionaryShared::print_on(const char* prefix,
|
|||
outputStream* st) {
|
||||
st->print_cr("%sShared Dictionary", prefix);
|
||||
SharedDictionaryPrinter p(st);
|
||||
st->print_cr("%sShared Builtin Dictionary", prefix);
|
||||
builtin_dictionary->iterate(&p);
|
||||
st->print_cr("%sShared Unregistered Dictionary", 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue