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

8275439: Remove PrintVtableStats #6017

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/hotspot/share/oops/arrayKlass.cpp
Expand Up @@ -135,24 +135,6 @@ objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
return o;
}

void ArrayKlass::array_klasses_do(void f(Klass* k, TRAPS), TRAPS) {
Klass* k = this;
// Iterate over this array klass and all higher dimensions
while (k != NULL) {
f(k, CHECK);
k = ArrayKlass::cast(k)->higher_dimension();
}
}

void ArrayKlass::array_klasses_do(void f(Klass* k)) {
Klass* k = this;
// Iterate over this array klass and all higher dimensions
while (k != NULL) {
f(k);
k = ArrayKlass::cast(k)->higher_dimension();
}
}

jint ArrayKlass::compute_modifier_flags() const {
return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC;
}
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/oops/arrayKlass.hpp
Expand Up @@ -104,10 +104,6 @@ class ArrayKlass: public Klass {

virtual void metaspace_pointers_do(MetaspaceClosure* iter);

// Iterators
void array_klasses_do(void f(Klass* k));
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);

// Return a handle.
static void complete_create_array_klass(ArrayKlass* k, Klass* super_klass, ModuleEntry* module, TRAPS);

Expand Down
10 changes: 0 additions & 10 deletions src/hotspot/share/oops/instanceKlass.cpp
Expand Up @@ -1720,16 +1720,6 @@ void InstanceKlass::print_nonstatic_fields(FieldClosure* cl) {
}
}

void InstanceKlass::array_klasses_do(void f(Klass* k, TRAPS), TRAPS) {
if (array_klasses() != NULL)
array_klasses()->array_klasses_do(f, THREAD);
}

void InstanceKlass::array_klasses_do(void f(Klass* k)) {
if (array_klasses() != NULL)
array_klasses()->array_klasses_do(f);
}

