< prev index next >

src/hotspot/share/gc/cms/cmsHeap.hpp

Print this page
rev 47476 : 8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass


  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_CMS_CMSHEAP_HPP
  26 #define SHARE_VM_GC_CMS_CMSHEAP_HPP
  27 
  28 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "gc/shared/gcCause.hpp"
  31 #include "gc/shared/genCollectedHeap.hpp"
  32 
  33 class CLDClosure;
  34 class GenCollectorPolicy;
  35 class OopsInGenClosure;
  36 class outputStream;
  37 class StrongRootsScope;
  38 class ThreadClosure;
  39 class WorkGang;
  40 
  41 class CMSHeap : public GenCollectedHeap {




  42 public:
  43   CMSHeap(GenCollectorPolicy *policy);
  44 
  45   // Returns JNI_OK on success
  46   virtual jint initialize();
  47 
  48   virtual void check_gen_kinds();
  49 
  50   // Convenience function to be used in situations where the heap type can be
  51   // asserted to be this type.
  52   static CMSHeap* heap();
  53 
  54   virtual Name kind() const {
  55     return CollectedHeap::CMSHeap;
  56   }
  57 
  58   virtual const char* name() const {
  59     return "Concurrent Mark Sweep";
  60   }
  61 
  62   WorkGang* workers() const { return _workers; }
  63 
  64   virtual void print_gc_threads_on(outputStream* st) const;
  65   virtual void gc_threads_do(ThreadClosure* tc) const;
  66   virtual void print_on_error(outputStream* st) const;
  67 
  68   // Perform a full collection of the heap; intended for use in implementing
  69   // "System.gc". This implies as full a collection as the CollectedHeap
  70   // supports. Caller does not hold the Heap_lock on entry.
  71   void collect(GCCause::Cause cause);
  72 
  73   bool is_in_closed_subset(const void* p) const {
  74     return is_in_reserved(p);
  75   }
  76 
  77   bool card_mark_must_follow_store() const {
  78     return true;
  79   }
  80 
  81   void stop();
  82   void safepoint_synchronize_begin();
  83   void safepoint_synchronize_end();
  84 
  85   // If "young_gen_as_roots" is false, younger generations are
  86   // not scanned as roots; in this case, the caller must be arranging to
  87   // scan the younger generations itself.  (For example, a generation might
  88   // explicitly mark reachable objects in younger generations, to avoid
  89   // excess storage retention.)
  90   void cms_process_roots(StrongRootsScope* scope,
  91                          bool young_gen_as_roots,
  92                          ScanningOption so,
  93                          bool only_strong_roots,
  94                          OopsInGenClosure* root_closure,
  95                          CLDClosure* cld_closure);




  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_CMS_CMSHEAP_HPP
  26 #define SHARE_VM_GC_CMS_CMSHEAP_HPP
  27 
  28 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "gc/shared/gcCause.hpp"
  31 #include "gc/shared/genCollectedHeap.hpp"
  32 
  33 class CLDClosure;
  34 class GenCollectorPolicy;
  35 class OopsInGenClosure;
  36 class outputStream;
  37 class StrongRootsScope;
  38 class ThreadClosure;
  39 class WorkGang;
  40 
  41 class CMSHeap : public GenCollectedHeap {
  42 
  43 protected:
  44   virtual void check_gen_kinds();
  45 
  46 public:
  47   CMSHeap(GenCollectorPolicy *policy);
  48 
  49   // Returns JNI_OK on success
  50   virtual jint initialize();
  51 


  52   // Convenience function to be used in situations where the heap type can be
  53   // asserted to be this type.
  54   static CMSHeap* heap();
  55 
  56   virtual Name kind() const {
  57     return CollectedHeap::CMSHeap;
  58   }
  59 
  60   virtual const char* name() const {
  61     return "Concurrent Mark Sweep";
  62   }
  63 
  64   WorkGang* workers() const { return _workers; }
  65 
  66   virtual void print_gc_threads_on(outputStream* st) const;
  67   virtual void gc_threads_do(ThreadClosure* tc) const;
  68   virtual void print_on_error(outputStream* st) const;
  69 
  70   // Perform a full collection of the heap; intended for use in implementing
  71   // "System.gc". This implies as full a collection as the CollectedHeap
  72   // supports. Caller does not hold the Heap_lock on entry.
  73   void collect(GCCause::Cause cause);




  74 
  75   bool card_mark_must_follow_store() const {
  76     return true;
  77   }
  78 
  79   void stop();
  80   void safepoint_synchronize_begin();
  81   void safepoint_synchronize_end();
  82 
  83   // If "young_gen_as_roots" is false, younger generations are
  84   // not scanned as roots; in this case, the caller must be arranging to
  85   // scan the younger generations itself.  (For example, a generation might
  86   // explicitly mark reachable objects in younger generations, to avoid
  87   // excess storage retention.)
  88   void cms_process_roots(StrongRootsScope* scope,
  89                          bool young_gen_as_roots,
  90                          ScanningOption so,
  91                          bool only_strong_roots,
  92                          OopsInGenClosure* root_closure,
  93                          CLDClosure* cld_closure);


< prev index next >