< prev index next >

src/hotspot/share/memory/heapInspection.hpp

Print this page

        

@@ -28,10 +28,11 @@
 #include "memory/allocation.hpp"
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.hpp"
 #include "oops/annotations.hpp"
 #include "utilities/macros.hpp"
+#include "gc/shared/workgroup.hpp"
 
 #if INCLUDE_SERVICES
 
 
 // HeapInspection

@@ -120,10 +121,12 @@
   ~KlassInfoTable();
   bool record_instance(const oop obj);
   void iterate(KlassInfoClosure* cic);
   bool allocation_failed() { return _buckets == NULL; }
   size_t size_of_instances_in_words() const;
+  bool merge(KlassInfoTable* table);
+  bool merge_entry(const KlassInfoEntry* cie);
 
   friend class KlassInfoHisto;
   friend class KlassHierarchy;
 };
 

@@ -209,13 +212,47 @@
 class KlassInfoTable;
 class KlassInfoClosure;
 
 class HeapInspection : public StackObj {
  public:
-  void heap_inspection(outputStream* st) NOT_SERVICES_RETURN;
-  size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN_(0);
+  void heap_inspection(outputStream* st, size_t parallel_thread_num = 1) NOT_SERVICES_RETURN;
+  size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL, size_t parallel_thread_num = 1) NOT_SERVICES_RETURN_(0);
   static void find_instances_at_safepoint(Klass* k, GrowableArray<oop>* result) NOT_SERVICES_RETURN;
  private:
   void iterate_over_heap(KlassInfoTable* cit, BoolObjectClosure* filter = NULL);
 };
 
+class ParHeapInspectTask : public AbstractGangTask {
+ private:
+  CollectedHeap* _heap;
+  KlassInfoTable* _shared_cit;
+  BoolObjectClosure* _filter;
+  size_t* _shared_missed_count;
+  bool _success;
+  Mutex _mutex;
+  size_t _par_thread_num;
+
+ public:
+  ParHeapInspectTask(CollectedHeap* heap, KlassInfoTable* shared_cit,
+                     BoolObjectClosure* filter, size_t* shared_missed_count,
+                     size_t parallel_thread_num) :
+      AbstractGangTask("Iterating heap"),
+      _heap(heap),
+      _shared_cit(shared_cit),
+      _filter(filter),
+      _shared_missed_count(shared_missed_count),
+      _success(true),
+      _mutex(Mutex::leaf, "Parallel heap iteration data merge lock"),
+      _par_thread_num(parallel_thread_num) { }
+
+  bool is_success() {
+    return _success;
+  }
+
+  CollectedHeap* getHeap() {
+    return _heap;
+  }
+  virtual void work(uint worker_id);
+  virtual void do_object_iterate_parallel(ObjectClosure* closure, uint worker_id) = 0;
+};
+
 #endif // SHARE_MEMORY_HEAPINSPECTION_HPP
< prev index next >