src/share/vm/memory/metaspace.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>


 176 
 177   static bool contains(const void *ptr);
 178   void dump(outputStream* const out) const;
 179 
 180   // Free empty virtualspaces
 181   static void purge();
 182 
 183   void print_on(outputStream* st) const;
 184   // Debugging support
 185   void verify();
 186 
 187   class AllocRecordClosure :  public StackObj {
 188   public:
 189     virtual void doit(address ptr, MetaspaceObj::Type type, int byte_size) = 0;
 190   };
 191 
 192   void iterate(AllocRecordClosure *closure);
 193 };
 194 
 195 class MetaspaceAux : AllStatic {


 196 

 197   // Statistics for class space and data space in metaspace.
 198 
 199   // These methods iterate over the classloader data graph
 200   // for the given Metaspace type.  These are slow.
 201   static size_t used_bytes_slow(Metaspace::MetadataType mdtype);
 202   static size_t free_in_bytes(Metaspace::MetadataType mdtype);
 203   static size_t capacity_bytes_slow(Metaspace::MetadataType mdtype);
 204 
 205   // Iterates over the virtual space list.
 206   static size_t reserved_in_bytes(Metaspace::MetadataType mdtype);
 207 
 208   static size_t free_chunks_total(Metaspace::MetadataType mdtype);
 209   static size_t free_chunks_total_in_bytes(Metaspace::MetadataType mdtype);
 210 
 211  public:
 212   // Running sum of space in all Metachunks that has been
 213   // allocated to a Metaspace.  This is used instead of
 214   // iterating over all the classloaders. One for each
 215   // type of Metadata
 216   static size_t _allocated_capacity_words[Metaspace:: MetadataTypeCount];
 217   // Running sum of space in all Metachunks that have
 218   // are being used for metadata. One for each
 219   // type of Metadata.
 220   static size_t _allocated_used_words[Metaspace:: MetadataTypeCount];
 221 
 222  public:
 223   // Decrement and increment _allocated_capacity_words
 224   static void dec_capacity(Metaspace::MetadataType type, size_t words);
 225   static void inc_capacity(Metaspace::MetadataType type, size_t words);
 226 
 227   // Decrement and increment _allocated_used_words
 228   static void dec_used(Metaspace::MetadataType type, size_t words);
 229   static void inc_used(Metaspace::MetadataType type, size_t words);
 230 
 231   // Total of space allocated to metadata in all Metaspaces.




 176 
 177   static bool contains(const void *ptr);
 178   void dump(outputStream* const out) const;
 179 
 180   // Free empty virtualspaces
 181   static void purge();
 182 
 183   void print_on(outputStream* st) const;
 184   // Debugging support
 185   void verify();
 186 
 187   class AllocRecordClosure :  public StackObj {
 188   public:
 189     virtual void doit(address ptr, MetaspaceObj::Type type, int byte_size) = 0;
 190   };
 191 
 192   void iterate(AllocRecordClosure *closure);
 193 };
 194 
 195 class MetaspaceAux : AllStatic {
 196   static size_t free_chunks_total(Metaspace::MetadataType mdtype);
 197   static size_t free_chunks_total_in_bytes(Metaspace::MetadataType mdtype);
 198 
 199  public:
 200   // Statistics for class space and data space in metaspace.
 201 
 202   // These methods iterate over the classloader data graph
 203   // for the given Metaspace type.  These are slow.
 204   static size_t used_bytes_slow(Metaspace::MetadataType mdtype);
 205   static size_t free_in_bytes(Metaspace::MetadataType mdtype);
 206   static size_t capacity_bytes_slow(Metaspace::MetadataType mdtype);
 207 
 208   // Iterates over the virtual space list.
 209   static size_t reserved_in_bytes(Metaspace::MetadataType mdtype);
 210 




 211   // Running sum of space in all Metachunks that has been
 212   // allocated to a Metaspace.  This is used instead of
 213   // iterating over all the classloaders. One for each
 214   // type of Metadata
 215   static size_t _allocated_capacity_words[Metaspace:: MetadataTypeCount];
 216   // Running sum of space in all Metachunks that have
 217   // are being used for metadata. One for each
 218   // type of Metadata.
 219   static size_t _allocated_used_words[Metaspace:: MetadataTypeCount];
 220 
 221  public:
 222   // Decrement and increment _allocated_capacity_words
 223   static void dec_capacity(Metaspace::MetadataType type, size_t words);
 224   static void inc_capacity(Metaspace::MetadataType type, size_t words);
 225 
 226   // Decrement and increment _allocated_used_words
 227   static void dec_used(Metaspace::MetadataType type, size_t words);
 228   static void inc_used(Metaspace::MetadataType type, size_t words);
 229 
 230   // Total of space allocated to metadata in all Metaspaces.