1 /*
2 * Copyright (c) 2003, 2023, 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 "logging/logLevel.hpp"
31 #include "memory/allocation.hpp"
32 #include "oops/array.hpp"
33 #include "oops/compressedOops.hpp"
34 #include "utilities/align.hpp"
35
36 // To understand the layout of the CDS archive file:
37 //
38 // java -Xlog:cds+map=info:file=cds.map:none:filesize=0
39 // java -Xlog:cds+map=debug:file=cds.map:none:filesize=0
40 // java -Xlog:cds+map=trace:file=cds.map:none:filesize=0
41
42 static const int JVM_IDENT_MAX = 256;
43
44 class ArchiveHeapInfo;
45 class BitMapView;
46 class CHeapBitMap;
47 class ClassFileStream;
48 class ClassLoaderData;
49 class ClassPathEntry;
50 class outputStream;
51
52 class SharedClassPathEntry : public MetaspaceObj {
53 enum {
54 modules_image_entry,
55 jar_entry,
56 dir_entry,
57 non_existent_entry,
58 unknown_entry
59 };
60
61 void set_name(const char* name, TRAPS);
62
63 u1 _type;
64 bool _is_module_path;
65 bool _from_class_path_attr;
66 time_t _timestamp; // jar timestamp, 0 if is directory, modules image or other
67 int64_t _filesize; // jar/jimage file size, -1 if is directory, -2 if other
68 Array<char>* _name;
69 Array<u1>* _manifest;
70
71 public:
72 SharedClassPathEntry() : _type(0), _is_module_path(false),
73 _from_class_path_attr(false), _timestamp(0),
74 _filesize(0), _name(nullptr), _manifest(nullptr) {}
75 static int size() {
76 static_assert(is_aligned(sizeof(SharedClassPathEntry), wordSize), "must be");
77 return (int)(sizeof(SharedClassPathEntry) / wordSize);
78 }
79 void init(bool is_modules_image, bool is_module_path, ClassPathEntry* cpe, TRAPS);
80 void init_as_non_existent(const char* path, TRAPS);
81 void metaspace_pointers_do(MetaspaceClosure* it);
82 MetaspaceObj::Type type() const { return SharedClassPathEntryType; }
83 bool validate(bool is_class_path = true) const;
84
85 // The _timestamp only gets set for jar files.
86 bool has_timestamp() const {
87 return _timestamp != 0;
88 }
89 bool is_dir() const { return _type == dir_entry; }
90 bool is_modules_image() const { return _type == modules_image_entry; }
91 bool is_jar() const { return _type == jar_entry; }
92 bool from_class_path_attr() { return _from_class_path_attr; }
93 time_t timestamp() const { return _timestamp; }
94 const char* name() const;
95 const char* manifest() const {
96 return (_manifest == nullptr) ? nullptr : (const char*)_manifest->data();
97 }
98 int manifest_size() const {
99 return (_manifest == nullptr) ? 0 : _manifest->length();
100 }
101 void set_manifest(Array<u1>* manifest) {
102 _manifest = manifest;
103 }
104 bool check_non_existent() const;
105 void copy_from(SharedClassPathEntry* ent, ClassLoaderData* loader_data, TRAPS);
106 bool in_named_module() {
107 return is_modules_image() || // modules image doesn't contain unnamed modules
108 _is_module_path; // module path doesn't contain unnamed modules
109 }
110 };
111
112 class SharedPathTable {
113 Array<SharedClassPathEntry*>* _entries;
114 public:
115 SharedPathTable() : _entries(nullptr) {}
116 SharedPathTable(Array<SharedClassPathEntry*>* entries) : _entries(entries) {}
117
118 void dumptime_init(ClassLoaderData* loader_data, TRAPS);
119 void metaspace_pointers_do(MetaspaceClosure* it);
120
121 int size() {
122 return _entries == nullptr ? 0 : _entries->length();
123 }
124 SharedClassPathEntry* path_at(int index) {
125 return _entries->at(index);
126 }
127 Array<SharedClassPathEntry*>* table() {return _entries;}
128 void set_table(Array<SharedClassPathEntry*>* table) {_entries = table;}
129 };
130
131
132 class FileMapRegion: private CDSFileMapRegion {
133 BitMapView bitmap_view(bool is_oopmap);
134 public:
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 static FileMapRegion* cast(CDSFileMapRegion* p) {
143 return (FileMapRegion*)p;
144 }
145
146 // Accessors
147 int crc() const { return _crc; }
148 size_t file_offset() const { return _file_offset; }
149 size_t mapping_offset() const { return _mapping_offset; }
150 size_t mapping_end_offset() const { return _mapping_offset + used_aligned(); }
151 size_t used() const { return _used; }
152 size_t used_aligned() const; // aligned up to MetaspaceShared::core_region_alignment()
153 char* mapped_base() const { return _mapped_base; }
154 char* mapped_end() const { return mapped_base() + used_aligned(); }
155 bool read_only() const { return _read_only != 0; }
156 bool allow_exec() const { return _allow_exec != 0; }
157 bool mapped_from_file() const { return _mapped_from_file != 0; }
158 size_t oopmap_offset() const { assert_is_heap_region(); return _oopmap_offset; }
159 size_t oopmap_size_in_bits() const { assert_is_heap_region(); return _oopmap_size_in_bits; }
160
161 void set_file_offset(size_t s) { _file_offset = s; }
162 void set_read_only(bool v) { _read_only = v; }
163 void set_mapped_base(char* p) { _mapped_base = p; }
164 void set_mapped_from_file(bool v) { _mapped_from_file = v; }
165 void init(int region_index, size_t mapping_offset, size_t size, bool read_only,
166 bool allow_exec, int crc);
167 void init_oopmap(size_t offset, size_t size_in_bits);
168 void init_ptrmap(size_t offset, size_t size_in_bits);
169 BitMapView oopmap_view();
170 BitMapView ptrmap_view();
171 bool has_ptrmap() { return _ptrmap_size_in_bits != 0; }
172
173 bool check_region_crc() const;
174 void print(outputStream* st, int region_index);
175 };
176
177 class FileMapHeader: private CDSFileMapHeaderBase {
178 friend class CDSConstants;
179 friend class VMStructs;
180
181 private:
182 // The following fields record the states of the VM during dump time.
183 // They are compared with the runtime states to see if the archive
184 // can be used.
185 size_t _core_region_alignment; // how shared archive should be aligned
186 int _obj_alignment; // value of ObjectAlignmentInBytes
187 address _narrow_oop_base; // compressed oop encoding base
188 int _narrow_oop_shift; // compressed oop encoding shift
189 bool _compact_strings; // value of CompactStrings
190 bool _compact_headers; // value of UseCompactObjectHeaders
191 uintx _max_heap_size; // java max heap size during dumping
192 CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode
193 int _narrow_klass_shift; // save narrow klass base and shift
194 bool _compressed_oops; // save the flag UseCompressedOops
195 bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers
196 size_t _cloned_vtables_offset; // The address of the first cloned vtable
197 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
198 address _heap_begin; // heap begin at dump time.
199 address _heap_end; // heap end at dump time.
200 bool _has_non_jar_in_classpath; // non-jar file entry exists in classpath
201 unsigned int _common_app_classpath_prefix_size; // size of the common prefix of app class paths
202 // 0 if no common prefix exists
203
204 // The following fields are all sanity checks for whether this archive
205 // will function correctly with this JVM and the bootclasspath it's
206 // invoked with.
207 char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump
208
209 // The following is a table of all the boot/app/module path entries that were used
210 // during dumping. At run time, we validate these entries according to their
211 // SharedClassPathEntry::_type. See:
212 // check_nonempty_dir_in_shared_path_table()
213 // validate_shared_path_table()
214 // validate_non_existent_class_paths()
215 size_t _shared_path_table_offset;
216
217 jshort _app_class_paths_start_index; // Index of first app classpath entry
218 jshort _app_module_paths_start_index; // Index of first module path entry
219 jshort _num_module_paths; // number of module path entries
220 jshort _max_used_path_index; // max path index referenced during CDS dump
221 bool _verify_local; // BytecodeVerificationLocal setting
222 bool _verify_remote; // BytecodeVerificationRemote setting
223 bool _has_platform_or_app_classes; // Archive contains app classes
224 char* _requested_base_address; // Archive relocation is not necessary if we map with this base address.
225 char* _mapped_base_address; // Actual base address where archive is mapped.
226
227 bool _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
228 bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
229 // some expensive operations.
230 bool _use_full_module_graph; // Can we use the full archived module graph?
231 size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap
232 char* from_mapped_offset(size_t offset) const {
233 return mapped_base_address() + offset;
234 }
235 void set_as_offset(char* p, size_t *offset);
236 public:
237 // Accessors -- fields declared in GenericCDSFileMapHeader
238 unsigned int magic() const { return _generic_header._magic; }
239 int crc() const { return _generic_header._crc; }
240 int version() const { return _generic_header._version; }
241 unsigned int header_size() const { return _generic_header._header_size; }
242 unsigned int base_archive_name_offset() const { return _generic_header._base_archive_name_offset; }
243 unsigned int base_archive_name_size() const { return _generic_header._base_archive_name_size; }
244 unsigned int common_app_classpath_prefix_size() const { return _common_app_classpath_prefix_size; }
245
246 void set_magic(unsigned int m) { _generic_header._magic = m; }
247 void set_crc(int crc_value) { _generic_header._crc = crc_value; }
248 void set_version(int v) { _generic_header._version = v; }
249 void set_header_size(unsigned int s) { _generic_header._header_size = s; }
250 void set_base_archive_name_offset(unsigned int s) { _generic_header._base_archive_name_offset = s; }
251 void set_base_archive_name_size(unsigned int s) { _generic_header._base_archive_name_size = s; }
252 void set_common_app_classpath_prefix_size(unsigned int s) { _common_app_classpath_prefix_size = s; }
253
254 size_t core_region_alignment() const { return _core_region_alignment; }
255 int obj_alignment() const { return _obj_alignment; }
256 address narrow_oop_base() const { return _narrow_oop_base; }
257 int narrow_oop_shift() const { return _narrow_oop_shift; }
258 bool compact_strings() const { return _compact_strings; }
259 bool compact_headers() const { return _compact_headers; }
260 uintx max_heap_size() const { return _max_heap_size; }
261 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
262 int narrow_klass_shift() const { return _narrow_klass_shift; }
263 address narrow_klass_base() const { return (address)mapped_base_address(); }
264 char* cloned_vtables() const { return from_mapped_offset(_cloned_vtables_offset); }
265 char* serialized_data() const { return from_mapped_offset(_serialized_data_offset); }
266 address heap_begin() const { return _heap_begin; }
267 address heap_end() const { return _heap_end; }
268 const char* jvm_ident() const { return _jvm_ident; }
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 bool has_non_jar_in_classpath() const { return _has_non_jar_in_classpath; }
273 size_t ptrmap_size_in_bits() const { return _ptrmap_size_in_bits; }
274 bool compressed_oops() const { return _compressed_oops; }
275 bool compressed_class_pointers() const { return _compressed_class_ptrs; }
276 // FIXME: These should really return int
277 jshort max_used_path_index() const { return _max_used_path_index; }
278 jshort app_module_paths_start_index() const { return _app_module_paths_start_index; }
279 jshort app_class_paths_start_index() const { return _app_class_paths_start_index; }
280 jshort num_module_paths() const { return _num_module_paths; }
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_ptrmap_size_in_bits(size_t s) { _ptrmap_size_in_bits = s; }
286 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
287 void copy_base_archive_name(const char* name);
288
289 void set_shared_path_table(SharedPathTable table) {
290 set_as_offset((char*)table.table(), &_shared_path_table_offset);
291 }
292
293 void set_requested_base(char* b) {
294 _requested_base_address = b;
295 _mapped_base_address = 0;
296 }
297
298 SharedPathTable shared_path_table() const {
299 return SharedPathTable((Array<SharedClassPathEntry*>*)
300 from_mapped_offset(_shared_path_table_offset));
301 }
302
303 bool validate();
304 int compute_crc();
305
306 FileMapRegion* region_at(int i) {
307 assert(is_valid_region(i), "invalid region");
308 return FileMapRegion::cast(&_regions[i]);
309 }
310
311 void populate(FileMapInfo *info, size_t core_region_alignment, size_t header_size,
312 size_t base_archive_name_size, size_t base_archive_name_offset,
313 size_t common_app_classpath_size);
314 static bool is_valid_region(int region) {
315 return (0 <= region && region < NUM_CDS_REGIONS);
316 }
317
318 void print(outputStream* st);
319 };
320
321 class FileMapInfo : public CHeapObj<mtInternal> {
322 private:
323 friend class ManifestStream;
324 friend class VMStructs;
325 friend class ArchiveBuilder;
326 friend class CDSOffsets;
327 friend class FileMapHeader;
328
329 bool _is_static;
330 bool _file_open;
331 bool _is_mapped;
332 int _fd;
333 size_t _file_offset;
334 const char* _full_path;
335 const char* _base_archive_name;
336 FileMapHeader* _header;
337
338 static SharedPathTable _shared_path_table;
339 static bool _validating_shared_path_table;
340
341 // FileMapHeader describes the shared space data in the file to be
342 // mapped. This structure gets written to a file. It is not a class, so
343 // that the compilers don't add any compiler-private data to it.
344
345 static FileMapInfo* _current_info;
346 static FileMapInfo* _dynamic_archive_info;
347 static bool _heap_pointers_need_patching;
348 static bool _memory_mapping_failed;
349 static GrowableArray<const char*>* _non_existent_class_paths;
350
351 public:
352 FileMapHeader *header() const { return _header; }
353 static bool get_base_archive_name_from_header(const char* archive_name,
354 char** base_archive_name);
355 static SharedPathTable shared_path_table() {
356 return _shared_path_table;
357 }
358
359 bool init_from_file(int fd);
360 static void metaspace_pointers_do(MetaspaceClosure* it) {
361 _shared_path_table.metaspace_pointers_do(it);
362 }
363
364 void log_paths(const char* msg, int start_idx, int end_idx);
365
366 FileMapInfo(const char* full_apth, bool is_static);
367 ~FileMapInfo();
368
369 // Accessors
370 int compute_header_crc() const { return header()->compute_crc(); }
371 void set_header_crc(int crc) { header()->set_crc(crc); }
372 int region_crc(int i) const { return region_at(i)->crc(); }
373 void populate_header(size_t core_region_alignment);
374 bool validate_header();
375 void invalidate();
376 int crc() const { return header()->crc(); }
377 int version() const { return header()->version(); }
378 unsigned int magic() const { return header()->magic(); }
379 address narrow_oop_base() const { return header()->narrow_oop_base(); }
380 int narrow_oop_shift() const { return header()->narrow_oop_shift(); }
381 uintx max_heap_size() const { return header()->max_heap_size(); }
382 address narrow_klass_base() const { return header()->narrow_klass_base(); }
383 int narrow_klass_shift() const { return header()->narrow_klass_shift(); }
384 size_t core_region_alignment() const { return header()->core_region_alignment(); }
385
386 CompressedOops::Mode narrow_oop_mode() const { return header()->narrow_oop_mode(); }
387 jshort app_module_paths_start_index() const { return header()->app_module_paths_start_index(); }
388 jshort app_class_paths_start_index() const { return header()->app_class_paths_start_index(); }
389
390 char* cloned_vtables() const { return header()->cloned_vtables(); }
391 void set_cloned_vtables(char* p) const { header()->set_cloned_vtables(p); }
392 char* serialized_data() const { return header()->serialized_data(); }
393 void set_serialized_data(char* p) const { header()->set_serialized_data(p); }
394
395 bool is_file_position_aligned() const;
396 void align_file_position();
397
398 bool is_static() const { return _is_static; }
399 bool is_mapped() const { return _is_mapped; }
400 void set_is_mapped(bool v) { _is_mapped = v; }
401 const char* full_path() const { return _full_path; }
402
403 void set_requested_base(char* b) { header()->set_requested_base(b); }
404 char* requested_base_address() const { return header()->requested_base_address(); }
405
406 class DynamicArchiveHeader* dynamic_header() const {
407 assert(!is_static(), "must be");
408 return (DynamicArchiveHeader*)header();
409 }
410
411 void set_has_platform_or_app_classes(bool v) {
412 header()->set_has_platform_or_app_classes(v);
413 }
414 bool has_platform_or_app_classes() const {
415 return header()->has_platform_or_app_classes();
416 }
417
418 static FileMapInfo* current_info() {
419 CDS_ONLY(return _current_info;)
420 NOT_CDS(return nullptr;)
421 }
422
423 static void set_current_info(FileMapInfo* info) {
424 CDS_ONLY(_current_info = info;)
425 }
426
427 static FileMapInfo* dynamic_info() {
428 CDS_ONLY(return _dynamic_archive_info;)
429 NOT_CDS(return nullptr;)
430 }
431
432 static void assert_mark(bool check);
433
434 // File manipulation.
435 bool initialize() NOT_CDS_RETURN_(false);
436 bool open_for_read();
437 void open_for_write();
438 void write_header();
439 void write_region(int region, char* base, size_t size,
440 bool read_only, bool allow_exec);
441 char* write_bitmap_region(const CHeapBitMap* ptrmap, ArchiveHeapInfo* heap_info,
442 size_t &size_in_bytes);
443 size_t write_heap_region(ArchiveHeapInfo* heap_info);
444 void write_bytes(const void* buffer, size_t count);
445 void write_bytes_aligned(const void* buffer, size_t count);
446 size_t read_bytes(void* buffer, size_t count);
447 static size_t readonly_total();
448 MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
449 void unmap_regions(int regions[], int num_regions);
450 void map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
451 void fixup_mapped_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
452 void patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
453 bool has_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
454 MemRegion get_heap_region_requested_range() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
455 bool read_region(int i, char* base, size_t size, bool do_commit);
456 char* map_bitmap_region();
457 void unmap_region(int i);
458 void close();
459 bool is_open() { return _file_open; }
460 ReservedSpace reserve_shared_memory();
461
462 // JVM/TI RedefineClasses() support:
463 // Remap the shared readonly space to shared readwrite, private.
464 bool remap_shared_readonly_as_readwrite();
465
466 static bool memory_mapping_failed() {
467 CDS_ONLY(return _memory_mapping_failed;)
468 NOT_CDS(return false;)
469 }
470
471 static void allocate_shared_path_table(TRAPS);
472 static int add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS);
473 static void check_nonempty_dir_in_shared_path_table();
474 bool check_module_paths();
475 bool validate_shared_path_table();
476 void validate_non_existent_class_paths();
477 static void set_shared_path_table(FileMapInfo* info) {
478 _shared_path_table = info->header()->shared_path_table();
479 }
480 static void update_jar_manifest(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS);
481 static int num_non_existent_class_paths();
482 static void record_non_existent_class_path_entry(const char* path);
483
484 #if INCLUDE_JVMTI
485 // Caller needs a ResourceMark because parts of the returned cfs are resource-allocated.
486 static ClassFileStream* open_stream_for_jvmti(InstanceKlass* ik, Handle class_loader, TRAPS);
487 #endif
488
489 static SharedClassPathEntry* shared_path(int index) {
490 return _shared_path_table.path_at(index);
491 }
492
493 static const char* shared_path_name(int index) {
494 assert(index >= 0, "Sanity");
495 return shared_path(index)->name();
496 }
497
498 static int get_number_of_shared_paths() {
499 return _shared_path_table.size();
500 }
501
502 static int get_module_shared_path_index(Symbol* location) NOT_CDS_RETURN_(-1);
503
504 // The offset of the first core region in the archive, relative to SharedBaseAddress
505 size_t mapping_base_offset() const { return first_core_region()->mapping_offset(); }
506 // The offset of the (exclusive) end of the last core region in this archive, relative to SharedBaseAddress
507 size_t mapping_end_offset() const { return last_core_region()->mapping_end_offset(); }
508
509 char* mapped_base() const { return first_core_region()->mapped_base(); }
510 char* mapped_end() const { return last_core_region()->mapped_end(); }
511
512 // Non-zero if the archive needs to be mapped a non-default location due to ASLR.
513 intx relocation_delta() const {
514 return header()->mapped_base_address() - header()->requested_base_address();
515 }
516
517 FileMapRegion* first_core_region() const;
518 FileMapRegion* last_core_region() const;
519
520 FileMapRegion* region_at(int i) const {
521 return header()->region_at(i);
522 }
523
524 void print(outputStream* st) const;
525
526 const char* vm_version() {
527 return header()->jvm_ident();
528 }
529
530 private:
531 void seek_to_position(size_t pos);
532 char* skip_first_path_entry(const char* path) NOT_CDS_RETURN_(nullptr);
533 int num_paths(const char* path) NOT_CDS_RETURN_(0);
534 bool check_paths_existence(const char* paths) NOT_CDS_RETURN_(false);
535 GrowableArray<const char*>* create_dumptime_app_classpath_array() NOT_CDS_RETURN_(nullptr);
536 GrowableArray<const char*>* create_path_array(const char* path) NOT_CDS_RETURN_(nullptr);
537 bool classpath_failure(const char* msg, const char* name) NOT_CDS_RETURN_(false);
538 unsigned int longest_common_app_classpath_prefix_len(int num_paths,
539 GrowableArray<const char*>* rp_array)
540 NOT_CDS_RETURN_(0);
541 bool check_paths(int shared_path_start_idx, int num_paths,
542 GrowableArray<const char*>* rp_array,
543 unsigned int dumptime_prefix_len,
544 unsigned int runtime_prefix_len) NOT_CDS_RETURN_(false);
545 bool validate_boot_class_paths() NOT_CDS_RETURN_(false);
546 bool validate_app_class_paths(int shared_app_paths_len) NOT_CDS_RETURN_(false);
547 bool map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
548 void dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
549 bool can_use_heap_region();
550 bool load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
551 bool map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
552 void init_heap_region_relocation();
553 MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
554 bool relocate_pointers_in_core_regions(intx addr_delta);
555
556 static MemRegion _mapped_heap_memregion;
557
558 public:
559 address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
560 address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
561 address heap_region_mapped_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
562 narrowOop encoded_heap_region_dumptime_address();
563
564 private:
565
566 #if INCLUDE_JVMTI
567 static ClassPathEntry** _classpath_entries_for_jvmti;
568 static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
569 #endif
570 };
571
572 #endif // SHARE_CDS_FILEMAP_HPP