< prev index next >

src/hotspot/share/memory/allocation.hpp

Print this page




 101 class AllocatedObj {
 102  public:
 103   // Printing support
 104   void print() const;
 105   void print_value() const;
 106 
 107   virtual void print_on(outputStream* st) const;
 108   virtual void print_value_on(outputStream* st) const;
 109 };
 110 #endif
 111 
 112 #define MEMORY_TYPES_DO(f) \
 113   /* Memory type by sub systems. It occupies lower byte. */  \
 114   f(mtJavaHeap,      "Java Heap")   /* Java heap                                 */ \
 115   f(mtClass,         "Class")       /* Java classes                              */ \
 116   f(mtThread,        "Thread")      /* thread objects                            */ \
 117   f(mtThreadStack,   "Thread Stack")                                                \
 118   f(mtCode,          "Code")        /* generated code                            */ \
 119   f(mtGC,            "GC")                                                          \
 120   f(mtCompiler,      "Compiler")                                                    \
 121   f(mtJVMCI,         "JVMCI")                                                       \
 122   f(mtInternal,      "Internal")    /* memory used by VM, but does not belong to */ \
 123                                     /* any of above categories, and not used by  */ \
 124                                     /* NMT                                       */ \
 125   f(mtOther,         "Other")       /* memory not used by VM                     */ \
 126   f(mtSymbol,        "Symbol")                                                      \
 127   f(mtNMT,           "Native Memory Tracking")  /* memory used by NMT            */ \
 128   f(mtClassShared,   "Shared class space")      /* class data sharing            */ \
 129   f(mtChunk,         "Arena Chunk") /* chunk that holds content of arenas        */ \
 130   f(mtTest,          "Test")        /* Test type for verifying NMT               */ \
 131   f(mtTracing,       "Tracing")                                                     \
 132   f(mtLogging,       "Logging")                                                     \
 133   f(mtStatistics,    "Statistics")                                                  \
 134   f(mtArguments,     "Arguments")                                                   \
 135   f(mtModule,        "Module")                                                      \
 136   f(mtSafepoint,     "Safepoint")                                                   \
 137   f(mtSynchronizer,  "Synchronization")                                             \
 138   f(mtNone,          "Unknown")                                                     \
 139   //end
 140 
 141 #define MEMORY_TYPE_DECLARE_ENUM(type, human_readable) \
 142   type,
 143 
 144 /*
 145  * Memory types
 146  */
 147 enum MemoryType {
 148   MEMORY_TYPES_DO(MEMORY_TYPE_DECLARE_ENUM)
 149   mt_number_of_types   // number of memory types (mtDontTrack
 150                        // is not included as validate type)
 151 };
 152 
 153 typedef MemoryType MEMFLAGS;


 237   void  operator delete [](void* p);
 238 };
 239 
 240 // Base class for objects stored in Metaspace.
 241 // Calling delete will result in fatal error.
 242 //
 243 // Do not inherit from something with a vptr because this class does
 244 // not introduce one.  This class is used to allocate both shared read-only
 245 // and shared read-write classes.
 246 //
 247 
 248 class ClassLoaderData;
 249 class MetaspaceClosure;
 250 
 251 class MetaspaceObj {
 252   friend class VMStructs;
 253   // When CDS is enabled, all shared metaspace objects are mapped
 254   // into a single contiguous memory block, so we can use these
 255   // two pointers to quickly determine if something is in the
 256   // shared metaspace.

 257   // When CDS is not enabled, both pointers are set to NULL.
 258   static void* _shared_metaspace_base;  // (inclusive) low address
 259   static void* _shared_metaspace_top;   // (exclusive) high address
 260 
 261  public:
 262 
 263   // Returns true if the pointer points to a valid MetaspaceObj. A valid
 264   // MetaspaceObj is MetaWord-aligned and contained within either
 265   // non-shared or shared metaspace.
 266   static bool is_valid(const MetaspaceObj* p);
 267 
 268   static bool is_shared(const MetaspaceObj* p) {
 269     // If no shared metaspace regions are mapped, _shared_metaspace_{base,top} will
 270     // both be NULL and all values of p will be rejected quickly.
 271     return (((void*)p) < _shared_metaspace_top &&
 272             ((void*)p) >= _shared_metaspace_base);
 273   }
 274   bool is_shared() const { return MetaspaceObj::is_shared(this); }
 275 
 276   void print_address_on(outputStream* st) const;  // nonvirtual address printing
 277 
 278   static void set_shared_metaspace_range(void* base, void* top) {
 279     _shared_metaspace_base = base;
 280     _shared_metaspace_top = top;
 281   }
 282 
 283   static void expand_shared_metaspace_range(void* top) {
 284     assert(top >= _shared_metaspace_top, "must be");
 285     _shared_metaspace_top = top;
 286   }
 287 
 288   static void* shared_metaspace_base() { return _shared_metaspace_base; }
 289   static void* shared_metaspace_top()  { return _shared_metaspace_top;  }
 290 
 291 #define METASPACE_OBJ_TYPES_DO(f) \
 292   f(Class) \
 293   f(Symbol) \
 294   f(TypeArrayU1) \
 295   f(TypeArrayU2) \
 296   f(TypeArrayU4) \
 297   f(TypeArrayU8) \
 298   f(TypeArrayOther) \
 299   f(Method) \
 300   f(ConstMethod) \
 301   f(MethodData) \
 302   f(ConstantPool) \
 303   f(ConstantPoolCache) \
 304   f(Annotations) \
 305   f(MethodCounters)
 306 
 307 #define METASPACE_OBJ_TYPE_DECLARE(name) name ## Type,




 101 class AllocatedObj {
 102  public:
 103   // Printing support
 104   void print() const;
 105   void print_value() const;
 106 
 107   virtual void print_on(outputStream* st) const;
 108   virtual void print_value_on(outputStream* st) const;
 109 };
 110 #endif
 111 
 112 #define MEMORY_TYPES_DO(f) \
 113   /* Memory type by sub systems. It occupies lower byte. */  \
 114   f(mtJavaHeap,      "Java Heap")   /* Java heap                                 */ \
 115   f(mtClass,         "Class")       /* Java classes                              */ \
 116   f(mtThread,        "Thread")      /* thread objects                            */ \
 117   f(mtThreadStack,   "Thread Stack")                                                \
 118   f(mtCode,          "Code")        /* generated code                            */ \
 119   f(mtGC,            "GC")                                                          \
 120   f(mtCompiler,      "Compiler")                                                    \

 121   f(mtInternal,      "Internal")    /* memory used by VM, but does not belong to */ \
 122                                     /* any of above categories, and not used by  */ \
 123                                     /* NMT                                       */ \
 124   f(mtOther,         "Other")       /* memory not used by VM                     */ \
 125   f(mtSymbol,        "Symbol")                                                      \
 126   f(mtNMT,           "Native Memory Tracking")  /* memory used by NMT            */ \
 127   f(mtClassShared,   "Shared class space")      /* class data sharing            */ \
 128   f(mtChunk,         "Arena Chunk") /* chunk that holds content of arenas        */ \
 129   f(mtTest,          "Test")        /* Test type for verifying NMT               */ \
 130   f(mtTracing,       "Tracing")                                                     \
 131   f(mtLogging,       "Logging")                                                     \

 132   f(mtArguments,     "Arguments")                                                   \
 133   f(mtModule,        "Module")                                                      \
 134   f(mtSafepoint,     "Safepoint")                                                   \
 135   f(mtSynchronizer,  "Synchronization")                                             \
 136   f(mtNone,          "Unknown")                                                     \
 137   //end
 138 
 139 #define MEMORY_TYPE_DECLARE_ENUM(type, human_readable) \
 140   type,
 141 
 142 /*
 143  * Memory types
 144  */
 145 enum MemoryType {
 146   MEMORY_TYPES_DO(MEMORY_TYPE_DECLARE_ENUM)
 147   mt_number_of_types   // number of memory types (mtDontTrack
 148                        // is not included as validate type)
 149 };
 150 
 151 typedef MemoryType MEMFLAGS;


 235   void  operator delete [](void* p);
 236 };
 237 
 238 // Base class for objects stored in Metaspace.
 239 // Calling delete will result in fatal error.
 240 //
 241 // Do not inherit from something with a vptr because this class does
 242 // not introduce one.  This class is used to allocate both shared read-only
 243 // and shared read-write classes.
 244 //
 245 
 246 class ClassLoaderData;
 247 class MetaspaceClosure;
 248 
 249 class MetaspaceObj {
 250   friend class VMStructs;
 251   // When CDS is enabled, all shared metaspace objects are mapped
 252   // into a single contiguous memory block, so we can use these
 253   // two pointers to quickly determine if something is in the
 254   // shared metaspace.
 255   //
 256   // When CDS is not enabled, both pointers are set to NULL.
 257   static void* _shared_metaspace_base; // (inclusive) low address
 258   static void* _shared_metaspace_top;  // (exclusive) high address
 259 
 260  public:
 261   bool is_metaspace_object() const;
 262   bool is_shared() const {





 263     // If no shared metaspace regions are mapped, _shared_metaspace_{base,top} will
 264     // both be NULL and all values of p will be rejected quickly.
 265     return (((void*)this) < _shared_metaspace_top && ((void*)this) >= _shared_metaspace_base);

 266   }


 267   void print_address_on(outputStream* st) const;  // nonvirtual address printing
 268 
 269   static void set_shared_metaspace_range(void* base, void* top) {
 270     _shared_metaspace_base = base;
 271     _shared_metaspace_top = top;
 272   }






 273   static void* shared_metaspace_base() { return _shared_metaspace_base; }
 274   static void* shared_metaspace_top()  { return _shared_metaspace_top;  }
 275 
 276 #define METASPACE_OBJ_TYPES_DO(f) \
 277   f(Class) \
 278   f(Symbol) \
 279   f(TypeArrayU1) \
 280   f(TypeArrayU2) \
 281   f(TypeArrayU4) \
 282   f(TypeArrayU8) \
 283   f(TypeArrayOther) \
 284   f(Method) \
 285   f(ConstMethod) \
 286   f(MethodData) \
 287   f(ConstantPool) \
 288   f(ConstantPoolCache) \
 289   f(Annotations) \
 290   f(MethodCounters)
 291 
 292 #define METASPACE_OBJ_TYPE_DECLARE(name) name ## Type,


< prev index next >