Skip to content
Permalink
Browse files
8275439: Remove PrintVtableStats
Reviewed-by: coleenp, dholmes
  • Loading branch information
zhengyu123 committed Oct 20, 2021
1 parent 50a5723 commit 135cf3c94d4bce1b23c4dd7697030f558a5f682b
Showing 9 changed files with 0 additions and 125 deletions.
@@ -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;
}
@@ -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);

@@ -1721,16 +1721,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,
@@ -1005,8 +1005,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)));
@@ -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();
@@ -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;
}

@@ -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
@@ -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;
@@ -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
@@ -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") \
\
@@ -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());
}

1 comment on commit 135cf3c

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 135cf3c Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.