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