123 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
124
125 // The following fields are all sanity checks for whether this archive
126 // will function correctly with this JVM and the bootclasspath it's
127 // invoked with.
128 char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump
129
130 size_t _class_location_config_offset;
131
132 bool _verify_local; // BytecodeVerificationLocal setting
133 bool _verify_remote; // BytecodeVerificationRemote setting
134 bool _has_platform_or_app_classes; // Archive contains app or platform classes
135 char* _requested_base_address; // Archive relocation is not necessary if we map with this base address.
136 char* _mapped_base_address; // Actual base address where archive is mapped.
137
138 bool _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
139 bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
140 // some expensive operations.
141 bool _has_aot_linked_classes; // Was the CDS archive created with -XX:+AOTClassLinking
142 bool _has_full_module_graph; // Does this CDS archive contain the full archived module graph?
143 HeapRootSegments _heap_root_segments; // Heap root segments info
144 size_t _heap_oopmap_start_pos; // The first bit in the oopmap corresponds to this position in the heap.
145 size_t _heap_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the heap.
146 size_t _rw_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the rw region
147 size_t _ro_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the ro region
148
149 // The following are parameters that affect MethodData layout.
150 uint _type_profile_level;
151 int _type_profile_args_limit;
152 int _type_profile_parms_limit;
153 intx _type_profile_width;
154 intx _bci_profile_width;
155 bool _profile_traps;
156 bool _type_profile_casts;
157 int _spec_trap_limit_extra_entries;
158
159 template <typename T> T from_mapped_offset(size_t offset) const {
160 return (T)(mapped_base_address() + offset);
161 }
162 void set_as_offset(char* p, size_t *offset);
163 template <typename T> void set_as_offset(T p, size_t *offset) {
164 set_as_offset((char*)p, offset);
165 }
166
167 public:
168 // Accessors -- fields declared in GenericCDSFileMapHeader
169 unsigned int magic() const { return _generic_header._magic; }
180 void set_base_archive_name_offset(unsigned int s) { _generic_header._base_archive_name_offset = s; }
181 void set_base_archive_name_size(unsigned int s) { _generic_header._base_archive_name_size = s; }
182
183 bool is_static() const { return magic() == CDS_ARCHIVE_MAGIC; }
184 size_t core_region_alignment() const { return _core_region_alignment; }
185 int obj_alignment() const { return _obj_alignment; }
186 address narrow_oop_base() const { return _narrow_oop_base; }
187 int narrow_oop_shift() const { return _narrow_oop_shift; }
188 bool compact_strings() const { return _compact_strings; }
189 bool compact_headers() const { return _compact_headers; }
190 uintx max_heap_size() const { return _max_heap_size; }
191 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
192 char* cloned_vtables() const { return from_mapped_offset<char*>(_cloned_vtables_offset); }
193 char* early_serialized_data() const { return from_mapped_offset<char*>(_early_serialized_data_offset); }
194 char* serialized_data() const { return from_mapped_offset<char*>(_serialized_data_offset); }
195 const char* jvm_ident() const { return _jvm_ident; }
196 char* requested_base_address() const { return _requested_base_address; }
197 char* mapped_base_address() const { return _mapped_base_address; }
198 bool has_platform_or_app_classes() const { return _has_platform_or_app_classes; }
199 bool has_aot_linked_classes() const { return _has_aot_linked_classes; }
200 bool compressed_oops() const { return _compressed_oops; }
201 bool compressed_class_pointers() const { return _compressed_class_ptrs; }
202 int narrow_klass_pointer_bits() const { return _narrow_klass_pointer_bits; }
203 int narrow_klass_shift() const { return _narrow_klass_shift; }
204 HeapRootSegments heap_root_segments() const { return _heap_root_segments; }
205 bool has_full_module_graph() const { return _has_full_module_graph; }
206 size_t heap_oopmap_start_pos() const { return _heap_oopmap_start_pos; }
207 size_t heap_ptrmap_start_pos() const { return _heap_ptrmap_start_pos; }
208 size_t rw_ptrmap_start_pos() const { return _rw_ptrmap_start_pos; }
209 size_t ro_ptrmap_start_pos() const { return _ro_ptrmap_start_pos; }
210
211 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
212 void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); }
213 void set_early_serialized_data(char* p) { set_as_offset(p, &_early_serialized_data_offset); }
214 void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); }
215 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
216 void set_heap_root_segments(HeapRootSegments segments) { _heap_root_segments = segments; }
217 void set_heap_oopmap_start_pos(size_t n) { _heap_oopmap_start_pos = n; }
218 void set_heap_ptrmap_start_pos(size_t n) { _heap_ptrmap_start_pos = n; }
219 void set_rw_ptrmap_start_pos(size_t n) { _rw_ptrmap_start_pos = n; }
346 }
347
348 static void set_current_info(FileMapInfo* info) {
349 CDS_ONLY(_current_info = info;)
350 }
351
352 static FileMapInfo* dynamic_info() {
353 CDS_ONLY(return _dynamic_archive_info;)
354 NOT_CDS(return nullptr;)
355 }
356
357 static void assert_mark(bool check);
358
359 // File manipulation.
360 bool open_as_input() NOT_CDS_RETURN_(false);
361 void open_as_output();
362 void write_header();
363 void write_region(int region, char* base, size_t size,
364 bool read_only, bool allow_exec);
365 size_t remove_bitmap_zeros(CHeapBitMap* map);
366 char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info,
367 size_t &size_in_bytes);
368 size_t write_heap_region(ArchiveHeapInfo* heap_info);
369 void write_bytes(const void* buffer, size_t count);
370 void write_bytes_aligned(const void* buffer, size_t count);
371 size_t read_bytes(void* buffer, size_t count);
372 static size_t readonly_total();
373 MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
374 void unmap_regions(int regions[], int num_regions);
375 void map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
376 void fixup_mapped_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
377 void patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
378 bool has_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
379 MemRegion get_heap_region_requested_range() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
380 bool read_region(int i, char* base, size_t size, bool do_commit);
381 char* map_bitmap_region();
382 bool map_aot_code_region(ReservedSpace rs);
383 void unmap_region(int i);
384 void close();
385 bool is_open() { return _file_open; }
386
429 BitMapView oopmap_view(int region_index);
430 BitMapView ptrmap_view(int region_index);
431
432 void print(outputStream* st) const;
433
434 const char* vm_version() {
435 return header()->jvm_ident();
436 }
437
438 private:
439 bool open_for_read();
440 void seek_to_position(size_t pos);
441 bool map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
442 void dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
443 bool can_use_heap_region();
444 bool load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
445 bool map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
446 void init_heap_region_relocation();
447 MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
448 bool relocate_pointers_in_core_regions(intx addr_delta);
449
450 static MemRegion _mapped_heap_memregion;
451
452 public:
453 address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
454 address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
455 narrowOop encoded_heap_region_dumptime_address();
456
457 private:
458
459 #if INCLUDE_JVMTI
460 static ClassPathEntry** _classpath_entries_for_jvmti;
461 static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
462 #endif
463 };
464
465 #endif // SHARE_CDS_FILEMAP_HPP
|
123 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
124
125 // The following fields are all sanity checks for whether this archive
126 // will function correctly with this JVM and the bootclasspath it's
127 // invoked with.
128 char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump
129
130 size_t _class_location_config_offset;
131
132 bool _verify_local; // BytecodeVerificationLocal setting
133 bool _verify_remote; // BytecodeVerificationRemote setting
134 bool _has_platform_or_app_classes; // Archive contains app or platform classes
135 char* _requested_base_address; // Archive relocation is not necessary if we map with this base address.
136 char* _mapped_base_address; // Actual base address where archive is mapped.
137
138 bool _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
139 bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
140 // some expensive operations.
141 bool _has_aot_linked_classes; // Was the CDS archive created with -XX:+AOTClassLinking
142 bool _has_full_module_graph; // Does this CDS archive contain the full archived module graph?
143 bool _has_archived_packages;
144 bool _has_archived_protection_domains;
145 int _gc_kind; // Universe::heap()->kind();
146 char _gc_name[32]; // Universe::heap()->name();
147 size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap
148 HeapRootSegments _heap_root_segments; // Heap root segments info
149 size_t _heap_oopmap_start_pos; // The first bit in the oopmap corresponds to this position in the heap.
150 size_t _heap_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the heap.
151 size_t _rw_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the rw region
152 size_t _ro_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the ro region
153
154 // The following are parameters that affect MethodData layout.
155 u1 _compiler_type;
156 uint _type_profile_level;
157 int _type_profile_args_limit;
158 int _type_profile_parms_limit;
159 intx _type_profile_width;
160 intx _bci_profile_width;
161 bool _profile_traps;
162 bool _type_profile_casts;
163 int _spec_trap_limit_extra_entries;
164
165 template <typename T> T from_mapped_offset(size_t offset) const {
166 return (T)(mapped_base_address() + offset);
167 }
168 void set_as_offset(char* p, size_t *offset);
169 template <typename T> void set_as_offset(T p, size_t *offset) {
170 set_as_offset((char*)p, offset);
171 }
172
173 public:
174 // Accessors -- fields declared in GenericCDSFileMapHeader
175 unsigned int magic() const { return _generic_header._magic; }
186 void set_base_archive_name_offset(unsigned int s) { _generic_header._base_archive_name_offset = s; }
187 void set_base_archive_name_size(unsigned int s) { _generic_header._base_archive_name_size = s; }
188
189 bool is_static() const { return magic() == CDS_ARCHIVE_MAGIC; }
190 size_t core_region_alignment() const { return _core_region_alignment; }
191 int obj_alignment() const { return _obj_alignment; }
192 address narrow_oop_base() const { return _narrow_oop_base; }
193 int narrow_oop_shift() const { return _narrow_oop_shift; }
194 bool compact_strings() const { return _compact_strings; }
195 bool compact_headers() const { return _compact_headers; }
196 uintx max_heap_size() const { return _max_heap_size; }
197 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
198 char* cloned_vtables() const { return from_mapped_offset<char*>(_cloned_vtables_offset); }
199 char* early_serialized_data() const { return from_mapped_offset<char*>(_early_serialized_data_offset); }
200 char* serialized_data() const { return from_mapped_offset<char*>(_serialized_data_offset); }
201 const char* jvm_ident() const { return _jvm_ident; }
202 char* requested_base_address() const { return _requested_base_address; }
203 char* mapped_base_address() const { return _mapped_base_address; }
204 bool has_platform_or_app_classes() const { return _has_platform_or_app_classes; }
205 bool has_aot_linked_classes() const { return _has_aot_linked_classes; }
206 int gc_kind() const { return _gc_kind; }
207 const char* gc_name() const { return _gc_name; }
208 size_t ptrmap_size_in_bits() const { return _ptrmap_size_in_bits; }
209 bool compressed_oops() const { return _compressed_oops; }
210 bool compressed_class_pointers() const { return _compressed_class_ptrs; }
211 int narrow_klass_pointer_bits() const { return _narrow_klass_pointer_bits; }
212 int narrow_klass_shift() const { return _narrow_klass_shift; }
213 HeapRootSegments heap_root_segments() const { return _heap_root_segments; }
214 bool has_full_module_graph() const { return _has_full_module_graph; }
215 size_t heap_oopmap_start_pos() const { return _heap_oopmap_start_pos; }
216 size_t heap_ptrmap_start_pos() const { return _heap_ptrmap_start_pos; }
217 size_t rw_ptrmap_start_pos() const { return _rw_ptrmap_start_pos; }
218 size_t ro_ptrmap_start_pos() const { return _ro_ptrmap_start_pos; }
219
220 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
221 void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); }
222 void set_early_serialized_data(char* p) { set_as_offset(p, &_early_serialized_data_offset); }
223 void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); }
224 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
225 void set_heap_root_segments(HeapRootSegments segments) { _heap_root_segments = segments; }
226 void set_heap_oopmap_start_pos(size_t n) { _heap_oopmap_start_pos = n; }
227 void set_heap_ptrmap_start_pos(size_t n) { _heap_ptrmap_start_pos = n; }
228 void set_rw_ptrmap_start_pos(size_t n) { _rw_ptrmap_start_pos = n; }
355 }
356
357 static void set_current_info(FileMapInfo* info) {
358 CDS_ONLY(_current_info = info;)
359 }
360
361 static FileMapInfo* dynamic_info() {
362 CDS_ONLY(return _dynamic_archive_info;)
363 NOT_CDS(return nullptr;)
364 }
365
366 static void assert_mark(bool check);
367
368 // File manipulation.
369 bool open_as_input() NOT_CDS_RETURN_(false);
370 void open_as_output();
371 void write_header();
372 void write_region(int region, char* base, size_t size,
373 bool read_only, bool allow_exec);
374 size_t remove_bitmap_zeros(CHeapBitMap* map);
375 char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap,
376 CHeapBitMap* cc_ptrmap, ArchiveHeapInfo* heap_info,
377 size_t &size_in_bytes);
378 size_t write_heap_region(ArchiveHeapInfo* heap_info);
379 void write_bytes(const void* buffer, size_t count);
380 void write_bytes_aligned(const void* buffer, size_t count);
381 size_t read_bytes(void* buffer, size_t count);
382 static size_t readonly_total();
383 MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
384 void unmap_regions(int regions[], int num_regions);
385 void map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
386 void fixup_mapped_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
387 void patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
388 bool has_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
389 MemRegion get_heap_region_requested_range() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
390 bool read_region(int i, char* base, size_t size, bool do_commit);
391 char* map_bitmap_region();
392 bool map_aot_code_region(ReservedSpace rs);
393 void unmap_region(int i);
394 void close();
395 bool is_open() { return _file_open; }
396
439 BitMapView oopmap_view(int region_index);
440 BitMapView ptrmap_view(int region_index);
441
442 void print(outputStream* st) const;
443
444 const char* vm_version() {
445 return header()->jvm_ident();
446 }
447
448 private:
449 bool open_for_read();
450 void seek_to_position(size_t pos);
451 bool map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
452 void dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
453 bool can_use_heap_region();
454 bool load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
455 bool map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
456 void init_heap_region_relocation();
457 MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
458 bool relocate_pointers_in_core_regions(intx addr_delta);
459 void relocate_pointers_in_aot_code_region();
460 static MemRegion _mapped_heap_memregion;
461
462 public:
463 address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
464 address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
465 narrowOop encoded_heap_region_dumptime_address();
466
467 private:
468
469 #if INCLUDE_JVMTI
470 static ClassPathEntry** _classpath_entries_for_jvmti;
471 static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
472 #endif
473 };
474
475 #endif // SHARE_CDS_FILEMAP_HPP
|