src/share/vm/gc_interface/collectedHeap.hpp

Print this page
rev 4802 : imported patch optimize-nmethod-scanning


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

  46 
  47 class GCMessage : public FormatBuffer<1024> {
  48  public:
  49   bool is_before;
  50 
  51  public:
  52   GCMessage() {}
  53 };
  54 
  55 class GCHeapLog : public EventLogBase<GCMessage> {
  56  private:
  57   void log_heap(bool before);
  58 
  59  public:
  60   GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
  61 
  62   void log_heap_before() {
  63     log_heap(true);
  64   }
  65   void log_heap_after() {


 590   virtual void print_tracing_info() const = 0;
 591 
 592   // If PrintHeapAtGC is set call the appropriate routi
 593   void print_heap_before_gc() {
 594     if (PrintHeapAtGC) {
 595       Universe::print_heap_before_gc();
 596     }
 597     if (_gc_heap_log != NULL) {
 598       _gc_heap_log->log_heap_before();
 599     }
 600   }
 601   void print_heap_after_gc() {
 602     if (PrintHeapAtGC) {
 603       Universe::print_heap_after_gc();
 604     }
 605     if (_gc_heap_log != NULL) {
 606       _gc_heap_log->log_heap_after();
 607     }
 608   }
 609 





 610   // Heap verification
 611   virtual void verify(bool silent, VerifyOption option) = 0;
 612 
 613   // Non product verification and debugging.
 614 #ifndef PRODUCT
 615   // Support for PromotionFailureALot.  Return true if it's time to cause a
 616   // promotion failure.  The no-argument version uses
 617   // this->_promotion_failure_alot_count as the counter.
 618   inline bool promotion_should_fail(volatile size_t* count);
 619   inline bool promotion_should_fail();
 620 
 621   // Reset the PromotionFailureALot counters.  Should be called at the end of a
 622   // GC in which promotion failure ocurred.
 623   inline void reset_promotion_should_fail(volatile size_t* count);
 624   inline void reset_promotion_should_fail();
 625 #endif  // #ifndef PRODUCT
 626 
 627 #ifdef ASSERT
 628   static int fired_fake_oom() {
 629     return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);




  26 #define SHARE_VM_GC_INTERFACE_COLLECTEDHEAP_HPP
  27 
  28 #include "gc_interface/gcCause.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/barrierSet.hpp"
  31 #include "runtime/handles.hpp"
  32 #include "runtime/perfData.hpp"
  33 #include "runtime/safepoint.hpp"
  34 #include "utilities/events.hpp"
  35 
  36 // A "CollectedHeap" is an implementation of a java heap for HotSpot.  This
  37 // is an abstract class: there may be many different kinds of heaps.  This
  38 // class defines the functions that a heap must implement, and contains
  39 // infrastructure common to all heaps.
  40 
  41 class BarrierSet;
  42 class ThreadClosure;
  43 class AdaptiveSizePolicy;
  44 class Thread;
  45 class CollectorPolicy;
  46 class nmethod;
  47 
  48 class GCMessage : public FormatBuffer<1024> {
  49  public:
  50   bool is_before;
  51 
  52  public:
  53   GCMessage() {}
  54 };
  55 
  56 class GCHeapLog : public EventLogBase<GCMessage> {
  57  private:
  58   void log_heap(bool before);
  59 
  60  public:
  61   GCHeapLog() : EventLogBase<GCMessage>("GC Heap History") {}
  62 
  63   void log_heap_before() {
  64     log_heap(true);
  65   }
  66   void log_heap_after() {


 591   virtual void print_tracing_info() const = 0;
 592 
 593   // If PrintHeapAtGC is set call the appropriate routi
 594   void print_heap_before_gc() {
 595     if (PrintHeapAtGC) {
 596       Universe::print_heap_before_gc();
 597     }
 598     if (_gc_heap_log != NULL) {
 599       _gc_heap_log->log_heap_before();
 600     }
 601   }
 602   void print_heap_after_gc() {
 603     if (PrintHeapAtGC) {
 604       Universe::print_heap_after_gc();
 605     }
 606     if (_gc_heap_log != NULL) {
 607       _gc_heap_log->log_heap_after();
 608     }
 609   }
 610 
 611   // Registering and unregistering an nmethod (compiled code) with the heap.
 612   // Override with specific mechanism for each specialized heap type
 613   virtual void register_nmethod(nmethod* nm) {}
 614   virtual void unregister_nmethod(nmethod* nm) {}
 615 
 616   // Heap verification
 617   virtual void verify(bool silent, VerifyOption option) = 0;
 618 
 619   // Non product verification and debugging.
 620 #ifndef PRODUCT
 621   // Support for PromotionFailureALot.  Return true if it's time to cause a
 622   // promotion failure.  The no-argument version uses
 623   // this->_promotion_failure_alot_count as the counter.
 624   inline bool promotion_should_fail(volatile size_t* count);
 625   inline bool promotion_should_fail();
 626 
 627   // Reset the PromotionFailureALot counters.  Should be called at the end of a
 628   // GC in which promotion failure ocurred.
 629   inline void reset_promotion_should_fail(volatile size_t* count);
 630   inline void reset_promotion_should_fail();
 631 #endif  // #ifndef PRODUCT
 632 
 633 #ifdef ASSERT
 634   static int fired_fake_oom() {
 635     return (CIFireOOMAt > 1 && _fire_out_of_memory_count >= CIFireOOMAt);