hotspot/src/share/vm/memory/metaspaceShared.hpp
changeset 35231 e89989198037
parent 34259 06047e5d60d2
child 36508 5f9eee6b383b
equal deleted inserted replaced
35230:a528ea8203ec 35231:e89989198037
    95   }
    95   }
    96   CompactHashtableStats symbol;
    96   CompactHashtableStats symbol;
    97   CompactHashtableStats string;
    97   CompactHashtableStats string;
    98 };
    98 };
    99 
    99 
       
   100 class SharedMiscRegion VALUE_OBJ_CLASS_SPEC {
       
   101 private:
       
   102   VirtualSpace _vs;
       
   103   char* _alloc_top;
       
   104   SharedSpaceType _space_type;
       
   105 
       
   106 public:
       
   107   void initialize(ReservedSpace rs, size_t committed_byte_size,  SharedSpaceType space_type);
       
   108   VirtualSpace* virtual_space() {
       
   109     return &_vs;
       
   110   }
       
   111   char* low() const {
       
   112     return _vs.low();
       
   113   }
       
   114   char* alloc_top() const {
       
   115     return _alloc_top;
       
   116   }
       
   117   char* alloc(size_t num_bytes) NOT_CDS_RETURN_(NULL);
       
   118 };
       
   119 
   100 // Class Data Sharing Support
   120 // Class Data Sharing Support
   101 class MetaspaceShared : AllStatic {
   121 class MetaspaceShared : AllStatic {
   102 
   122 
   103   // CDS support
   123   // CDS support
   104   static ReservedSpace* _shared_rs;
   124   static ReservedSpace* _shared_rs;
   106   static MetaspaceSharedStats _stats;
   126   static MetaspaceSharedStats _stats;
   107   static bool _link_classes_made_progress;
   127   static bool _link_classes_made_progress;
   108   static bool _check_classes_made_progress;
   128   static bool _check_classes_made_progress;
   109   static bool _has_error_classes;
   129   static bool _has_error_classes;
   110   static bool _archive_loading_failed;
   130   static bool _archive_loading_failed;
       
   131 
       
   132   // Used only during dumping.
       
   133   static SharedMiscRegion _md;
       
   134   static SharedMiscRegion _mc;
   111  public:
   135  public:
   112   enum {
   136   enum {
   113     vtbl_list_size         = DEFAULT_VTBL_LIST_SIZE,
   137     vtbl_list_size         = DEFAULT_VTBL_LIST_SIZE,
   114     num_virtuals           = DEFAULT_VTBL_VIRTUALS_COUNT,
   138     num_virtuals           = DEFAULT_VTBL_VIRTUALS_COUNT,
   115     vtbl_method_size       = DEFAULT_VTBL_METHOD_SIZE,
   139     vtbl_method_size       = DEFAULT_VTBL_METHOD_SIZE,
   147   static ReservedSpace* shared_rs() {
   171   static ReservedSpace* shared_rs() {
   148     CDS_ONLY(return _shared_rs);
   172     CDS_ONLY(return _shared_rs);
   149     NOT_CDS(return NULL);
   173     NOT_CDS(return NULL);
   150   }
   174   }
   151 
   175 
   152   static void set_shared_rs(ReservedSpace* rs) {
   176   static void initialize_shared_rs(ReservedSpace* rs) NOT_CDS_RETURN;
   153     CDS_ONLY(_shared_rs = rs;)
       
   154   }
       
   155 
   177 
   156   static void set_archive_loading_failed() {
   178   static void set_archive_loading_failed() {
   157     _archive_loading_failed = true;
   179     _archive_loading_failed = true;
   158   }
   180   }
   159   static bool map_shared_spaces(FileMapInfo* mapinfo) NOT_CDS_RETURN_(false);
   181   static bool map_shared_spaces(FileMapInfo* mapinfo) NOT_CDS_RETURN_(false);
   189   static void link_and_cleanup_shared_classes(TRAPS);
   211   static void link_and_cleanup_shared_classes(TRAPS);
   190 
   212 
   191   static int count_class(const char* classlist_file);
   213   static int count_class(const char* classlist_file);
   192   static void estimate_regions_size() NOT_CDS_RETURN;
   214   static void estimate_regions_size() NOT_CDS_RETURN;
   193 
   215 
   194   // Allocate a block of memory from the "md" region.
   216   // Allocate a block of memory from the "mc" or "md" regions.
   195   static char* misc_data_space_alloc(size_t num_bytes);
   217   static char* misc_code_space_alloc(size_t num_bytes) {  return _mc.alloc(num_bytes); }
       
   218   static char* misc_data_space_alloc(size_t num_bytes) {  return _md.alloc(num_bytes); }
       
   219 
       
   220   static SharedMiscRegion* misc_code_region() {
       
   221     assert(DumpSharedSpaces, "used during dumping only");
       
   222     return &_mc;
       
   223   }
       
   224   static SharedMiscRegion* misc_data_region() {
       
   225     assert(DumpSharedSpaces, "used during dumping only");
       
   226     return &_md;
       
   227   }
   196 };
   228 };
   197 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP
   229 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP