1 /* 2 * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_CDS_FILEMAP_HPP 26 #define SHARE_CDS_FILEMAP_HPP 27 28 #include "cds/metaspaceShared.hpp" 29 #include "include/cds.h" 30 #include "oops/array.hpp" 31 #include "oops/compressedOops.hpp" 32 #include "utilities/align.hpp" 33 34 // To understand the layout of the CDS archive file: 35 // 36 // java -Xlog:cds+map=info:file=cds.map:none:filesize=0 37 // java -Xlog:cds+map=debug:file=cds.map:none:filesize=0 38 // java -Xlog:cds+map=trace:file=cds.map:none:filesize=0 39 40 static const int JVM_IDENT_MAX = 256; 41 42 class CHeapBitMap; 43 class ClassFileStream; 44 class ClassLoaderData; 45 class ClassPathEntry; 46 class outputStream; 47 48 class SharedClassPathEntry { 49 enum { 50 modules_image_entry, 51 jar_entry, 52 dir_entry, 53 non_existent_entry, 54 unknown_entry 55 }; 56 57 void set_name(const char* name, TRAPS); 58 59 u1 _type; 60 bool _is_module_path; 61 bool _from_class_path_attr; 62 time_t _timestamp; // jar timestamp, 0 if is directory, modules image or other 63 int64_t _filesize; // jar/jimage file size, -1 if is directory, -2 if other 64 Array<char>* _name; 65 Array<u1>* _manifest; 66 67 public: 68 void init(bool is_modules_image, bool is_module_path, ClassPathEntry* cpe, TRAPS); 69 void init_as_non_existent(const char* path, TRAPS); 70 void metaspace_pointers_do(MetaspaceClosure* it); 71 bool validate(bool is_class_path = true) const; 72 73 // The _timestamp only gets set for jar files. 74 bool has_timestamp() const { 75 return _timestamp != 0; 76 } 77 bool is_dir() const { return _type == dir_entry; } 78 bool is_modules_image() const { return _type == modules_image_entry; } 79 bool is_jar() const { return _type == jar_entry; } 80 bool from_class_path_attr() { return _from_class_path_attr; } 81 time_t timestamp() const { return _timestamp; } 82 const char* name() const; 83 const char* manifest() const { 84 return (_manifest == NULL) ? NULL : (const char*)_manifest->data(); 85 } 86 int manifest_size() const { 87 return (_manifest == NULL) ? 0 : _manifest->length(); 88 } 89 void set_manifest(Array<u1>* manifest) { 90 _manifest = manifest; 91 } 92 bool check_non_existent() const; 93 void copy_from(SharedClassPathEntry* ent, ClassLoaderData* loader_data, TRAPS); 94 bool in_named_module() { 95 return is_modules_image() || // modules image doesn't contain unnamed modules 96 _is_module_path; // module path doesn't contain unnamed modules 97 } 98 }; 99 100 struct ArchiveHeapOopmapInfo { 101 address _oopmap; // bitmap for relocating embedded oops 102 size_t _offset; // this oopmap is stored at this offset from the bottom of the BM region 103 size_t _oopmap_size_in_bits; 104 size_t _oopmap_size_in_bytes; 105 }; 106 107 class SharedPathTable { 108 Array<u8>* _table; 109 int _size; 110 public: 111 SharedPathTable() : _table(NULL), _size(0) {} 112 SharedPathTable(Array<u8>* table, int size) : _table(table), _size(size) {} 113 114 void dumptime_init(ClassLoaderData* loader_data, TRAPS); 115 void metaspace_pointers_do(MetaspaceClosure* it); 116 117 int size() { 118 return _size; 119 } 120 SharedClassPathEntry* path_at(int index) { 121 if (index < 0) { 122 return NULL; 123 } 124 assert(index < _size, "sanity"); 125 char* p = (char*)_table->data(); 126 p += sizeof(SharedClassPathEntry) * index; 127 return (SharedClassPathEntry*)p; 128 } 129 Array<u8>* table() {return _table;} 130 void set_table(Array<u8>* table) {_table = table;} 131 }; 132 133 134 class FileMapRegion: private CDSFileMapRegion { 135 void assert_is_heap_region() const { 136 assert(_is_heap_region, "must be heap region"); 137 } 138 void assert_is_not_heap_region() const { 139 assert(!_is_heap_region, "must not be heap region"); 140 } 141 142 public: 143 static FileMapRegion* cast(CDSFileMapRegion* p) { 144 return (FileMapRegion*)p; 145 } 146 147 // Accessors 148 int crc() const { return _crc; } 149 size_t file_offset() const { return _file_offset; } 150 size_t mapping_offset() const { return _mapping_offset; } 151 size_t mapping_end_offset() const { return _mapping_offset + used_aligned(); } 152 size_t used() const { return _used; } 153 size_t used_aligned() const; // aligned up to MetaspaceShared::core_region_alignment() 154 char* mapped_base() const { assert_is_not_heap_region(); return _mapped_base; } 155 char* mapped_end() const { return mapped_base() + used_aligned(); } 156 bool read_only() const { return _read_only != 0; } 157 bool allow_exec() const { return _allow_exec != 0; } 158 bool mapped_from_file() const { return _mapped_from_file != 0; } 159 size_t oopmap_offset() const { assert_is_heap_region(); return _oopmap_offset; } 160 size_t oopmap_size_in_bits() const { assert_is_heap_region(); return _oopmap_size_in_bits; } 161 162 void set_file_offset(size_t s) { _file_offset = s; } 163 void set_read_only(bool v) { _read_only = v; } 164 void set_mapped_base(char* p) { _mapped_base = p; } 165 void set_mapped_from_file(bool v) { _mapped_from_file = v; } 166 void init(int region_index, size_t mapping_offset, size_t size, bool read_only, 167 bool allow_exec, int crc); 168 169 void init_oopmap(size_t oopmap_offset, size_t size_in_bits) { 170 _oopmap_offset = oopmap_offset; 171 _oopmap_size_in_bits = size_in_bits; 172 } 173 174 void print(outputStream* st, int region_index); 175 }; 176 177 class FileMapHeader: private CDSFileMapHeaderBase { 178 friend class CDSOffsets; 179 friend class VMStructs; 180 181 size_t _header_size; 182 183 // The following fields record the states of the VM during dump time. 184 // They are compared with the runtime states to see if the archive 185 // can be used. 186 size_t _core_region_alignment; // how shared archive should be aligned 187 int _obj_alignment; // value of ObjectAlignmentInBytes 188 address _narrow_oop_base; // compressed oop encoding base 189 int _narrow_oop_shift; // compressed oop encoding shift 190 bool _compact_strings; // value of CompactStrings 191 bool _compact_headers; // value of UseCompactObjectHeaders 192 uintx _max_heap_size; // java max heap size during dumping 193 CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode 194 int _narrow_klass_shift; // save narrow klass base and shift 195 bool _compressed_oops; // save the flag UseCompressedOops 196 bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers 197 size_t _cloned_vtables_offset; // The address of the first cloned vtable 198 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize() 199 address _heap_begin; // heap begin at dump time. 200 address _heap_end; // heap end at dump time. 201 bool _base_archive_is_default; // indicates if the base archive is the system default one 202 203 // The following fields are all sanity checks for whether this archive 204 // will function correctly with this JVM and the bootclasspath it's 205 // invoked with. 206 char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump 207 208 // size of the base archive name including NULL terminator 209 size_t _base_archive_name_size; 210 211 // The following is a table of all the boot/app/module path entries that were used 212 // during dumping. At run time, we validate these entries according to their 213 // SharedClassPathEntry::_type. See: 214 // check_nonempty_dir_in_shared_path_table() 215 // validate_shared_path_table() 216 // validate_non_existent_class_paths() 217 size_t _shared_path_table_offset; 218 int _shared_path_table_size; 219 220 jshort _app_class_paths_start_index; // Index of first app classpath entry 221 jshort _app_module_paths_start_index; // Index of first module path entry 222 jshort _num_module_paths; // number of module path entries 223 jshort _max_used_path_index; // max path index referenced during CDS dump 224 bool _verify_local; // BytecodeVerificationLocal setting 225 bool _verify_remote; // BytecodeVerificationRemote setting 226 bool _has_platform_or_app_classes; // Archive contains app classes 227 char* _requested_base_address; // Archive relocation is not necessary if we map with this base address. 228 char* _mapped_base_address; // Actual base address where archive is mapped. 229 230 bool _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option 231 bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip 232 // some expensive operations. 233 bool _use_full_module_graph; // Can we use the full archived module graph? 234 size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap 235 narrowOop _heap_obj_roots; // An objArray that stores all the roots of archived heap objects 236 char* from_mapped_offset(size_t offset) const { 237 return mapped_base_address() + offset; 238 } 239 void set_as_offset(char* p, size_t *offset); 240 public: 241 // Accessors -- fields declared in CDSFileMapHeaderBase 242 unsigned int magic() const { return _magic; } 243 int crc() const { return _crc; } 244 int version() const { return _version; } 245 246 void set_crc(int crc_value) { _crc = crc_value; } 247 void set_version(int v) { _version = v; } 248 249 // Accessors -- fields declared in FileMapHeader 250 251 size_t header_size() const { return _header_size; } 252 size_t core_region_alignment() const { return _core_region_alignment; } 253 int obj_alignment() const { return _obj_alignment; } 254 address narrow_oop_base() const { return _narrow_oop_base; } 255 int narrow_oop_shift() const { return _narrow_oop_shift; } 256 bool compact_strings() const { return _compact_strings; } 257 bool compact_headers() const { return _compact_headers; } 258 uintx max_heap_size() const { return _max_heap_size; } 259 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; } 260 int narrow_klass_shift() const { return _narrow_klass_shift; } 261 address narrow_klass_base() const { return (address)mapped_base_address(); } 262 char* cloned_vtables() const { return from_mapped_offset(_cloned_vtables_offset); } 263 char* serialized_data() const { return from_mapped_offset(_serialized_data_offset); } 264 address heap_begin() const { return _heap_begin; } 265 address heap_end() const { return _heap_end; } 266 bool base_archive_is_default() const { return _base_archive_is_default; } 267 const char* jvm_ident() const { return _jvm_ident; } 268 size_t base_archive_name_size() const { return _base_archive_name_size; } 269 char* requested_base_address() const { return _requested_base_address; } 270 char* mapped_base_address() const { return _mapped_base_address; } 271 bool has_platform_or_app_classes() const { return _has_platform_or_app_classes; } 272 size_t ptrmap_size_in_bits() const { return _ptrmap_size_in_bits; } 273 bool compressed_oops() const { return _compressed_oops; } 274 bool compressed_class_pointers() const { return _compressed_class_ptrs; } 275 // FIXME: These should really return int 276 jshort max_used_path_index() const { return _max_used_path_index; } 277 jshort app_module_paths_start_index() const { return _app_module_paths_start_index; } 278 jshort app_class_paths_start_index() const { return _app_class_paths_start_index; } 279 jshort num_module_paths() const { return _num_module_paths; } 280 narrowOop heap_obj_roots() const { return _heap_obj_roots; } 281 282 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; } 283 void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); } 284 void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); } 285 void set_base_archive_name_size(size_t s) { _base_archive_name_size = s; } 286 void set_base_archive_is_default(bool b) { _base_archive_is_default = b; } 287 void set_header_size(size_t s) { _header_size = s; } 288 void set_ptrmap_size_in_bits(size_t s) { _ptrmap_size_in_bits = s; } 289 void set_mapped_base_address(char* p) { _mapped_base_address = p; } 290 void set_heap_obj_roots(narrowOop r) { _heap_obj_roots = r; } 291 292 void set_shared_path_table(SharedPathTable table) { 293 set_as_offset((char*)table.table(), &_shared_path_table_offset); 294 _shared_path_table_size = table.size(); 295 } 296 297 void set_requested_base(char* b) { 298 _requested_base_address = b; 299 _mapped_base_address = 0; 300 } 301 302 SharedPathTable shared_path_table() const { 303 return SharedPathTable((Array<u8>*)from_mapped_offset(_shared_path_table_offset), 304 _shared_path_table_size); 305 } 306 307 bool validate(); 308 int compute_crc(); 309 310 FileMapRegion* space_at(int i) { 311 assert(is_valid_region(i), "invalid region"); 312 return FileMapRegion::cast(&_space[i]); 313 } 314 315 void populate(FileMapInfo* info, size_t core_region_alignment); 316 317 static bool is_valid_region(int region) { 318 return (0 <= region && region < NUM_CDS_REGIONS); 319 } 320 321 void print(outputStream* st); 322 }; 323 324 class FileMapInfo : public CHeapObj<mtInternal> { 325 private: 326 friend class ManifestStream; 327 friend class VMStructs; 328 friend class ArchiveBuilder; 329 friend class CDSOffsets; 330 friend class FileMapHeader; 331 332 bool _is_static; 333 bool _file_open; 334 bool _is_mapped; 335 int _fd; 336 size_t _file_offset; 337 const char* _full_path; 338 const char* _base_archive_name; 339 FileMapHeader* _header; 340 341 // TODO: Probably change the following to be non-static 342 static SharedPathTable _shared_path_table; 343 static SharedPathTable _saved_shared_path_table; 344 static bool _validating_shared_path_table; 345 346 // FileMapHeader describes the shared space data in the file to be 347 // mapped. This structure gets written to a file. It is not a class, so 348 // that the compilers don't add any compiler-private data to it. 349 350 static FileMapInfo* _current_info; 351 static FileMapInfo* _dynamic_archive_info; 352 static bool _heap_pointers_need_patching; 353 static bool _memory_mapping_failed; 354 static GrowableArray<const char*>* _non_existent_class_paths; 355 356 FileMapHeader *header() const { return _header; } 357 358 public: 359 static bool get_base_archive_name_from_header(const char* archive_name, 360 int* size, char** base_archive_name); 361 static bool check_archive(const char* archive_name, bool is_static); 362 static SharedPathTable shared_path_table() { 363 return _shared_path_table; 364 } 365 static SharedPathTable saved_shared_path_table() { 366 return _saved_shared_path_table; 367 } 368 369 bool init_from_file(int fd); 370 static void metaspace_pointers_do(MetaspaceClosure* it, bool use_copy = true); 371 372 void log_paths(const char* msg, int start_idx, int end_idx); 373 374 FileMapInfo(bool is_static); 375 ~FileMapInfo(); 376 377 // Accessors 378 int compute_header_crc() const { return header()->compute_crc(); } 379 void set_header_crc(int crc) { header()->set_crc(crc); } 380 int space_crc(int i) const { return space_at(i)->crc(); } 381 void populate_header(size_t core_region_alignment); 382 bool validate_header(); 383 void invalidate(); 384 int crc() const { return header()->crc(); } 385 int version() const { return header()->version(); } 386 unsigned int magic() const { return header()->magic(); } 387 address narrow_oop_base() const { return header()->narrow_oop_base(); } 388 int narrow_oop_shift() const { return header()->narrow_oop_shift(); } 389 uintx max_heap_size() const { return header()->max_heap_size(); } 390 address narrow_klass_base() const { return header()->narrow_klass_base(); } 391 int narrow_klass_shift() const { return header()->narrow_klass_shift(); } 392 size_t core_region_alignment() const { return header()->core_region_alignment(); } 393 394 void set_header_base_archive_name_size(size_t size) { header()->set_base_archive_name_size(size); } 395 void set_header_base_archive_is_default(bool is_default) { header()->set_base_archive_is_default(is_default); } 396 397 CompressedOops::Mode narrow_oop_mode() const { return header()->narrow_oop_mode(); } 398 jshort app_module_paths_start_index() const { return header()->app_module_paths_start_index(); } 399 jshort app_class_paths_start_index() const { return header()->app_class_paths_start_index(); } 400 401 char* cloned_vtables() const { return header()->cloned_vtables(); } 402 void set_cloned_vtables(char* p) const { header()->set_cloned_vtables(p); } 403 char* serialized_data() const { return header()->serialized_data(); } 404 void set_serialized_data(char* p) const { header()->set_serialized_data(p); } 405 406 bool is_file_position_aligned() const; 407 void align_file_position(); 408 409 bool is_static() const { return _is_static; } 410 bool is_mapped() const { return _is_mapped; } 411 void set_is_mapped(bool v) { _is_mapped = v; } 412 const char* full_path() const { return _full_path; } 413 414 void set_requested_base(char* b) { header()->set_requested_base(b); } 415 char* requested_base_address() const { return header()->requested_base_address(); } 416 417 class DynamicArchiveHeader* dynamic_header() const { 418 assert(!is_static(), "must be"); 419 return (DynamicArchiveHeader*)header(); 420 } 421 422 void set_has_platform_or_app_classes(bool v) { 423 header()->set_has_platform_or_app_classes(v); 424 } 425 bool has_platform_or_app_classes() const { 426 return header()->has_platform_or_app_classes(); 427 } 428 429 static FileMapInfo* current_info() { 430 CDS_ONLY(return _current_info;) 431 NOT_CDS(return NULL;) 432 } 433 434 static void set_current_info(FileMapInfo* info) { 435 CDS_ONLY(_current_info = info;) 436 } 437 438 static FileMapInfo* dynamic_info() { 439 CDS_ONLY(return _dynamic_archive_info;) 440 NOT_CDS(return NULL;) 441 } 442 443 static void assert_mark(bool check); 444 445 // File manipulation. 446 bool initialize() NOT_CDS_RETURN_(false); 447 bool open_for_read(); 448 void open_for_write(const char* path = NULL); 449 void write_header(); 450 void write_region(int region, char* base, size_t size, 451 bool read_only, bool allow_exec); 452 char* write_bitmap_region(const CHeapBitMap* ptrmap, 453 GrowableArray<ArchiveHeapOopmapInfo>* closed_oopmaps, 454 GrowableArray<ArchiveHeapOopmapInfo>* open_oopmaps, 455 size_t &size_in_bytes); 456 size_t write_archive_heap_regions(GrowableArray<MemRegion> *heap_mem, 457 GrowableArray<ArchiveHeapOopmapInfo> *oopmaps, 458 int first_region_id, int max_num_regions); 459 void write_bytes(const void* buffer, size_t count); 460 void write_bytes_aligned(const void* buffer, size_t count); 461 size_t read_bytes(void* buffer, size_t count); 462 MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs); 463 void unmap_regions(int regions[], int num_regions); 464 void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; 465 void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; 466 void patch_archived_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN; 467 void patch_archived_heap_embedded_pointers(MemRegion* ranges, int num_ranges, 468 int first_region_idx) NOT_CDS_JAVA_HEAP_RETURN; 469 bool has_heap_regions() NOT_CDS_JAVA_HEAP_RETURN_(false); 470 MemRegion get_heap_regions_range_with_current_oop_encoding_mode() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion()); 471 void unmap_region(int i); 472 bool verify_region_checksum(int i); 473 void close(); 474 bool is_open() { return _file_open; } 475 ReservedSpace reserve_shared_memory(); 476 477 // JVM/TI RedefineClasses() support: 478 // Remap the shared readonly space to shared readwrite, private. 479 bool remap_shared_readonly_as_readwrite(); 480 481 // Errors. 482 static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); 483 static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); 484 static bool memory_mapping_failed() { 485 CDS_ONLY(return _memory_mapping_failed;) 486 NOT_CDS(return false;) 487 } 488 bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); 489 490 // Stop CDS sharing and unmap CDS regions. 491 static void stop_sharing_and_unmap(const char* msg); 492 493 static void allocate_shared_path_table(TRAPS); 494 static void copy_shared_path_table(ClassLoaderData* loader_data, TRAPS); 495 static int add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS); 496 static void check_nonempty_dir_in_shared_path_table(); 497 bool validate_shared_path_table(); 498 void validate_non_existent_class_paths(); 499 static void set_shared_path_table(FileMapInfo* info) { 500 _shared_path_table = info->header()->shared_path_table(); 501 } 502 static void update_jar_manifest(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS); 503 static int num_non_existent_class_paths(); 504 static void record_non_existent_class_path_entry(const char* path); 505 506 #if INCLUDE_JVMTI 507 static ClassFileStream* open_stream_for_jvmti(InstanceKlass* ik, Handle class_loader, TRAPS); 508 #endif 509 510 static SharedClassPathEntry* shared_path(int index) { 511 return _shared_path_table.path_at(index); 512 } 513 514 static const char* shared_path_name(int index) { 515 assert(index >= 0, "Sanity"); 516 return shared_path(index)->name(); 517 } 518 519 static int get_number_of_shared_paths() { 520 return _shared_path_table.size(); 521 } 522 523 static int get_module_shared_path_index(Symbol* location) NOT_CDS_RETURN_(-1); 524 525 char* region_addr(int idx); 526 527 // The offset of the first core region in the archive, relative to SharedBaseAddress 528 size_t mapping_base_offset() const { return first_core_space()->mapping_offset(); } 529 // The offset of the (exclusive) end of the last core region in this archive, relative to SharedBaseAddress 530 size_t mapping_end_offset() const { return last_core_space()->mapping_end_offset(); } 531 532 char* mapped_base() const { return first_core_space()->mapped_base(); } 533 char* mapped_end() const { return last_core_space()->mapped_end(); } 534 535 // Non-zero if the archive needs to be mapped a non-default location due to ASLR. 536 intx relocation_delta() const { 537 return header()->mapped_base_address() - header()->requested_base_address(); 538 } 539 540 FileMapRegion* first_core_space() const; 541 FileMapRegion* last_core_space() const; 542 543 FileMapRegion* space_at(int i) const { 544 return header()->space_at(i); 545 } 546 547 void print(outputStream* st) { 548 header()->print(st); 549 } 550 551 const char* vm_version() { 552 return header()->jvm_ident(); 553 } 554 555 private: 556 void seek_to_position(size_t pos); 557 char* skip_first_path_entry(const char* path) NOT_CDS_RETURN_(NULL); 558 int num_paths(const char* path) NOT_CDS_RETURN_(0); 559 GrowableArray<const char*>* create_path_array(const char* path) NOT_CDS_RETURN_(NULL); 560 bool classpath_failure(const char* msg, const char* name) NOT_CDS_RETURN_(false); 561 bool check_paths(int shared_path_start_idx, int num_paths, 562 GrowableArray<const char*>* rp_array) NOT_CDS_RETURN_(false); 563 bool validate_boot_class_paths() NOT_CDS_RETURN_(false); 564 bool validate_app_class_paths(int shared_app_paths_len) NOT_CDS_RETURN_(false); 565 bool map_heap_data(MemRegion **heap_mem, int first, int max, int* num, 566 bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false); 567 bool region_crc_check(char* buf, size_t size, int expected_crc) NOT_CDS_RETURN_(false); 568 void dealloc_archive_heap_regions(MemRegion* regions, int num) NOT_CDS_JAVA_HEAP_RETURN; 569 void map_heap_regions_impl() NOT_CDS_JAVA_HEAP_RETURN; 570 char* map_bitmap_region(); 571 MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs); 572 bool read_region(int i, char* base, size_t size); 573 bool relocate_pointers_in_core_regions(intx addr_delta); 574 static size_t set_oopmaps_offset(GrowableArray<ArchiveHeapOopmapInfo> *oopmaps, size_t curr_size); 575 static size_t write_oopmaps(GrowableArray<ArchiveHeapOopmapInfo> *oopmaps, size_t curr_offset, char* buffer); 576 577 // The starting address of spc, as calculated with CompressedOop::decode_non_null() 578 address start_address_as_decoded_with_current_oop_encoding_mode(FileMapRegion* spc) { 579 return decode_start_address(spc, true); 580 } 581 582 // The starting address of spc, as calculated with HeapShared::decode_from_archive() 583 address start_address_as_decoded_from_archive(FileMapRegion* spc) { 584 return decode_start_address(spc, false); 585 } 586 587 address decode_start_address(FileMapRegion* spc, bool with_current_oop_encoding_mode); 588 589 #if INCLUDE_JVMTI 590 static ClassPathEntry** _classpath_entries_for_jvmti; 591 static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS); 592 #endif 593 }; 594 595 #endif // SHARE_CDS_FILEMAP_HPP