< prev index next >

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

Print this page




  41 class AdaptiveSizePolicy;
  42 class BarrierSet;
  43 class CollectorPolicy;
  44 class GCHeapSummary;
  45 class GCTimer;
  46 class GCTracer;
  47 class MetaspaceSummary;
  48 class Thread;
  49 class ThreadClosure;
  50 class VirtualSpaceSummary;
  51 class nmethod;
  52 
  53 class GCMessage : public FormatBuffer<1024> {
  54  public:
  55   bool is_before;
  56 
  57  public:
  58   GCMessage() {}
  59 };
  60 


  61 class GCHeapLog : public EventLogBase<GCMessage> {
  62  private:
  63   void log_heap(bool before);
  64 
  65  public:
  66   GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
  67 
  68   void log_heap_before() {
  69     log_heap(true);
  70   }
  71   void log_heap_after() {
  72     log_heap(false);
  73   }
  74 };
  75 
  76 //
  77 // CollectedHeap
  78 //   GenCollectedHeap
  79 //   G1CollectedHeap
  80 //   ParallelScavengeHeap
  81 //
  82 class CollectedHeap : public CHeapObj<mtInternal> {
  83   friend class VMStructs;
  84   friend class IsGCActiveMark; // Block structured external access to _is_gc_active
  85 
  86  private:
  87 #ifdef ASSERT
  88   static int       _fire_out_of_memory_count;
  89 #endif
  90 
  91   GCHeapLog* _gc_heap_log;
  92 


 502   // non-object.
 503   virtual HeapWord* block_start(const void* addr) const = 0;
 504 
 505   // Requires "addr" to be the start of a chunk, and returns its size.
 506   // "addr + size" is required to be the start of a new chunk, or the end
 507   // of the active area of the heap.
 508   virtual size_t block_size(const HeapWord* addr) const = 0;
 509 
 510   // Requires "addr" to be the start of a block, and returns "TRUE" iff
 511   // the block is an object.
 512   virtual bool block_is_obj(const HeapWord* addr) const = 0;
 513 
 514   // Returns the longest time (in ms) that has elapsed since the last
 515   // time that any part of the heap was examined by a garbage collection.
 516   virtual jlong millis_since_last_gc() = 0;
 517 
 518   // Perform any cleanup actions necessary before allowing a verification.
 519   virtual void prepare_for_verify() = 0;
 520 
 521   // Generate any dumps preceding or following a full gc



 522   void pre_full_gc_dump(GCTimer* timer);
 523   void post_full_gc_dump(GCTimer* timer);
 524 
 525   VirtualSpaceSummary create_heap_space_summary();
 526   GCHeapSummary create_heap_summary();
 527 
 528   MetaspaceSummary create_metaspace_summary();
 529 
 530   // Print heap information on the given outputStream.
 531   virtual void print_on(outputStream* st) const = 0;
 532   // The default behavior is to call print_on() on tty.
 533   virtual void print() const {
 534     print_on(tty);
 535   }
 536   // Print more detailed heap information on the given
 537   // outputStream. The default behavior is to call print_on(). It is
 538   // up to each subclass to override it and add any additional output
 539   // it needs.
 540   virtual void print_extended_on(outputStream* st) const {
 541     print_on(st);


 552   }
 553   // Iterator for all GC threads (other than VM thread)
 554   virtual void gc_threads_do(ThreadClosure* tc) const = 0;
 555 
 556   // Print any relevant tracing info that flags imply.
 557   // Default implementation does nothing.
 558   virtual void print_tracing_info() const = 0;
 559 
 560   void print_heap_before_gc();
 561   void print_heap_after_gc();
 562 
 563   // Registering and unregistering an nmethod (compiled code) with the heap.
 564   // Override with specific mechanism for each specialized heap type.
 565   virtual void register_nmethod(nmethod* nm);
 566   virtual void unregister_nmethod(nmethod* nm);
 567 
 568   void trace_heap_before_gc(const GCTracer* gc_tracer);
 569   void trace_heap_after_gc(const GCTracer* gc_tracer);
 570 
 571   // Heap verification
 572   virtual void verify(bool silent, VerifyOption option) = 0;
 573 
 574   // Non product verification and debugging.
 575 #ifndef PRODUCT
 576   // Support for PromotionFailureALot.  Return true if it's time to cause a
 577   // promotion failure.  The no-argument version uses
 578   // this->_promotion_failure_alot_count as the counter.
 579   inline bool promotion_should_fail(volatile size_t* count);
 580   inline bool promotion_should_fail();
 581 
 582   // Reset the PromotionFailureALot counters.  Should be called at the end of a
 583   // GC in which promotion failure occurred.
 584   inline void reset_promotion_should_fail(volatile size_t* count);
 585   inline void reset_promotion_should_fail();
 586 #endif  // #ifndef PRODUCT
 587 
 588 #ifdef ASSERT
 589   static int fired_fake_oom() {
 590     return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
 591   }
 592 #endif




  41 class AdaptiveSizePolicy;
  42 class BarrierSet;
  43 class CollectorPolicy;
  44 class GCHeapSummary;
  45 class GCTimer;
  46 class GCTracer;
  47 class MetaspaceSummary;
  48 class Thread;
  49 class ThreadClosure;
  50 class VirtualSpaceSummary;
  51 class nmethod;
  52 
  53 class GCMessage : public FormatBuffer<1024> {
  54  public:
  55   bool is_before;
  56 
  57  public:
  58   GCMessage() {}
  59 };
  60 
  61 class CollectedHeap;
  62 
  63 class GCHeapLog : public EventLogBase<GCMessage> {
  64  private:
  65   void log_heap(CollectedHeap* heap, bool before);
  66 
  67  public:
  68   GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
  69 
  70   void log_heap_before(CollectedHeap* heap) {
  71     log_heap(heap, true);
  72   }
  73   void log_heap_after(CollectedHeap* heap) {
  74     log_heap(heap, false);
  75   }
  76 };
  77 
  78 //
  79 // CollectedHeap
  80 //   GenCollectedHeap
  81 //   G1CollectedHeap
  82 //   ParallelScavengeHeap
  83 //
  84 class CollectedHeap : public CHeapObj<mtInternal> {
  85   friend class VMStructs;
  86   friend class IsGCActiveMark; // Block structured external access to _is_gc_active
  87 
  88  private:
  89 #ifdef ASSERT
  90   static int       _fire_out_of_memory_count;
  91 #endif
  92 
  93   GCHeapLog* _gc_heap_log;
  94 


 504   // non-object.
 505   virtual HeapWord* block_start(const void* addr) const = 0;
 506 
 507   // Requires "addr" to be the start of a chunk, and returns its size.
 508   // "addr + size" is required to be the start of a new chunk, or the end
 509   // of the active area of the heap.
 510   virtual size_t block_size(const HeapWord* addr) const = 0;
 511 
 512   // Requires "addr" to be the start of a block, and returns "TRUE" iff
 513   // the block is an object.
 514   virtual bool block_is_obj(const HeapWord* addr) const = 0;
 515 
 516   // Returns the longest time (in ms) that has elapsed since the last
 517   // time that any part of the heap was examined by a garbage collection.
 518   virtual jlong millis_since_last_gc() = 0;
 519 
 520   // Perform any cleanup actions necessary before allowing a verification.
 521   virtual void prepare_for_verify() = 0;
 522 
 523   // Generate any dumps preceding or following a full gc
 524  private:
 525   void full_gc_dump(GCTimer* timer, const char* when);
 526  public:
 527   void pre_full_gc_dump(GCTimer* timer);
 528   void post_full_gc_dump(GCTimer* timer);
 529 
 530   VirtualSpaceSummary create_heap_space_summary();
 531   GCHeapSummary create_heap_summary();
 532 
 533   MetaspaceSummary create_metaspace_summary();
 534 
 535   // Print heap information on the given outputStream.
 536   virtual void print_on(outputStream* st) const = 0;
 537   // The default behavior is to call print_on() on tty.
 538   virtual void print() const {
 539     print_on(tty);
 540   }
 541   // Print more detailed heap information on the given
 542   // outputStream. The default behavior is to call print_on(). It is
 543   // up to each subclass to override it and add any additional output
 544   // it needs.
 545   virtual void print_extended_on(outputStream* st) const {
 546     print_on(st);


 557   }
 558   // Iterator for all GC threads (other than VM thread)
 559   virtual void gc_threads_do(ThreadClosure* tc) const = 0;
 560 
 561   // Print any relevant tracing info that flags imply.
 562   // Default implementation does nothing.
 563   virtual void print_tracing_info() const = 0;
 564 
 565   void print_heap_before_gc();
 566   void print_heap_after_gc();
 567 
 568   // Registering and unregistering an nmethod (compiled code) with the heap.
 569   // Override with specific mechanism for each specialized heap type.
 570   virtual void register_nmethod(nmethod* nm);
 571   virtual void unregister_nmethod(nmethod* nm);
 572 
 573   void trace_heap_before_gc(const GCTracer* gc_tracer);
 574   void trace_heap_after_gc(const GCTracer* gc_tracer);
 575 
 576   // Heap verification
 577   virtual void verify(VerifyOption option) = 0;
 578 
 579   // Non product verification and debugging.
 580 #ifndef PRODUCT
 581   // Support for PromotionFailureALot.  Return true if it's time to cause a
 582   // promotion failure.  The no-argument version uses
 583   // this->_promotion_failure_alot_count as the counter.
 584   inline bool promotion_should_fail(volatile size_t* count);
 585   inline bool promotion_should_fail();
 586 
 587   // Reset the PromotionFailureALot counters.  Should be called at the end of a
 588   // GC in which promotion failure occurred.
 589   inline void reset_promotion_should_fail(volatile size_t* count);
 590   inline void reset_promotion_should_fail();
 591 #endif  // #ifndef PRODUCT
 592 
 593 #ifdef ASSERT
 594   static int fired_fake_oom() {
 595     return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);
 596   }
 597 #endif


< prev index next >