< prev index next >

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

Print this page
rev 47972 : [mq]: open.patch


  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  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();


  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);
  94 


  95 private:
  96   WorkGang* _workers;



  97 
  98   virtual void gc_prologue(bool full);
  99   virtual void gc_epilogue(bool full);
 100 
 101   // Accessor for memory state verification support
 102   NOT_PRODUCT(
 103     virtual size_t skip_header_HeapWords() { return CMSCollector::skip_header_HeapWords(); }
 104   )
 105 
 106   // Returns success or failure.
 107   bool create_cms_collector();
 108 
 109   // In support of ExplicitGCInvokesConcurrent functionality
 110   bool should_do_concurrent_full_gc(GCCause::Cause cause);
 111 
 112   void collect_mostly_concurrent(GCCause::Cause cause);
 113 };
 114 
 115 #endif // SHARE_VM_GC_CMS_CMSHEAP_HPP


  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  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 #include "utilities/growableArray.hpp"
  33 
  34 class CLDClosure;
  35 class GenCollectorPolicy;
  36 class GCMemoryManager;
  37 class MemoryPool;
  38 class OopsInGenClosure;
  39 class outputStream;
  40 class StrongRootsScope;
  41 class ThreadClosure;
  42 class WorkGang;
  43 
  44 class CMSHeap : public GenCollectedHeap {
  45 
  46 protected:
  47   virtual void check_gen_kinds();
  48 
  49 public:
  50   CMSHeap(GenCollectorPolicy *policy);
  51 
  52   // Returns JNI_OK on success
  53   virtual jint initialize();
  54 
  55   // Convenience function to be used in situations where the heap type can be
  56   // asserted to be this type.
  57   static CMSHeap* heap();


  66 
  67   WorkGang* workers() const { return _workers; }
  68 
  69   virtual void print_gc_threads_on(outputStream* st) const;
  70   virtual void gc_threads_do(ThreadClosure* tc) const;
  71   virtual void print_on_error(outputStream* st) const;
  72 
  73   // Perform a full collection of the heap; intended for use in implementing
  74   // "System.gc". This implies as full a collection as the CollectedHeap
  75   // supports. Caller does not hold the Heap_lock on entry.
  76   void collect(GCCause::Cause cause);
  77 
  78   bool card_mark_must_follow_store() const {
  79     return true;
  80   }
  81 
  82   void stop();
  83   void safepoint_synchronize_begin();
  84   void safepoint_synchronize_end();
  85 
  86   virtual GrowableArray<GCMemoryManager*> memory_managers();
  87   virtual GrowableArray<MemoryPool*> memory_pools();
  88 
  89   // If "young_gen_as_roots" is false, younger generations are
  90   // not scanned as roots; in this case, the caller must be arranging to
  91   // scan the younger generations itself.  (For example, a generation might
  92   // explicitly mark reachable objects in younger generations, to avoid
  93   // excess storage retention.)
  94   void cms_process_roots(StrongRootsScope* scope,
  95                          bool young_gen_as_roots,
  96                          ScanningOption so,
  97                          bool only_strong_roots,
  98                          OopsInGenClosure* root_closure,
  99                          CLDClosure* cld_closure);
 100 
 101   GCMemoryManager* old_mgr() const { return _old_mgr; }
 102 
 103 private:
 104   WorkGang* _workers;
 105   MemoryPool* _eden_pool;
 106   MemoryPool* _survivor_pool;
 107   MemoryPool* _old_pool;
 108 
 109   virtual void gc_prologue(bool full);
 110   virtual void gc_epilogue(bool full);
 111 
 112   // Accessor for memory state verification support
 113   NOT_PRODUCT(
 114     virtual size_t skip_header_HeapWords() { return CMSCollector::skip_header_HeapWords(); }
 115   )
 116 
 117   // Returns success or failure.
 118   bool create_cms_collector();
 119 
 120   // In support of ExplicitGCInvokesConcurrent functionality
 121   bool should_do_concurrent_full_gc(GCCause::Cause cause);
 122 
 123   void collect_mostly_concurrent(GCCause::Cause cause);
 124 };
 125 
 126 #endif // SHARE_VM_GC_CMS_CMSHEAP_HPP
< prev index next >