< prev index next >

src/hotspot/share/gc/shared/collectedHeap.hpp

Print this page
rev 47864 : 8191564: Refactor GC related servicability code into GC specific subclasses


  27 
  28 #include "gc/shared/gcCause.hpp"
  29 #include "gc/shared/gcWhen.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "runtime/handles.hpp"
  32 #include "runtime/perfData.hpp"
  33 #include "runtime/safepoint.hpp"
  34 #include "utilities/debug.hpp"
  35 #include "utilities/events.hpp"
  36 #include "utilities/formatBuffer.hpp"
  37 
  38 // A "CollectedHeap" is an implementation of a java heap for HotSpot.  This
  39 // is an abstract class: there may be many different kinds of heaps.  This
  40 // class defines the functions that a heap must implement, and contains
  41 // infrastructure common to all heaps.
  42 
  43 class AdaptiveSizePolicy;
  44 class BarrierSet;
  45 class CollectorPolicy;
  46 class GCHeapSummary;

  47 class GCTimer;
  48 class GCTracer;
  49 class MetaspaceSummary;
  50 class Thread;
  51 class ThreadClosure;
  52 class VirtualSpaceSummary;
  53 class WorkGang;
  54 class nmethod;
  55 
  56 class GCMessage : public FormatBuffer<1024> {
  57  public:
  58   bool is_before;
  59 
  60  public:
  61   GCMessage() {}
  62 };
  63 
  64 class CollectedHeap;
  65 
  66 class GCHeapLog : public EventLogBase<GCMessage> {


  87 //   ParallelScavengeHeap
  88 //
  89 class CollectedHeap : public CHeapObj<mtInternal> {
  90   friend class VMStructs;
  91   friend class JVMCIVMStructs;
  92   friend class IsGCActiveMark; // Block structured external access to _is_gc_active
  93 
  94  private:
  95 #ifdef ASSERT
  96   static int       _fire_out_of_memory_count;
  97 #endif
  98 
  99   GCHeapLog* _gc_heap_log;
 100 
 101   // Used in support of ReduceInitialCardMarks; only consulted if COMPILER2
 102   // or INCLUDE_JVMCI is being used
 103   bool _defer_initial_card_mark;
 104 
 105   MemRegion _reserved;
 106 




 107  protected:
 108   BarrierSet* _barrier_set;
 109   bool _is_gc_active;
 110 
 111   // Used for filler objects (static, but initialized in ctor).
 112   static size_t _filler_array_max_size;
 113 
 114   unsigned int _total_collections;          // ... started
 115   unsigned int _total_full_collections;     // ... started
 116   NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
 117   NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;)
 118 
 119   // Reason for current garbage collection.  Should be set to
 120   // a value reflecting no collection between collections.
 121   GCCause::Cause _gc_cause;
 122   GCCause::Cause _gc_lastcause;
 123   PerfStringVariable* _perf_gc_cause;
 124   PerfStringVariable* _perf_gc_lastcause;
 125 
 126   // Constructor


 444   // remembered set.
 445   virtual void flush_deferred_store_barrier(JavaThread* thread);
 446 
 447   // Perform a collection of the heap; intended for use in implementing
 448   // "System.gc".  This probably implies as full a collection as the
 449   // "CollectedHeap" supports.
 450   virtual void collect(GCCause::Cause cause) = 0;
 451 
 452   // Perform a full collection
 453   virtual void do_full_collection(bool clear_all_soft_refs) = 0;
 454 
 455   // This interface assumes that it's being called by the
 456   // vm thread. It collects the heap assuming that the
 457   // heap lock is already held and that we are executing in
 458   // the context of the vm thread.
 459   virtual void collect_as_vm_thread(GCCause::Cause cause);
 460 
 461   // Returns the barrier set for this heap
 462   BarrierSet* barrier_set() { return _barrier_set; }
 463   void set_barrier_set(BarrierSet* barrier_set);


 464 
 465   // Returns "true" iff there is a stop-world GC in progress.  (I assume
 466   // that it should answer "false" for the concurrent part of a concurrent
 467   // collector -- dld).
 468   bool is_gc_active() const { return _is_gc_active; }
 469 
 470   // Total number of GC collections (started)
 471   unsigned int total_collections() const { return _total_collections; }
 472   unsigned int total_full_collections() const { return _total_full_collections;}
 473 
 474   // Increment total number of GC collections (started)
 475   // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
 476   void increment_total_collections(bool full = false) {
 477     _total_collections++;
 478     if (full) {
 479       increment_total_full_collections();
 480     }
 481   }
 482 
 483   void increment_total_full_collections() { _total_full_collections++; }




  27 
  28 #include "gc/shared/gcCause.hpp"
  29 #include "gc/shared/gcWhen.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "runtime/handles.hpp"
  32 #include "runtime/perfData.hpp"
  33 #include "runtime/safepoint.hpp"
  34 #include "utilities/debug.hpp"
  35 #include "utilities/events.hpp"
  36 #include "utilities/formatBuffer.hpp"
  37 
  38 // A "CollectedHeap" is an implementation of a java heap for HotSpot.  This
  39 // is an abstract class: there may be many different kinds of heaps.  This
  40 // class defines the functions that a heap must implement, and contains
  41 // infrastructure common to all heaps.
  42 
  43 class AdaptiveSizePolicy;
  44 class BarrierSet;
  45 class CollectorPolicy;
  46 class GCHeapSummary;
  47 class GCServicabilitySupport;
  48 class GCTimer;
  49 class GCTracer;
  50 class MetaspaceSummary;
  51 class Thread;
  52 class ThreadClosure;
  53 class VirtualSpaceSummary;
  54 class WorkGang;
  55 class nmethod;
  56 
  57 class GCMessage : public FormatBuffer<1024> {
  58  public:
  59   bool is_before;
  60 
  61  public:
  62   GCMessage() {}
  63 };
  64 
  65 class CollectedHeap;
  66 
  67 class GCHeapLog : public EventLogBase<GCMessage> {


  88 //   ParallelScavengeHeap
  89 //
  90 class CollectedHeap : public CHeapObj<mtInternal> {
  91   friend class VMStructs;
  92   friend class JVMCIVMStructs;
  93   friend class IsGCActiveMark; // Block structured external access to _is_gc_active
  94 
  95  private:
  96 #ifdef ASSERT
  97   static int       _fire_out_of_memory_count;
  98 #endif
  99 
 100   GCHeapLog* _gc_heap_log;
 101 
 102   // Used in support of ReduceInitialCardMarks; only consulted if COMPILER2
 103   // or INCLUDE_JVMCI is being used
 104   bool _defer_initial_card_mark;
 105 
 106   MemRegion _reserved;
 107 
 108   GCServicabilitySupport* _servicability;
 109 
 110   virtual GCServicabilitySupport* create_servicability_support() = 0;
 111 
 112  protected:
 113   BarrierSet* _barrier_set;
 114   bool _is_gc_active;
 115 
 116   // Used for filler objects (static, but initialized in ctor).
 117   static size_t _filler_array_max_size;
 118 
 119   unsigned int _total_collections;          // ... started
 120   unsigned int _total_full_collections;     // ... started
 121   NOT_PRODUCT(volatile size_t _promotion_failure_alot_count;)
 122   NOT_PRODUCT(volatile size_t _promotion_failure_alot_gc_number;)
 123 
 124   // Reason for current garbage collection.  Should be set to
 125   // a value reflecting no collection between collections.
 126   GCCause::Cause _gc_cause;
 127   GCCause::Cause _gc_lastcause;
 128   PerfStringVariable* _perf_gc_cause;
 129   PerfStringVariable* _perf_gc_lastcause;
 130 
 131   // Constructor


 449   // remembered set.
 450   virtual void flush_deferred_store_barrier(JavaThread* thread);
 451 
 452   // Perform a collection of the heap; intended for use in implementing
 453   // "System.gc".  This probably implies as full a collection as the
 454   // "CollectedHeap" supports.
 455   virtual void collect(GCCause::Cause cause) = 0;
 456 
 457   // Perform a full collection
 458   virtual void do_full_collection(bool clear_all_soft_refs) = 0;
 459 
 460   // This interface assumes that it's being called by the
 461   // vm thread. It collects the heap assuming that the
 462   // heap lock is already held and that we are executing in
 463   // the context of the vm thread.
 464   virtual void collect_as_vm_thread(GCCause::Cause cause);
 465 
 466   // Returns the barrier set for this heap
 467   BarrierSet* barrier_set() { return _barrier_set; }
 468   void set_barrier_set(BarrierSet* barrier_set);
 469 
 470   GCServicabilitySupport* servicability_support();
 471 
 472   // Returns "true" iff there is a stop-world GC in progress.  (I assume
 473   // that it should answer "false" for the concurrent part of a concurrent
 474   // collector -- dld).
 475   bool is_gc_active() const { return _is_gc_active; }
 476 
 477   // Total number of GC collections (started)
 478   unsigned int total_collections() const { return _total_collections; }
 479   unsigned int total_full_collections() const { return _total_full_collections;}
 480 
 481   // Increment total number of GC collections (started)
 482   // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
 483   void increment_total_collections(bool full = false) {
 484     _total_collections++;
 485     if (full) {
 486       increment_total_full_collections();
 487     }
 488   }
 489 
 490   void increment_total_full_collections() { _total_full_collections++; }


< prev index next >