src/share/vm/gc_implementation/shared/vmGCOperations.hpp

Print this page
rev 4773 : 8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>


 112   // Acquire the reference synchronization lock
 113   virtual bool doit_prologue();
 114   // Do notifyAll (if needed) and release held lock
 115   virtual void doit_epilogue();
 116 
 117   virtual bool allow_nested_vm_operations() const  { return true; }
 118   bool prologue_succeeded() const { return _prologue_succeeded; }
 119 
 120   void set_gc_locked() { _gc_locked = true; }
 121   bool gc_locked() const  { return _gc_locked; }
 122 
 123   static void notify_gc_begin(bool full = false);
 124   static void notify_gc_end();
 125 };
 126 
 127 
 128 class VM_GC_HeapInspection: public VM_GC_Operation {
 129  private:
 130   outputStream* _out;
 131   bool _full_gc;
 132   bool _need_prologue;
 133   bool _csv_format; // "comma separated values" format for spreadsheet.
 134   bool _print_help;
 135   bool _print_class_stats;
 136   const char* _columns;
 137  public:
 138   VM_GC_HeapInspection(outputStream* out, bool request_full_gc,
 139                        bool need_prologue) :
 140     VM_GC_Operation(0 /* total collections,      dummy, ignored */,
 141                     GCCause::_heap_inspection /* GC Cause */,
 142                     0 /* total full collections, dummy, ignored */,
 143                     request_full_gc) {
 144     _out = out;
 145     _full_gc = request_full_gc;
 146     _need_prologue = need_prologue;
 147     _csv_format = false;
 148     _print_help = false;
 149     _print_class_stats = false;
 150     _columns = NULL;
 151   }
 152 
 153   ~VM_GC_HeapInspection() {}
 154   virtual VMOp_Type type() const { return VMOp_GC_HeapInspection; }
 155   virtual bool skip_operation() const;
 156   virtual bool doit_prologue();
 157   virtual void doit();
 158   void set_csv_format(bool value) {_csv_format = value;}
 159   void set_print_help(bool value) {_print_help = value;}
 160   void set_print_class_stats(bool value) {_print_class_stats = value;}
 161   void set_columns(const char* value) {_columns = value;}


 162 };
 163 
 164 
 165 class VM_GenCollectForAllocation: public VM_GC_Operation {
 166  private:
 167   HeapWord*   _res;
 168   size_t      _size;                       // size of object to be allocated.
 169   bool        _tlab;                       // alloc is of a tlab.
 170  public:
 171   VM_GenCollectForAllocation(size_t size,
 172                              bool tlab,
 173                              unsigned int gc_count_before)
 174     : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure),
 175       _size(size),
 176       _tlab(tlab) {
 177     _res = NULL;
 178   }
 179   ~VM_GenCollectForAllocation()  {}
 180   virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
 181   virtual void doit();




 112   // Acquire the reference synchronization lock
 113   virtual bool doit_prologue();
 114   // Do notifyAll (if needed) and release held lock
 115   virtual void doit_epilogue();
 116 
 117   virtual bool allow_nested_vm_operations() const  { return true; }
 118   bool prologue_succeeded() const { return _prologue_succeeded; }
 119 
 120   void set_gc_locked() { _gc_locked = true; }
 121   bool gc_locked() const  { return _gc_locked; }
 122 
 123   static void notify_gc_begin(bool full = false);
 124   static void notify_gc_end();
 125 };
 126 
 127 
 128 class VM_GC_HeapInspection: public VM_GC_Operation {
 129  private:
 130   outputStream* _out;
 131   bool _full_gc;

 132   bool _csv_format; // "comma separated values" format for spreadsheet.
 133   bool _print_help;
 134   bool _print_class_stats;
 135   const char* _columns;
 136  public:
 137   VM_GC_HeapInspection(outputStream* out, bool request_full_gc) :

 138     VM_GC_Operation(0 /* total collections,      dummy, ignored */,
 139                     GCCause::_heap_inspection /* GC Cause */,
 140                     0 /* total full collections, dummy, ignored */,
 141                     request_full_gc) {
 142     _out = out;
 143     _full_gc = request_full_gc;

 144     _csv_format = false;
 145     _print_help = false;
 146     _print_class_stats = false;
 147     _columns = NULL;
 148   }
 149 
 150   ~VM_GC_HeapInspection() {}
 151   virtual VMOp_Type type() const { return VMOp_GC_HeapInspection; }
 152   virtual bool skip_operation() const;
 153   virtual bool doit_prologue();
 154   virtual void doit();
 155   void set_csv_format(bool value) {_csv_format = value;}
 156   void set_print_help(bool value) {_print_help = value;}
 157   void set_print_class_stats(bool value) {_print_class_stats = value;}
 158   void set_columns(const char* value) {_columns = value;}
 159  protected:
 160   bool collect();
 161 };
 162 
 163 
 164 class VM_GenCollectForAllocation: public VM_GC_Operation {
 165  private:
 166   HeapWord*   _res;
 167   size_t      _size;                       // size of object to be allocated.
 168   bool        _tlab;                       // alloc is of a tlab.
 169  public:
 170   VM_GenCollectForAllocation(size_t size,
 171                              bool tlab,
 172                              unsigned int gc_count_before)
 173     : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure),
 174       _size(size),
 175       _tlab(tlab) {
 176     _res = NULL;
 177   }
 178   ~VM_GenCollectForAllocation()  {}
 179   virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
 180   virtual void doit();