< prev index next >

src/share/vm/memory/metaspaceShared.hpp

Print this page




 115 };
 116 
 117 // Class Data Sharing Support
 118 class MetaspaceShared : AllStatic {
 119 
 120   // CDS support
 121   static ReservedSpace* _shared_rs;
 122   static int _max_alignment;
 123   static MetaspaceSharedStats _stats;
 124   static bool _link_classes_made_progress;
 125   static bool _check_classes_made_progress;
 126   static bool _has_error_classes;
 127   static bool _archive_loading_failed;
 128   static bool _remapped_readwrite;
 129   static address _cds_i2i_entry_code_buffers;
 130   static size_t  _cds_i2i_entry_code_buffers_size;
 131 
 132   // Used only during dumping.
 133   static SharedMiscRegion _md;
 134   static SharedMiscRegion _mc;

 135  public:
 136   enum {
 137     vtbl_list_size         = DEFAULT_VTBL_LIST_SIZE,
 138     num_virtuals           = DEFAULT_VTBL_VIRTUALS_COUNT,
 139     vtbl_method_size       = DEFAULT_VTBL_METHOD_SIZE,
 140     vtbl_common_code_size  = DEFAULT_VTBL_COMMON_CODE_SIZE
 141   };
 142 
 143   enum {
 144     ro = 0,  // read-only shared space in the heap
 145     rw = 1,  // read-write shared space in the heap
 146     md = 2,  // miscellaneous data for initializing tables, etc.
 147     mc = 3,  // miscellaneous code - vtable replacement.
 148     max_strings = 2, // max number of string regions in string space
 149     num_non_strings = 4, // number of non-string regions
 150     first_string = num_non_strings, // index of first string region
 151     n_regions = max_strings + num_non_strings // total number of regions



 152   };
 153 
 154   // Accessor functions to save shared space created for metadata, which has
 155   // extra space allocated at the end for miscellaneous data and code.
 156   static void set_max_alignment(int alignment) {
 157     CDS_ONLY(_max_alignment = alignment);
 158   }
 159 
 160   static int max_alignment() {
 161     CDS_ONLY(return _max_alignment);
 162     NOT_CDS(return 0);
 163   }
 164 
 165   static void prepare_for_dumping() NOT_CDS_RETURN;
 166   static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
 167   static int preload_and_dump(const char * class_list_path,
 168                               GrowableArray<Klass*>* class_promote_order,
 169                               TRAPS) NOT_CDS_RETURN_(0);
 170 
 171   static ReservedSpace* shared_rs() {


 205   // Remap the shared readonly space to shared readwrite, private if
 206   // sharing is enabled. Simply returns true if sharing is not enabled
 207   // or if the remapping has already been done by a prior call.
 208   static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true);
 209   static bool remapped_readwrite() {
 210     CDS_ONLY(return _remapped_readwrite);
 211     NOT_CDS(return false);
 212   }
 213 
 214   static void print_shared_spaces();
 215 
 216   static bool try_link_class(InstanceKlass* ik, TRAPS);
 217   static void link_one_shared_class(Klass* obj, TRAPS);
 218   static void check_one_shared_class(Klass* obj);
 219   static void check_shared_class_loader_type(Klass* obj);
 220   static void link_and_cleanup_shared_classes(TRAPS);
 221 
 222   static int count_class(const char* classlist_file);
 223   static void estimate_regions_size() NOT_CDS_RETURN;
 224 
 225   // Allocate a block of memory from the "mc" or "md" regions.
 226   static char* misc_code_space_alloc(size_t num_bytes) {  return _mc.alloc(num_bytes); }
 227   static char* misc_data_space_alloc(size_t num_bytes) {  return _md.alloc(num_bytes); }

 228 
 229   static address cds_i2i_entry_code_buffers(size_t total_size);
 230 
 231   static address cds_i2i_entry_code_buffers() {
 232     return _cds_i2i_entry_code_buffers;
 233   }
 234   static size_t cds_i2i_entry_code_buffers_size() {
 235     return _cds_i2i_entry_code_buffers_size;
 236   }
 237 
 238   static SharedMiscRegion* misc_code_region() {
 239     assert(DumpSharedSpaces, "used during dumping only");
 240     return &_mc;
 241   }
 242   static SharedMiscRegion* misc_data_region() {
 243     assert(DumpSharedSpaces, "used during dumping only");
 244     return &_md;




 245   }
 246 };
 247 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP


 115 };
 116 
 117 // Class Data Sharing Support
 118 class MetaspaceShared : AllStatic {
 119 
 120   // CDS support
 121   static ReservedSpace* _shared_rs;
 122   static int _max_alignment;
 123   static MetaspaceSharedStats _stats;
 124   static bool _link_classes_made_progress;
 125   static bool _check_classes_made_progress;
 126   static bool _has_error_classes;
 127   static bool _archive_loading_failed;
 128   static bool _remapped_readwrite;
 129   static address _cds_i2i_entry_code_buffers;
 130   static size_t  _cds_i2i_entry_code_buffers_size;
 131 
 132   // Used only during dumping.
 133   static SharedMiscRegion _md;
 134   static SharedMiscRegion _mc;
 135   static SharedMiscRegion _od;
 136  public:
 137   enum {
 138     vtbl_list_size         = DEFAULT_VTBL_LIST_SIZE,
 139     num_virtuals           = DEFAULT_VTBL_VIRTUALS_COUNT,
 140     vtbl_method_size       = DEFAULT_VTBL_METHOD_SIZE,
 141     vtbl_common_code_size  = DEFAULT_VTBL_COMMON_CODE_SIZE
 142   };
 143 
 144   enum {
 145     ro = 0,  // read-only shared space in the heap
 146     rw = 1,  // read-write shared space in the heap
 147     md = 2,  // miscellaneous data for initializing tables, etc.
 148     mc = 3,  // miscellaneous code - vtable replacement.
 149     max_strings = 2, // max number of string regions in string space
 150     num_non_strings = 4, // number of non-string regions
 151     first_string = num_non_strings, // index of first string region
 152     // The optional data region is the last region.
 153     // Currently it only contains class file data.
 154     od = max_strings + num_non_strings,
 155     n_regions = od + 1 // total number of regions
 156   };
 157 
 158   // Accessor functions to save shared space created for metadata, which has
 159   // extra space allocated at the end for miscellaneous data and code.
 160   static void set_max_alignment(int alignment) {
 161     CDS_ONLY(_max_alignment = alignment);
 162   }
 163 
 164   static int max_alignment() {
 165     CDS_ONLY(return _max_alignment);
 166     NOT_CDS(return 0);
 167   }
 168 
 169   static void prepare_for_dumping() NOT_CDS_RETURN;
 170   static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
 171   static int preload_and_dump(const char * class_list_path,
 172                               GrowableArray<Klass*>* class_promote_order,
 173                               TRAPS) NOT_CDS_RETURN_(0);
 174 
 175   static ReservedSpace* shared_rs() {


 209   // Remap the shared readonly space to shared readwrite, private if
 210   // sharing is enabled. Simply returns true if sharing is not enabled
 211   // or if the remapping has already been done by a prior call.
 212   static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true);
 213   static bool remapped_readwrite() {
 214     CDS_ONLY(return _remapped_readwrite);
 215     NOT_CDS(return false);
 216   }
 217 
 218   static void print_shared_spaces();
 219 
 220   static bool try_link_class(InstanceKlass* ik, TRAPS);
 221   static void link_one_shared_class(Klass* obj, TRAPS);
 222   static void check_one_shared_class(Klass* obj);
 223   static void check_shared_class_loader_type(Klass* obj);
 224   static void link_and_cleanup_shared_classes(TRAPS);
 225 
 226   static int count_class(const char* classlist_file);
 227   static void estimate_regions_size() NOT_CDS_RETURN;
 228 
 229   // Allocate a block of memory from the "mc", "md", or "od" regions.
 230   static char* misc_code_space_alloc(size_t num_bytes) {  return _mc.alloc(num_bytes); }
 231   static char* misc_data_space_alloc(size_t num_bytes) {  return _md.alloc(num_bytes); }
 232   static char* optional_data_space_alloc(size_t num_bytes) { return _od.alloc(num_bytes); }
 233 
 234   static address cds_i2i_entry_code_buffers(size_t total_size);
 235 
 236   static address cds_i2i_entry_code_buffers() {
 237     return _cds_i2i_entry_code_buffers;
 238   }
 239   static size_t cds_i2i_entry_code_buffers_size() {
 240     return _cds_i2i_entry_code_buffers_size;
 241   }
 242 
 243   static SharedMiscRegion* misc_code_region() {
 244     assert(DumpSharedSpaces, "used during dumping only");
 245     return &_mc;
 246   }
 247   static SharedMiscRegion* misc_data_region() {
 248     assert(DumpSharedSpaces, "used during dumping only");
 249     return &_md;
 250   }
 251   static SharedMiscRegion* optional_data_region() {
 252     assert(DumpSharedSpaces, "used during dumping only");
 253     return &_od;
 254   }
 255 };
 256 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP
< prev index next >