225 void set_cds_i2i_entry_code_buffers_size(size_t s) { 226 _header->_cds_i2i_entry_code_buffers_size = s; 227 } 228 void set_core_spaces_size(size_t s) { _header->_core_spaces_size = s; } 229 size_t core_spaces_size() { return _header->_core_spaces_size; } 230 231 static FileMapInfo* current_info() { 232 CDS_ONLY(return _current_info;) 233 NOT_CDS(return NULL;) 234 } 235 236 static void assert_mark(bool check); 237 238 // File manipulation. 239 bool initialize() NOT_CDS_RETURN_(false); 240 bool open_for_read(); 241 void open_for_write(); 242 void write_header(); 243 void write_region(int region, char* base, size_t size, 244 bool read_only, bool allow_exec); 245 void write_string_regions(GrowableArray<MemRegion> *regions, 246 char** s0_start, char** s0_top, char** s0_end, 247 char** s1_start, char** s1_top, char** s1_end); 248 void write_bytes(const void* buffer, int count); 249 void write_bytes_aligned(const void* buffer, int count); 250 char* map_region(int i); 251 bool map_string_regions(); 252 bool verify_string_regions(); 253 void fixup_string_regions(); 254 void unmap_region(int i); 255 void dealloc_string_regions(); 256 bool verify_region_checksum(int i); 257 void close(); 258 bool is_open() { return _file_open; } 259 ReservedSpace reserve_shared_memory(); 260 261 // JVM/TI RedefineClasses() support: 262 // Remap the shared readonly space to shared readwrite, private. 263 bool remap_shared_readonly_as_readwrite(); 264 265 // Errors. 266 static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); 267 static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); 268 269 // Return true if given address is in the mapped shared space. 270 bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); 271 bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); 272 void print_shared_spaces() NOT_CDS_RETURN; 273 274 // Stop CDS sharing and unmap CDS regions. 275 static void stop_sharing_and_unmap(const char* msg); 277 static void allocate_classpath_entry_table(); 278 bool validate_classpath_entry_table(); 279 280 static SharedClassPathEntry* shared_classpath(int index) { 281 if (index < 0) { 282 return NULL; 283 } 284 assert(index < _classpath_entry_table_size, "sanity"); 285 char* p = (char*)_classpath_entry_table->data(); 286 p += _classpath_entry_size * index; 287 return (SharedClassPathEntry*)p; 288 } 289 static const char* shared_classpath_name(int index) { 290 assert(index >= 0, "Sanity"); 291 return shared_classpath(index)->name(); 292 } 293 294 static int get_number_of_share_classpaths() { 295 return _classpath_entry_table_size; 296 } 297 }; 298 299 #endif // SHARE_VM_MEMORY_FILEMAP_HPP | 225 void set_cds_i2i_entry_code_buffers_size(size_t s) { 226 _header->_cds_i2i_entry_code_buffers_size = s; 227 } 228 void set_core_spaces_size(size_t s) { _header->_core_spaces_size = s; } 229 size_t core_spaces_size() { return _header->_core_spaces_size; } 230 231 static FileMapInfo* current_info() { 232 CDS_ONLY(return _current_info;) 233 NOT_CDS(return NULL;) 234 } 235 236 static void assert_mark(bool check); 237 238 // File manipulation. 239 bool initialize() NOT_CDS_RETURN_(false); 240 bool open_for_read(); 241 void open_for_write(); 242 void write_header(); 243 void write_region(int region, char* base, size_t size, 244 bool read_only, bool allow_exec); 245 void write_archive_heap_regions(GrowableArray<MemRegion> *regions, 246 int first_region, int max_num_regions, 247 char** r0_start, char** r0_top, 248 char** r1_start, char** r1_top); 249 void write_bytes(const void* buffer, int count); 250 void write_bytes_aligned(const void* buffer, int count); 251 char* map_region(int i); 252 void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; 253 void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; 254 void unmap_region(int i); 255 bool verify_region_checksum(int i); 256 void close(); 257 bool is_open() { return _file_open; } 258 ReservedSpace reserve_shared_memory(); 259 260 // JVM/TI RedefineClasses() support: 261 // Remap the shared readonly space to shared readwrite, private. 262 bool remap_shared_readonly_as_readwrite(); 263 264 // Errors. 265 static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); 266 static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); 267 268 // Return true if given address is in the mapped shared space. 269 bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); 270 bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); 271 void print_shared_spaces() NOT_CDS_RETURN; 272 273 // Stop CDS sharing and unmap CDS regions. 274 static void stop_sharing_and_unmap(const char* msg); 276 static void allocate_classpath_entry_table(); 277 bool validate_classpath_entry_table(); 278 279 static SharedClassPathEntry* shared_classpath(int index) { 280 if (index < 0) { 281 return NULL; 282 } 283 assert(index < _classpath_entry_table_size, "sanity"); 284 char* p = (char*)_classpath_entry_table->data(); 285 p += _classpath_entry_size * index; 286 return (SharedClassPathEntry*)p; 287 } 288 static const char* shared_classpath_name(int index) { 289 assert(index >= 0, "Sanity"); 290 return shared_classpath(index)->name(); 291 } 292 293 static int get_number_of_share_classpaths() { 294 return _classpath_entry_table_size; 295 } 296 297 private: 298 bool map_heap_data(MemRegion **regions, int first, int max, int* num, 299 bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false); 300 bool verify_mapped_heap_regions(int first, int num) NOT_CDS_JAVA_HEAP_RETURN_(false); 301 void dealloc_archive_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN; 302 }; 303 304 #endif // SHARE_VM_MEMORY_FILEMAP_HPP |