src/share/vm/oops/klassVtable.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 641,650 **** --- 641,678 ---- } } } } + // a vtable should never contain old or obsolete methods + bool klassVtable::check_no_old_or_obsolete_entries() { + for (int i = 0; i < length(); i++) { + Method* m = unchecked_method_at(i); + if (m != NULL && (!m->is_valid() || m->is_old() || m->is_obsolete())) { + return false; + } + } + return true; + } + + void klassVtable::dump_vtable() { + // adds a searchable prefix when RedefineClasses() tracing is enabled + RC_TRACE_NO_CR(0x00004000, ("")); + tty->print_cr("vtable dump --"); + for (int i = 0; i < length(); i++) { + Method* m = unchecked_method_at(i); + if (m != NULL) { + RC_TRACE_NO_CR(0x00004000, ("")); + tty->print(" (%5d) ", i); + m->access_flags().print_on(tty); + tty->print(" -- "); + m->print_name(tty); + tty->cr(); + } + } + } + // CDS/RedefineClasses support - clear vtables so they can be reinitialized void klassVtable::clear_vtable() { for (int i = 0; i < _length; i++) table()[i].clear(); }
*** 831,848 **** // RC_TRACE macro has an embedded ResourceMark RC_TRACE(0x00200000, ("itable method update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string())); } ! // Cannot break because there might be another entry for this method } ime++; } } } // Setup class InterfaceVisiterClosure : public StackObj { public: virtual void doit(Klass* intf, int method_count) = 0; }; --- 859,908 ---- // RC_TRACE macro has an embedded ResourceMark RC_TRACE(0x00200000, ("itable method update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string())); } ! // cannot 'break' here; see for-loop comment above. } ime++; } } } + // an itable should never contain old or obsolete methods + bool klassItable::check_no_old_or_obsolete_entries() { + itableMethodEntry* ime = method_entry(0); + for (int i = 0; i < _size_method_table; i++) { + Method* m = ime->method(); + if (m != NULL && (!m->is_valid() || m->is_old() || m->is_obsolete())) { + return false; + } + ime++; + } + return true; + } + void klassItable::dump_itable() { + itableMethodEntry* ime = method_entry(0); + // adds a searchable prefix when RedefineClasses() tracing is enabled + RC_TRACE_NO_CR(0x00004000, ("")); + tty->print_cr("itable dump --"); + for (int i = 0; i < _size_method_table; i++) { + Method* m = ime->method(); + if (m != NULL) { + RC_TRACE_NO_CR(0x00004000, ("")); + tty->print(" (%5d) ", i); + m->access_flags().print_on(tty); + tty->print(" -- "); + m->print_name(tty); + tty->cr(); + } + ime++; + } + } + + // Setup class InterfaceVisiterClosure : public StackObj { public: virtual void doit(Klass* intf, int method_count) = 0; };
*** 1124,1170 **** 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); } - bool klassVtable::check_no_old_entries() { - // Check that there really is no entry - for (int i = 0; i < length(); i++) { - Method* m = unchecked_method_at(i); - if (m != NULL) { - if (!m->is_valid() || m->is_old()) { - return false; - } - } - } - return true; - } - - void klassVtable::dump_vtable() { - tty->print_cr("vtable dump --"); - for (int i = 0; i < length(); i++) { - Method* m = unchecked_method_at(i); - if (m != NULL) { - tty->print(" (%5d) ", i); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); - } - } - } - - bool klassItable::check_no_old_entries() { - itableMethodEntry* ime = method_entry(0); - for(int i = 0; i < _size_method_table; i++) { - Method* m = ime->method(); - if (m != NULL && (!m->is_valid() || m->is_old())) return false; - ime++; - } - return true; - } - int klassItable::_total_classes; // Total no. of classes with itables long klassItable::_total_size; // Total no. of bytes used for itables void klassItable::print_statistics() { tty->print_cr("itable statistics:"); --- 1184,1193 ----