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 120 // Class Data Sharing Support 121 class MetaspaceShared : AllStatic { 122 123 // CDS support 124 static ReservedSpace* _shared_rs; 125 static int _max_alignment; 126 static MetaspaceSharedStats _stats; 127 static bool _link_classes_made_progress; 128 static bool _check_classes_made_progress; 129 static bool _has_error_classes; 130 static bool _archive_loading_failed; 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 200 // JVM/TI RedefineClasses() support: 201 // Remap the shared readonly space to shared readwrite, private if 202 // sharing is enabled. Simply returns true if sharing is not enabled 203 // or if the remapping has already been done by a prior call. 204 static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true); 205 206 static void print_shared_spaces(); 207 208 static bool try_link_class(InstanceKlass* ik, TRAPS); 209 static void link_one_shared_class(Klass* obj, TRAPS); 210 static void check_one_shared_class(Klass* obj); 211 static void link_and_cleanup_shared_classes(TRAPS); 212 213 static int count_class(const char* classlist_file); 214 static void estimate_regions_size() NOT_CDS_RETURN; 215 216 // Allocate a block of memory from the "mc" or "md" regions. 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 } 228 }; 229 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP | 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 120 // Class Data Sharing Support 121 class MetaspaceShared : AllStatic { 122 123 // CDS support 124 static ReservedSpace* _shared_rs; 125 static int _max_alignment; 126 static MetaspaceSharedStats _stats; 127 static bool _link_classes_made_progress; 128 static bool _check_classes_made_progress; 129 static bool _has_error_classes; 130 static bool _archive_loading_failed; 131 static address _cds_i2i_entry_code_buffers; 132 static size_t _cds_i2i_entry_code_buffers_size; 133 134 // Used only during dumping. 135 static SharedMiscRegion _md; 136 static SharedMiscRegion _mc; 137 public: 138 enum { 139 vtbl_list_size = DEFAULT_VTBL_LIST_SIZE, 140 num_virtuals = DEFAULT_VTBL_VIRTUALS_COUNT, 141 vtbl_method_size = DEFAULT_VTBL_METHOD_SIZE, 142 vtbl_common_code_size = DEFAULT_VTBL_COMMON_CODE_SIZE 143 }; 144 145 enum { 146 ro = 0, // read-only shared space in the heap 147 rw = 1, // read-write shared space in the heap 148 md = 2, // miscellaneous data for initializing tables, etc. 149 mc = 3, // miscellaneous code - vtable replacement. 150 max_strings = 2, // max number of string regions in string space 151 num_non_strings = 4, // number of non-string regions 152 first_string = num_non_strings, // index of first string region 202 // JVM/TI RedefineClasses() support: 203 // Remap the shared readonly space to shared readwrite, private if 204 // sharing is enabled. Simply returns true if sharing is not enabled 205 // or if the remapping has already been done by a prior call. 206 static bool remap_shared_readonly_as_readwrite() NOT_CDS_RETURN_(true); 207 208 static void print_shared_spaces(); 209 210 static bool try_link_class(InstanceKlass* ik, TRAPS); 211 static void link_one_shared_class(Klass* obj, TRAPS); 212 static void check_one_shared_class(Klass* obj); 213 static void link_and_cleanup_shared_classes(TRAPS); 214 215 static int count_class(const char* classlist_file); 216 static void estimate_regions_size() NOT_CDS_RETURN; 217 218 // Allocate a block of memory from the "mc" or "md" regions. 219 static char* misc_code_space_alloc(size_t num_bytes) { return _mc.alloc(num_bytes); } 220 static char* misc_data_space_alloc(size_t num_bytes) { return _md.alloc(num_bytes); } 221 222 static address cds_i2i_entry_code_buffers(size_t total_size); 223 224 static address cds_i2i_entry_code_buffers() { 225 return _cds_i2i_entry_code_buffers; 226 } 227 static size_t cds_i2i_entry_code_buffers_size() { 228 return _cds_i2i_entry_code_buffers_size; 229 } 230 231 static SharedMiscRegion* misc_code_region() { 232 assert(DumpSharedSpaces, "used during dumping only"); 233 return &_mc; 234 } 235 static SharedMiscRegion* misc_data_region() { 236 assert(DumpSharedSpaces, "used during dumping only"); 237 return &_md; 238 } 239 }; 240 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP |