13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoaderData.inline.hpp"
27 #include "classfile/moduleEntry.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "gc/shared/collectedHeap.hpp"
30 #include "memory/heapInspection.hpp"
31 #include "memory/resourceArea.hpp"
32 #include "oops/oop.inline.hpp"
33 #include "runtime/os.hpp"
34 #include "utilities/globalDefinitions.hpp"
35 #include "utilities/macros.hpp"
36 #include "utilities/stack.inline.hpp"
37
38 // HeapInspection
39
40 int KlassSizeStats::count(oop x) {
41 return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
42 }
43
44 int KlassSizeStats::count_array(objArrayOop x) {
45 return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
46 }
47
48 inline KlassInfoEntry::~KlassInfoEntry() {
49 if (_subclasses != NULL) {
50 delete _subclasses;
51 }
52 }
472 }
473
474 void KlassHierarchy::print_class(outputStream* st, KlassInfoEntry* cie, bool print_interfaces) {
475 ResourceMark rm;
476 InstanceKlass* klass = (InstanceKlass*)cie->klass();
477 int indent = 0;
478
479 // Print indentation with proper indicators of superclass.
480 Klass* super = klass->super();
481 while (super != NULL) {
482 super = super->super();
483 indent++;
484 }
485 print_indent(st, indent);
486 if (indent != 0) st->print("--");
487
488 // Print the class name, its unique ClassLoader identifer, and if it is an interface.
489 print_classname(st, klass);
490 if (klass->is_interface()) {
491 st->print(" (intf)");
492 }
493 st->print("\n");
494
495 // Print any interfaces the class has.
496 if (print_interfaces) {
497 Array<Klass*>* local_intfs = klass->local_interfaces();
498 Array<Klass*>* trans_intfs = klass->transitive_interfaces();
499 for (int i = 0; i < local_intfs->length(); i++) {
500 print_interface(st, local_intfs->at(i), "declared", indent);
501 }
502 for (int i = 0; i < trans_intfs->length(); i++) {
503 Klass* trans_interface = trans_intfs->at(i);
504 // Only print transitive interfaces if they are not also declared.
505 if (!local_intfs->contains(trans_interface)) {
506 print_interface(st, trans_interface, "inherited", indent);
507 }
508 }
509 }
510 }
511
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoaderData.inline.hpp"
27 #include "classfile/moduleEntry.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "gc/shared/collectedHeap.hpp"
30 #include "memory/heapInspection.hpp"
31 #include "memory/resourceArea.hpp"
32 #include "oops/oop.inline.hpp"
33 #include "oops/reflectionAccessorImplKlassHelper.hpp"
34 #include "runtime/os.hpp"
35 #include "utilities/globalDefinitions.hpp"
36 #include "utilities/macros.hpp"
37 #include "utilities/stack.inline.hpp"
38
39 // HeapInspection
40
41 int KlassSizeStats::count(oop x) {
42 return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
43 }
44
45 int KlassSizeStats::count_array(objArrayOop x) {
46 return (HeapWordSize * (((x) != NULL) ? (x)->size() : 0));
47 }
48
49 inline KlassInfoEntry::~KlassInfoEntry() {
50 if (_subclasses != NULL) {
51 delete _subclasses;
52 }
53 }
473 }
474
475 void KlassHierarchy::print_class(outputStream* st, KlassInfoEntry* cie, bool print_interfaces) {
476 ResourceMark rm;
477 InstanceKlass* klass = (InstanceKlass*)cie->klass();
478 int indent = 0;
479
480 // Print indentation with proper indicators of superclass.
481 Klass* super = klass->super();
482 while (super != NULL) {
483 super = super->super();
484 indent++;
485 }
486 print_indent(st, indent);
487 if (indent != 0) st->print("--");
488
489 // Print the class name, its unique ClassLoader identifer, and if it is an interface.
490 print_classname(st, klass);
491 if (klass->is_interface()) {
492 st->print(" (intf)");
493 }
494 // Special treatment for generated core reflection accessor classes: print invocation target.
495 if (ReflectionAccessorImplKlassHelper::is_generated_accessor(klass)) {
496 st->print(" (invokes: ");
497 ReflectionAccessorImplKlassHelper::print_invocation_target(st, klass);
498 st->print(")");
499 }
500 st->print("\n");
501
502 // Print any interfaces the class has.
503 if (print_interfaces) {
504 Array<Klass*>* local_intfs = klass->local_interfaces();
505 Array<Klass*>* trans_intfs = klass->transitive_interfaces();
506 for (int i = 0; i < local_intfs->length(); i++) {
507 print_interface(st, local_intfs->at(i), "declared", indent);
508 }
509 for (int i = 0; i < trans_intfs->length(); i++) {
510 Klass* trans_interface = trans_intfs->at(i);
511 // Only print transitive interfaces if they are not also declared.
512 if (!local_intfs->contains(trans_interface)) {
513 print_interface(st, trans_interface, "inherited", indent);
514 }
515 }
516 }
517 }
518
|