src/hotspot/share/memory/metaspace.hpp
branchstuefe-new-metaspace-branch
changeset 59272 54750b448264
parent 58063 bdf136b8ae0e
equal deleted inserted replaced
59271:1558266946de 59272:54750b448264
    24 #ifndef SHARE_MEMORY_METASPACE_HPP
    24 #ifndef SHARE_MEMORY_METASPACE_HPP
    25 #define SHARE_MEMORY_METASPACE_HPP
    25 #define SHARE_MEMORY_METASPACE_HPP
    26 
    26 
    27 #include "memory/allocation.hpp"
    27 #include "memory/allocation.hpp"
    28 #include "memory/memRegion.hpp"
    28 #include "memory/memRegion.hpp"
    29 #include "memory/metaspace/metaspaceEnums.hpp"
       
    30 #include "memory/metaspaceChunkFreeListSummary.hpp"
    29 #include "memory/metaspaceChunkFreeListSummary.hpp"
    31 #include "memory/virtualspace.hpp"
    30 #include "memory/virtualspace.hpp"
    32 #include "runtime/globals.hpp"
    31 #include "runtime/globals.hpp"
    33 #include "utilities/exceptions.hpp"
    32 #include "utilities/exceptions.hpp"
    34 #include "utilities/globalDefinitions.hpp"
    33 #include "utilities/globalDefinitions.hpp"
    84 // quantum of metadata.
    83 // quantum of metadata.
    85 
    84 
    86 // Namespace for important central static functions
    85 // Namespace for important central static functions
    87 // (auxiliary stuff goes into MetaspaceUtils)
    86 // (auxiliary stuff goes into MetaspaceUtils)
    88 class Metaspace : public AllStatic {
    87 class Metaspace : public AllStatic {
    89 
    88 public:
       
    89   // Will eventually be moved to metaspaceEnums.hpp and into the metaspace::.. namespace;
       
    90   // for now keep here to keep diff in non-metaspace coding small.
       
    91   enum MetadataType {
       
    92     ClassType,
       
    93     NonClassType,
       
    94     MetadataTypeCount
       
    95   };
       
    96 
       
    97 private:
    90   friend class MetaspaceShared;
    98   friend class MetaspaceShared;
    91 
    99 
    92   // Base and size of the compressed class space.
   100   // Base and size of the compressed class space.
    93   static MetaWord* _compressed_class_space_base;
   101   static MetaWord* _compressed_class_space_base;
    94   static size_t _compressed_class_space_size;
   102   static size_t _compressed_class_space_size;
   151 
   159 
   152   // Free empty virtualspaces
   160   // Free empty virtualspaces
   153   static void purge();
   161   static void purge();
   154 
   162 
   155   static void report_metadata_oome(ClassLoaderData* loader_data, size_t word_size,
   163   static void report_metadata_oome(ClassLoaderData* loader_data, size_t word_size,
   156                                    MetaspaceObj::Type type, metaspace::MetadataType mdtype, TRAPS);
   164                                    MetaspaceObj::Type type, Metaspace::MetadataType mdtype, TRAPS);
   157 
   165 
   158   static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
   166   static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
   159 
   167 
   160   // Return TRUE only if UseCompressedClassPointers is True.
   168   // Return TRUE only if UseCompressedClassPointers is True.
   161   static bool using_class_space() {
   169   static bool using_class_space() {
   247 class MetaspaceUtils : AllStatic {
   255 class MetaspaceUtils : AllStatic {
   248 public:
   256 public:
   249 
   257 
   250   // Committed space actually in use by Metadata
   258   // Committed space actually in use by Metadata
   251   static size_t used_words();
   259   static size_t used_words();
   252   static size_t used_words(metaspace::MetadataType mdtype);
   260   static size_t used_words(Metaspace::MetadataType mdtype);
   253 
   261 
   254   // Space committed for Metaspace
   262   // Space committed for Metaspace
   255   static size_t committed_words();
   263   static size_t committed_words();
   256   static size_t committed_words(metaspace::MetadataType mdtype);
   264   static size_t committed_words(Metaspace::MetadataType mdtype);
   257 
   265 
   258   // Space reserved for Metaspace
   266   // Space reserved for Metaspace
   259   static size_t reserved_words();
   267   static size_t reserved_words();
   260   static size_t reserved_words(metaspace::MetadataType mdtype);
   268   static size_t reserved_words(Metaspace::MetadataType mdtype);
   261 
   269 
   262   // _bytes() variants for convenience...
   270   // _bytes() variants for convenience...
   263   static size_t used_bytes()                                    { return used_words() * BytesPerWord; }
   271   static size_t used_bytes()                                    { return used_words() * BytesPerWord; }
   264   static size_t used_bytes(metaspace::MetadataType mdtype)      { return used_words(mdtype) * BytesPerWord; }
   272   static size_t used_bytes(Metaspace::MetadataType mdtype)      { return used_words(mdtype) * BytesPerWord; }
   265   static size_t committed_bytes()                               { return committed_words() * BytesPerWord; }
   273   static size_t committed_bytes()                               { return committed_words() * BytesPerWord; }
   266   static size_t committed_bytes(metaspace::MetadataType mdtype) { return committed_words(mdtype) * BytesPerWord; }
   274   static size_t committed_bytes(Metaspace::MetadataType mdtype) { return committed_words(mdtype) * BytesPerWord; }
   267   static size_t reserved_bytes()                                { return reserved_words() * BytesPerWord; }
   275   static size_t reserved_bytes()                                { return reserved_words() * BytesPerWord; }
   268   static size_t reserved_bytes(metaspace::MetadataType mdtype)  { return reserved_words(mdtype) * BytesPerWord; }
   276   static size_t reserved_bytes(Metaspace::MetadataType mdtype)  { return reserved_words(mdtype) * BytesPerWord; }
   269 
   277 
   270   // TODO. Do we need this really? This number is kind of uninformative.
   278   // TODO. Do we need this really? This number is kind of uninformative.
   271   static size_t capacity_bytes()                                { return 0; }
   279   static size_t capacity_bytes()                                { return 0; }
   272   static size_t capacity_bytes(metaspace::MetadataType mdtype)  { return 0; }
   280   static size_t capacity_bytes(Metaspace::MetadataType mdtype)  { return 0; }
   273 
   281 
   274   // Todo. Consolidate.
   282   // Todo. Consolidate.
   275   // Committed space in freelists
   283   // Committed space in freelists
   276   static size_t free_chunks_total_words(metaspace::MetadataType mdtype);
   284   static size_t free_chunks_total_words(Metaspace::MetadataType mdtype);
   277 
   285 
   278   // Todo. Implement or Consolidate.
   286   // Todo. Implement or Consolidate.
   279   static MetaspaceChunkFreeListSummary chunk_free_list_summary(metaspace::MetadataType mdtype) {
   287   static MetaspaceChunkFreeListSummary chunk_free_list_summary(Metaspace::MetadataType mdtype) {
   280     return MetaspaceChunkFreeListSummary(0,0,0,0,0,0,0,0);
   288     return MetaspaceChunkFreeListSummary(0,0,0,0,0,0,0,0);
   281   }
   289   }
   282 
   290 
   283   // Log change in used metadata.
   291   // Log change in used metadata.
   284   static void print_metaspace_change(const metaspace::MetaspaceSizesSnapshot& pre_meta_values);
   292   static void print_metaspace_change(const metaspace::MetaspaceSizesSnapshot& pre_meta_values);
   285 
   293 
   286   // Prints an ASCII representation of the given space.
   294   // Prints an ASCII representation of the given space.
   287   static void print_metaspace_map(outputStream* out, metaspace::MetadataType mdtype);
   295   static void print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype);
   288 
   296 
   289   // This will print out a basic metaspace usage report but
   297   // This will print out a basic metaspace usage report but
   290   // unlike print_report() is guaranteed not to lock or to walk the CLDG.
   298   // unlike print_report() is guaranteed not to lock or to walk the CLDG.
   291   static void print_basic_report(outputStream* st, size_t scale = 0);
   299   static void print_basic_report(outputStream* st, size_t scale = 0);
   292 
   300