#ifdef ASSERT
static int linear_search(const Array<Method*>* methods,
const Symbol* name,
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/oops/instanceKlass.hpp
Expand Up @@ -1006,8 +1006,6 @@ class InstanceKlass: public Klass {
void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields

void methods_do(void f(Method* method));
void array_klasses_do(void f(Klass* k));
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);

static InstanceKlass* cast(Klass* k) {
return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/oops/klass.hpp
Expand Up @@ -653,8 +653,6 @@ class Klass : public Metadata {
clean_weak_klass_links(/*unloading_occurred*/ true , /* clean_alive_klasses */ false);
}

virtual void array_klasses_do(void f(Klass* k)) {}

// Return self, except for abstract classes with exactly 1
// implementor. Then return the 1 concrete implementation.
Klass *up_cast_abstract();
Expand Down
74 changes: 0 additions & 74 deletions src/hotspot/share/oops/klassVtable.cpp
Expand Up @@ -1511,9 +1511,6 @@ int klassItable::compute_itable_size(Array<InstanceKlass*>* transitive_interface
// There's alway an extra itable entry so we can null-terminate it.
int itable_size = calc_itable_size(cic.nof_interfaces() + 1, cic.nof_methods());

// Statistics
update_stats(itable_size * wordSize);

return itable_size;
}

Expand Down Expand Up @@ -1628,75 +1625,4 @@ void vtableEntry::print() {
tty->print("m " PTR_FORMAT " ", p2i(method()));
}
}

class VtableStats : AllStatic {
public:
static int no_klasses; // # classes with vtables
static int no_array_klasses; // # array classes
static int no_instance_klasses; // # instanceKlasses
static int sum_of_vtable_len; // total # of vtable entries
static int sum_of_array_vtable_len; // total # of vtable entries in array klasses only
static int fixed; // total fixed overhead in bytes
static int filler; // overhead caused by filler bytes
static int entries; // total bytes consumed by vtable entries
static int array_entries; // total bytes consumed by array vtable entries

static void do_class(Klass* k) {
Klass* kl = k;
klassVtable vt = kl->vtable();
no_klasses++;
if (kl->is_instance_klass()) {
no_instance_klasses++;
kl->array_klasses_do(do_class);
}
if (kl->is_array_klass()) {
no_array_klasses++;
sum_of_array_vtable_len += vt.length();
}
sum_of_vtable_len += vt.length();
}

static void compute() {
LockedClassesDo locked_do_class(&do_class);
ClassLoaderDataGraph::classes_do(&locked_do_class);
fixed = no_klasses * oopSize; // vtable length
// filler size is a conservative approximation
filler = oopSize * (no_klasses - no_instance_klasses) * (sizeof(InstanceKlass) - sizeof(ArrayKlass) - 1);
entries = sizeof(vtableEntry) * sum_of_vtable_len;
array_entries = sizeof(vtableEntry) * sum_of_array_vtable_len;
}
};

int VtableStats::no_klasses = 0;
int VtableStats::no_array_klasses = 0;
int VtableStats::no_instance_klasses = 0;
int VtableStats::sum_of_vtable_len = 0;
int VtableStats::sum_of_array_vtable_len = 0;
int VtableStats::fixed = 0;
int VtableStats::filler = 0;
int VtableStats::entries = 0;
int VtableStats::array_entries = 0;

void klassVtable::print_statistics() {
ResourceMark rm;
VtableStats::compute();
tty->print_cr("vtable statistics:");
tty->print_cr("%6d classes (%d instance, %d array)", VtableStats::no_klasses, VtableStats::no_instance_klasses, VtableStats::no_array_klasses);
int total = VtableStats::fixed + VtableStats::filler + VtableStats::entries;
tty->print_cr("%6d bytes fixed overhead (refs + vtable object header)", VtableStats::fixed);
tty->print_cr("%6d bytes filler overhead", VtableStats::filler);
tty->print_cr("%6d bytes for vtable entries (%d for arrays)", VtableStats::entries, VtableStats::array_entries);
tty->print_cr("%6d bytes total", total);
}

int klassItable::_total_classes; // Total no. of classes with itables
size_t klassItable::_total_size; // Total no. of bytes used for itables

void klassItable::print_statistics() {
tty->print_cr("itable statistics:");
tty->print_cr("%6d classes with itables", _total_classes);
tty->print_cr(SIZE_FORMAT_W(6) " K uses for itables (average by class: " SIZE_FORMAT " bytes)",
_total_size / K, _total_size / _total_classes);
}

#endif // PRODUCT
8 changes: 0 additions & 8 deletions src/hotspot/share/oops/klassVtable.hpp
Expand Up @@ -97,7 +97,6 @@ class klassVtable {
// Debugging code
void print() PRODUCT_RETURN;
void verify(outputStream* st, bool force = false);
static void print_statistics() PRODUCT_RETURN;

protected:
friend class vtableEntry;
Expand Down Expand Up @@ -319,20 +318,13 @@ class klassItable {
static int compute_itable_size(Array<InstanceKlass*>* transitive_interfaces);
static void setup_itable_offset_table(InstanceKlass* klass);

// Debugging/Statistics
static void print_statistics() PRODUCT_RETURN;
private:
intptr_t* vtable_start() const { return ((intptr_t*)_klass) + _table_offset; }
intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }

// Helper methods
static int calc_itable_size(int num_interfaces, int num_methods) { return (num_interfaces * itableOffsetEntry::size()) + (num_methods * itableMethodEntry::size()); }

// Statistics
NOT_PRODUCT(static int _total_classes;) // Total no. of classes with itables
NOT_PRODUCT(static size_t _total_size;) // Total no. of bytes used for itables

static void update_stats(int size) PRODUCT_RETURN NOT_PRODUCT({ _total_classes++; _total_size += size; })
};

#endif // SHARE_OOPS_KLASSVTABLE_HPP
3 changes: 0 additions & 3 deletions src/hotspot/share/runtime/globals.hpp
Expand Up @@ -1091,9 +1091,6 @@ const intx ObjectAlignmentInBytes = 8;
develop(bool, DebugVtables, false, \
"add debugging code to vtable dispatch") \
\
notproduct(bool, PrintVtableStats, false, \
"print vtables stats at end of run") \
\
develop(bool, TraceCreateZombies, false, \
"trace creation of zombie nmethods") \
\
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/runtime/java.cpp
Expand Up @@ -306,10 +306,6 @@ void print_statistics() {
CodeCache::print_internals();
}

if (PrintVtableStats) {
klassVtable::print_statistics();
klassItable::print_statistics();
}
if (VerifyOops && Verbose) {
tty->print_cr("+VerifyOops count: %d", StubRoutines::verify_oop_count());
}
Expand Down