< prev index next >

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

Print this page
rev 9681 : 8065331: Add trace events for failed allocations


 149   }
 150 
 151   ~VM_GC_HeapInspection() {}
 152   virtual VMOp_Type type() const { return VMOp_GC_HeapInspection; }
 153   virtual bool skip_operation() const;
 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 class VM_CollectForAllocation : public VM_GC_Operation {
 164  protected:
 165   size_t    _word_size; // Size of object to be allocated (in number of words)
 166   HeapWord* _result;    // Allocation result (NULL if allocation failed)
 167 
 168  public:
 169   VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause)
 170     : VM_GC_Operation(gc_count_before, cause), _result(NULL), _word_size(word_size) {}
 171 
 172   HeapWord* result() const {
 173     return _result;
 174   }
 175 };
 176 
 177 class VM_GenCollectForAllocation : public VM_CollectForAllocation {
 178  private:
 179   bool        _tlab;                       // alloc is of a tlab.
 180  public:
 181   VM_GenCollectForAllocation(size_t word_size,
 182                              bool tlab,
 183                              uint gc_count_before)
 184     : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure),
 185       _tlab(tlab) {
 186     assert(word_size != 0, "An allocation should always be requested with this operation.");
 187   }
 188   ~VM_GenCollectForAllocation()  {}
 189   virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
 190   virtual void doit();


 203     : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
 204       _max_generation(max_generation) { }
 205   ~VM_GenCollectFull() {}
 206   virtual VMOp_Type type() const { return VMOp_GenCollectFull; }
 207   virtual void doit();
 208 };
 209 
 210 class VM_CollectForMetadataAllocation: public VM_GC_Operation {
 211  private:
 212   MetaWord*                _result;
 213   size_t                   _size;     // size of object to be allocated
 214   Metaspace::MetadataType  _mdtype;
 215   ClassLoaderData*         _loader_data;
 216 
 217  public:
 218   VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
 219                                   size_t size,
 220                                   Metaspace::MetadataType mdtype,
 221                                   uint gc_count_before,
 222                                   uint full_gc_count_before,
 223                                   GCCause::Cause gc_cause)
 224     : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
 225       _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) {
 226   }
 227 
 228   virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; }
 229   virtual void doit();
 230   MetaWord* result() const       { return _result; }
 231 
 232   bool initiate_concurrent_GC();
 233 };
 234 
 235 class SvcGCMarker : public StackObj {
 236  private:
 237   JvmtiGCMarker _jgcm;
 238  public:
 239   typedef enum { MINOR, FULL, OTHER } reason_type;
 240 
 241   SvcGCMarker(reason_type reason ) {
 242     VM_GC_Operation::notify_gc_begin(reason == FULL);
 243   }
 244 
 245   ~SvcGCMarker() {
 246     VM_GC_Operation::notify_gc_end();


 149   }
 150 
 151   ~VM_GC_HeapInspection() {}
 152   virtual VMOp_Type type() const { return VMOp_GC_HeapInspection; }
 153   virtual bool skip_operation() const;
 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 class VM_CollectForAllocation : public VM_GC_Operation {
 164  protected:
 165   size_t    _word_size; // Size of object to be allocated (in number of words)
 166   HeapWord* _result;    // Allocation result (NULL if allocation failed)
 167 
 168  public:
 169   VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause);

 170 
 171   HeapWord* result() const {
 172     return _result;
 173   }
 174 };
 175 
 176 class VM_GenCollectForAllocation : public VM_CollectForAllocation {
 177  private:
 178   bool        _tlab;                       // alloc is of a tlab.
 179  public:
 180   VM_GenCollectForAllocation(size_t word_size,
 181                              bool tlab,
 182                              uint gc_count_before)
 183     : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure),
 184       _tlab(tlab) {
 185     assert(word_size != 0, "An allocation should always be requested with this operation.");
 186   }
 187   ~VM_GenCollectForAllocation()  {}
 188   virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
 189   virtual void doit();


 202     : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
 203       _max_generation(max_generation) { }
 204   ~VM_GenCollectFull() {}
 205   virtual VMOp_Type type() const { return VMOp_GenCollectFull; }
 206   virtual void doit();
 207 };
 208 
 209 class VM_CollectForMetadataAllocation: public VM_GC_Operation {
 210  private:
 211   MetaWord*                _result;
 212   size_t                   _size;     // size of object to be allocated
 213   Metaspace::MetadataType  _mdtype;
 214   ClassLoaderData*         _loader_data;
 215 
 216  public:
 217   VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
 218                                   size_t size,
 219                                   Metaspace::MetadataType mdtype,
 220                                   uint gc_count_before,
 221                                   uint full_gc_count_before,
 222                                   GCCause::Cause gc_cause);



 223 
 224   virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; }
 225   virtual void doit();
 226   MetaWord* result() const       { return _result; }
 227 
 228   bool initiate_concurrent_GC();
 229 };
 230 
 231 class SvcGCMarker : public StackObj {
 232  private:
 233   JvmtiGCMarker _jgcm;
 234  public:
 235   typedef enum { MINOR, FULL, OTHER } reason_type;
 236 
 237   SvcGCMarker(reason_type reason ) {
 238     VM_GC_Operation::notify_gc_begin(reason == FULL);
 239   }
 240 
 241   ~SvcGCMarker() {
 242     VM_GC_Operation::notify_gc_end();
< prev index next >