< prev index next >

src/hotspot/share/memory/metaspace.hpp

Print this page




  70 // Metaspaces each have a  SpaceManager and allocations
  71 // are done by the SpaceManager.  Allocations are done
  72 // out of the current Metachunk.  When the current Metachunk
  73 // is exhausted, the SpaceManager gets a new one from
  74 // the current VirtualSpace.  When the VirtualSpace is exhausted
  75 // the SpaceManager gets a new one.  The SpaceManager
  76 // also manages freelists of available Chunks.
  77 //
  78 // Currently the space manager maintains the list of
  79 // virtual spaces and the list of chunks in use.  Its
  80 // allocate() method returns a block for use as a
  81 // quantum of metadata.
  82 
  83 class Metaspace : public CHeapObj<mtClass> {
  84   friend class VMStructs;
  85   friend class SpaceManager;
  86   friend class VM_CollectForMetadataAllocation;
  87   friend class MetaspaceGC;
  88   friend class MetaspaceAux;
  89   friend class MetaspaceShared;
  90   friend class CollectorPolicy;
  91   friend class PrintCLDMetaspaceInfoClosure;
  92 
  93  public:
  94   enum MetadataType {
  95     ClassType,
  96     NonClassType,
  97     MetadataTypeCount
  98   };
  99   enum MetaspaceType {
 100     StandardMetaspaceType,
 101     BootMetaspaceType,
 102     AnonymousMetaspaceType,
 103     ReflectionMetaspaceType
 104   };
 105 
 106  private:
 107   static void verify_global_initialization();
 108 
 109   void initialize(Mutex* lock, MetaspaceType type);
 110 


 406   static size_t dec_capacity_until_GC(size_t v);
 407 
 408   static bool should_concurrent_collect() { return _should_concurrent_collect; }
 409   static void set_should_concurrent_collect(bool v) {
 410     _should_concurrent_collect = v;
 411   }
 412 
 413   // The amount to increase the high-water-mark (_capacity_until_GC)
 414   static size_t delta_capacity_until_GC(size_t bytes);
 415 
 416   // Tells if we have can expand metaspace without hitting set limits.
 417   static bool can_expand(size_t words, bool is_class);
 418 
 419   // Returns amount that we can expand without hitting a GC,
 420   // measured in words.
 421   static size_t allowed_expansion();
 422 
 423   // Calculate the new high-water mark at which to induce
 424   // a GC.
 425   static void compute_new_size();





 426 };
 427 
 428 #endif // SHARE_VM_MEMORY_METASPACE_HPP


  70 // Metaspaces each have a  SpaceManager and allocations
  71 // are done by the SpaceManager.  Allocations are done
  72 // out of the current Metachunk.  When the current Metachunk
  73 // is exhausted, the SpaceManager gets a new one from
  74 // the current VirtualSpace.  When the VirtualSpace is exhausted
  75 // the SpaceManager gets a new one.  The SpaceManager
  76 // also manages freelists of available Chunks.
  77 //
  78 // Currently the space manager maintains the list of
  79 // virtual spaces and the list of chunks in use.  Its
  80 // allocate() method returns a block for use as a
  81 // quantum of metadata.
  82 
  83 class Metaspace : public CHeapObj<mtClass> {
  84   friend class VMStructs;
  85   friend class SpaceManager;
  86   friend class VM_CollectForMetadataAllocation;
  87   friend class MetaspaceGC;
  88   friend class MetaspaceAux;
  89   friend class MetaspaceShared;

  90   friend class PrintCLDMetaspaceInfoClosure;
  91 
  92  public:
  93   enum MetadataType {
  94     ClassType,
  95     NonClassType,
  96     MetadataTypeCount
  97   };
  98   enum MetaspaceType {
  99     StandardMetaspaceType,
 100     BootMetaspaceType,
 101     AnonymousMetaspaceType,
 102     ReflectionMetaspaceType
 103   };
 104 
 105  private:
 106   static void verify_global_initialization();
 107 
 108   void initialize(Mutex* lock, MetaspaceType type);
 109 


 405   static size_t dec_capacity_until_GC(size_t v);
 406 
 407   static bool should_concurrent_collect() { return _should_concurrent_collect; }
 408   static void set_should_concurrent_collect(bool v) {
 409     _should_concurrent_collect = v;
 410   }
 411 
 412   // The amount to increase the high-water-mark (_capacity_until_GC)
 413   static size_t delta_capacity_until_GC(size_t bytes);
 414 
 415   // Tells if we have can expand metaspace without hitting set limits.
 416   static bool can_expand(size_t words, bool is_class);
 417 
 418   // Returns amount that we can expand without hitting a GC,
 419   // measured in words.
 420   static size_t allowed_expansion();
 421 
 422   // Calculate the new high-water mark at which to induce
 423   // a GC.
 424   static void compute_new_size();
 425 
 426   static MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
 427                                                       size_t word_size,
 428                                                       Metaspace::MetadataType mdtype);
 429 
 430 };
 431 
 432 #endif // SHARE_VM_MEMORY_METASPACE_HPP
< prev index next >