--- old/src/share/vm/memory/heapInspection.hpp 2015-02-09 16:32:23.000000000 -0800 +++ new/src/share/vm/memory/heapInspection.hpp 2015-02-09 16:32:22.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, 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 @@ -188,13 +188,13 @@ long _instance_count; size_t _instance_words; long _index; - long _super_index; + bool _do_print; // True if we should print this class when printing the class hierarchy. GrowableArray* _subclasses; public: KlassInfoEntry(Klass* k, KlassInfoEntry* next) : _klass(k), _instance_count(0), _instance_words(0), _next(next), _index(-1), - _super_index(-1), _subclasses(NULL) + _do_print(false), _subclasses(NULL) {} ~KlassInfoEntry(); KlassInfoEntry* next() const { return _next; } @@ -206,28 +206,15 @@ void set_words(size_t wds) { _instance_words = wds; } void set_index(long index) { _index = index; } long index() const { return _index; } - void set_super_index(long index) { _super_index = index; } - long super_index() const { return _super_index; } GrowableArray* subclasses() const { return _subclasses; } void add_subclass(KlassInfoEntry* cie); + void set_do_print(bool do_print) { _do_print = do_print; } + bool do_print() const { return _do_print; } int compare(KlassInfoEntry* e1, KlassInfoEntry* e2); void print_on(outputStream* st) const; const char* name() const; }; -inline void KlassInfoEntry::add_subclass(KlassInfoEntry* cie) { - if (_subclasses == NULL) { - _subclasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray(4, true); - } - _subclasses->append(cie); -} - -inline KlassInfoEntry::~KlassInfoEntry() { - if (_subclasses != NULL) { - delete _subclasses; - } -} - class KlassInfoClosure : public StackObj { public: // Called for each KlassInfoEntry. @@ -284,11 +271,13 @@ public: KlassHierarchy(KlassInfoTable* cit, const char* title); ~KlassHierarchy(); - static void print_class_hierarchy(outputStream* st); + static void print_class_hierarchy(outputStream* st, bool print_interfaces, bool print_subclasses, + char* classname); -private: - static void print_class(outputStream* st, KlassInfoEntry* cie, - Stack *super_stack); + private: + static void set_do_print_for_class_hierarchy(KlassInfoEntry* cie, KlassInfoTable* cit, + bool print_subclasse); + static void print_class(outputStream* st, KlassInfoEntry* cie, bool print_subclasses); }; class KlassInfoHisto : public StackObj {