src/share/vm/memory/heapInspection.hpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -186,17 +186,17 @@
   KlassInfoEntry* _next;
   Klass*          _klass;
   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<KlassInfoEntry*>* _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; }
   bool is_equal(const Klass* k)  { return k == _klass; }
   Klass* klass()  const      { return _klass; }

@@ -204,32 +204,19 @@
   void set_count(long ct)    { _instance_count = ct; }
   size_t words()  const      { return _instance_words; }
   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<KlassInfoEntry*>* 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<KlassInfoEntry*>(4, true);
-  }
-  _subclasses->append(cie);
-}
-
-inline KlassInfoEntry::~KlassInfoEntry() {
-  if (_subclasses != NULL) {
-    delete _subclasses;
-  }
-}
-
 class KlassInfoClosure : public StackObj {
  public:
   // Called for each KlassInfoEntry.
   virtual void do_cinfo(KlassInfoEntry* cie) = 0;
 };

@@ -282,15 +269,17 @@
 
 class KlassHierarchy : public StackObj {
  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 <KlassInfoEntry*, mtClass> *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 {
  private:
   static const int _histo_initial_size = 1000;