--- a/hotspot/src/share/vm/classfile/placeholders.cpp Wed Aug 02 08:19:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/placeholders.cpp Wed Aug 02 10:52:50 2017 -0400
@@ -175,39 +175,6 @@
: Hashtable<Symbol*, mtClass>(table_size, sizeof(PlaceholderEntry)) {
}
-#ifndef PRODUCT
-// Note, doesn't append a cr
-void PlaceholderEntry::print() const {
- klassname()->print_value();
- if (loader_data() != NULL) {
- tty->print(", loader ");
- loader_data()->print_value();
- }
- if (supername() != NULL) {
- tty->print(", supername ");
- supername()->print_value();
- }
- if (definer() != NULL) {
- tty->print(", definer ");
- definer()->print_value();
- }
- if (instance_klass() != NULL) {
- tty->print(", InstanceKlass ");
- instance_klass()->print_value();
- }
- tty->print("\n");
- tty->print("loadInstanceThreadQ threads:");
- loadInstanceThreadQ()->printActionQ();
- tty->print("\n");
- tty->print("superThreadQ threads:");
- superThreadQ()->printActionQ();
- tty->print("\n");
- tty->print("defineThreadQ threads:");
- defineThreadQ()->printActionQ();
- tty->print("\n");
-}
-#endif
-
void PlaceholderEntry::verify() const {
guarantee(loader_data() != NULL, "Must have been setup.");
guarantee(loader_data()->class_loader() == NULL || loader_data()->class_loader()->is_instance(),
@@ -222,20 +189,48 @@
}
-#ifndef PRODUCT
-void PlaceholderTable::print() {
- tty->print_cr("Placeholder table table_size=%d, entries=%d",
+// Note, doesn't append a cr
+// Can't call this print_on because HashtableEntry doesn't initialize its vptr
+// and print_on is a virtual function so the vptr call crashes.
+void PlaceholderEntry::print_entry(outputStream* st) const {
+ klassname()->print_value_on(st);
+ if (loader_data() != NULL) {
+ st->print(", loader ");
+ loader_data()->print_value_on(st);
+ }
+ if (supername() != NULL) {
+ st->print(", supername ");
+ supername()->print_value_on(st);
+ }
+ if (definer() != NULL) {
+ st->print(", definer ");
+ definer()->print_value_on(st);
+ }
+ if (instance_klass() != NULL) {
+ st->print(", InstanceKlass ");
+ instance_klass()->print_value_on(st);
+ }
+ st->cr();
+ st->print("loadInstanceThreadQ threads:");
+ loadInstanceThreadQ()->print_action_queue(st);
+ st->cr();
+ st->print("superThreadQ threads:");
+ superThreadQ()->print_action_queue(st);
+ st->cr();
+ st->print("defineThreadQ threads:");
+ defineThreadQ()->print_action_queue(st);
+ st->cr();
+}
+
+void PlaceholderTable::print_on(outputStream* st) const {
+ st->print_cr("Placeholder table (table_size=%d, placeholders=%d)",
table_size(), number_of_entries());
for (int pindex = 0; pindex < table_size(); pindex++) {
for (PlaceholderEntry* probe = bucket(pindex);
probe != NULL;
probe = probe->next()) {
- tty->print("%4d: ", pindex);
- tty->print(" place holder ");
-
- probe->print();
- tty->cr();
+ st->print("%4d: placeholder ", pindex);
+ probe->print_entry(st);
}
}
}
-#endif