124 size_t _early_serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
125 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
126
127 // The following fields are all sanity checks for whether this archive
128 // will function correctly with this JVM and the bootclasspath it's
129 // invoked with.
130 char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump
131
132 size_t _class_location_config_offset;
133
134 bool _verify_local; // BytecodeVerificationLocal setting
135 bool _verify_remote; // BytecodeVerificationRemote setting
136 bool _has_platform_or_app_classes; // Archive contains app or platform classes
137 char* _requested_base_address; // Archive relocation is not necessary if we map with this base address.
138 char* _mapped_base_address; // Actual base address where archive is mapped.
139
140 bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
141 // some expensive operations.
142 bool _has_aot_linked_classes; // Was the CDS archive created with -XX:+AOTClassLinking
143 bool _has_full_module_graph; // Does this CDS archive contain the full archived module graph?
144 size_t _rw_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the rw region
145 size_t _ro_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the ro region
146
147 ArchiveMappedHeapHeader _mapped_heap_header;
148 ArchiveStreamedHeapHeader _streamed_heap_header;
149
150 // The following are parameters that affect MethodData layout.
151 u1 _compiler_type;
152 uint _type_profile_level;
153 int _type_profile_args_limit;
154 int _type_profile_parms_limit;
155 intx _type_profile_width;
156 intx _bci_profile_width;
157 bool _profile_traps;
158 bool _type_profile_casts;
159 int _spec_trap_limit_extra_entries;
160
161 template <typename T> T from_mapped_offset(size_t offset) const {
162 return (T)(mapped_base_address() + offset);
163 }
183 void set_base_archive_name_size(unsigned int s) { _generic_header._base_archive_name_size = s; }
184
185 bool is_static() const { return magic() == CDS_ARCHIVE_MAGIC; }
186 size_t core_region_alignment() const { return _core_region_alignment; }
187 int obj_alignment() const { return _obj_alignment; }
188 address narrow_oop_base() const { return _narrow_oop_base; }
189 int narrow_oop_shift() const { return _narrow_oop_shift; }
190 bool compact_strings() const { return _compact_strings; }
191 bool compact_headers() const { return _compact_headers; }
192 uintx max_heap_size() const { return _max_heap_size; }
193 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
194 char* cloned_vtables() const { return from_mapped_offset<char*>(_cloned_vtables_offset); }
195 char* early_serialized_data() const { return from_mapped_offset<char*>(_early_serialized_data_offset); }
196 char* serialized_data() const { return from_mapped_offset<char*>(_serialized_data_offset); }
197 bool object_streaming_mode() const { return _object_streaming_mode; }
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 bool compressed_oops() const { return _compressed_oops; }
204 bool compressed_class_pointers() const { return _compressed_class_ptrs; }
205 int narrow_klass_pointer_bits() const { return _narrow_klass_pointer_bits; }
206 int narrow_klass_shift() const { return _narrow_klass_shift; }
207 bool has_full_module_graph() const { return _has_full_module_graph; }
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 // Heap archiving
212 const ArchiveMappedHeapHeader* mapped_heap() const { return &_mapped_heap_header; }
213 const ArchiveStreamedHeapHeader* streamed_heap() const { return &_streamed_heap_header; }
214
215 void set_streamed_heap_header(ArchiveStreamedHeapHeader header) { _streamed_heap_header = header; }
216 void set_mapped_heap_header(ArchiveMappedHeapHeader header) { _mapped_heap_header = header; }
217
218 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
219 void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); }
220 void set_early_serialized_data(char* p) { set_as_offset(p, &_early_serialized_data_offset); }
221 void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); }
222 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
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 prepare_for_writing();
369 void write_header();
370 void write_region(int region, char* base, size_t size,
371 bool read_only, bool allow_exec);
372 size_t remove_bitmap_zeros(CHeapBitMap* map);
373 char* write_bitmap_region(CHeapBitMap* rw_ptrmap,
374 CHeapBitMap* ro_ptrmap,
375 ArchiveMappedHeapInfo* mapped_heap_info,
376 ArchiveStreamedHeapInfo* streamed_heap_info,
377 size_t &size_in_bytes);
378 size_t write_mapped_heap_region(ArchiveMappedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0);
379 size_t write_streamed_heap_region(ArchiveStreamedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0);
380 void write_bytes(const void* buffer, size_t count);
381 void write_bytes_aligned(const void* buffer, size_t count);
382 size_t read_bytes(void* buffer, size_t count);
383 static size_t readonly_total();
384 MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
385 void unmap_regions(int regions[], int num_regions);
386
387 // Object loading support
388 void stream_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
389 void map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
390
391 bool has_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
392 bool read_region(int i, char* base, size_t size, bool do_commit);
393 char* map_bitmap_region();
394 bool map_aot_code_region(ReservedSpace rs);
438 return header()->region_at(i);
439 }
440
441 BitMapView bitmap_view(int region_index, bool is_oopmap);
442 BitMapView oopmap_view(int region_index);
443 BitMapView ptrmap_view(int region_index);
444
445 void print(outputStream* st) const;
446
447 const char* vm_version() {
448 return header()->jvm_ident();
449 }
450 bool can_use_heap_region();
451
452 private:
453 bool open_for_read();
454 void seek_to_position(size_t pos);
455
456 MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
457 bool relocate_pointers_in_core_regions(intx addr_delta);
458 char* map_auxiliary_region(int region_index, bool read_only);
459
460 public:
461
462 private:
463
464 #if INCLUDE_JVMTI
465 static ClassPathEntry** _classpath_entries_for_jvmti;
466 static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
467 #endif
468 };
469
470 #endif // SHARE_CDS_FILEMAP_HPP
|
124 size_t _early_serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
125 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
126
127 // The following fields are all sanity checks for whether this archive
128 // will function correctly with this JVM and the bootclasspath it's
129 // invoked with.
130 char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump
131
132 size_t _class_location_config_offset;
133
134 bool _verify_local; // BytecodeVerificationLocal setting
135 bool _verify_remote; // BytecodeVerificationRemote setting
136 bool _has_platform_or_app_classes; // Archive contains app or platform classes
137 char* _requested_base_address; // Archive relocation is not necessary if we map with this base address.
138 char* _mapped_base_address; // Actual base address where archive is mapped.
139
140 bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
141 // some expensive operations.
142 bool _has_aot_linked_classes; // Was the CDS archive created with -XX:+AOTClassLinking
143 bool _has_full_module_graph; // Does this CDS archive contain the full archived module graph?
144 int _gc_kind; // Universe::heap()->kind();
145 char _gc_name[32]; // Universe::heap()->name();
146 size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap
147 size_t _rw_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the rw region
148 size_t _ro_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the ro region
149
150 ArchiveMappedHeapHeader _mapped_heap_header;
151 ArchiveStreamedHeapHeader _streamed_heap_header;
152
153 // The following are parameters that affect MethodData layout.
154 u1 _compiler_type;
155 uint _type_profile_level;
156 int _type_profile_args_limit;
157 int _type_profile_parms_limit;
158 intx _type_profile_width;
159 intx _bci_profile_width;
160 bool _profile_traps;
161 bool _type_profile_casts;
162 int _spec_trap_limit_extra_entries;
163
164 template <typename T> T from_mapped_offset(size_t offset) const {
165 return (T)(mapped_base_address() + offset);
166 }
186 void set_base_archive_name_size(unsigned int s) { _generic_header._base_archive_name_size = s; }
187
188 bool is_static() const { return magic() == CDS_ARCHIVE_MAGIC; }
189 size_t core_region_alignment() const { return _core_region_alignment; }
190 int obj_alignment() const { return _obj_alignment; }
191 address narrow_oop_base() const { return _narrow_oop_base; }
192 int narrow_oop_shift() const { return _narrow_oop_shift; }
193 bool compact_strings() const { return _compact_strings; }
194 bool compact_headers() const { return _compact_headers; }
195 uintx max_heap_size() const { return _max_heap_size; }
196 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
197 char* cloned_vtables() const { return from_mapped_offset<char*>(_cloned_vtables_offset); }
198 char* early_serialized_data() const { return from_mapped_offset<char*>(_early_serialized_data_offset); }
199 char* serialized_data() const { return from_mapped_offset<char*>(_serialized_data_offset); }
200 bool object_streaming_mode() const { return _object_streaming_mode; }
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 bool has_full_module_graph() const { return _has_full_module_graph; }
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 // Heap archiving
218 const ArchiveMappedHeapHeader* mapped_heap() const { return &_mapped_heap_header; }
219 const ArchiveStreamedHeapHeader* streamed_heap() const { return &_streamed_heap_header; }
220
221 void set_streamed_heap_header(ArchiveStreamedHeapHeader header) { _streamed_heap_header = header; }
222 void set_mapped_heap_header(ArchiveMappedHeapHeader header) { _mapped_heap_header = header; }
223
224 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
225 void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); }
226 void set_early_serialized_data(char* p) { set_as_offset(p, &_early_serialized_data_offset); }
227 void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); }
228 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
361 CDS_ONLY(_current_info = info;)
362 }
363
364 static FileMapInfo* dynamic_info() {
365 CDS_ONLY(return _dynamic_archive_info;)
366 NOT_CDS(return nullptr;)
367 }
368
369 static void assert_mark(bool check);
370
371 // File manipulation.
372 bool open_as_input() NOT_CDS_RETURN_(false);
373 void open_as_output();
374 void prepare_for_writing();
375 void write_header();
376 void write_region(int region, char* base, size_t size,
377 bool read_only, bool allow_exec);
378 size_t remove_bitmap_zeros(CHeapBitMap* map);
379 char* write_bitmap_region(CHeapBitMap* rw_ptrmap,
380 CHeapBitMap* ro_ptrmap,
381 CHeapBitMap* ac_ptrmap,
382 ArchiveMappedHeapInfo* mapped_heap_info,
383 ArchiveStreamedHeapInfo* streamed_heap_info,
384 size_t &size_in_bytes);
385 size_t write_mapped_heap_region(ArchiveMappedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0);
386 size_t write_streamed_heap_region(ArchiveStreamedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0);
387 void write_bytes(const void* buffer, size_t count);
388 void write_bytes_aligned(const void* buffer, size_t count);
389 size_t read_bytes(void* buffer, size_t count);
390 static size_t readonly_total();
391 MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
392 void unmap_regions(int regions[], int num_regions);
393
394 // Object loading support
395 void stream_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
396 void map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
397
398 bool has_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
399 bool read_region(int i, char* base, size_t size, bool do_commit);
400 char* map_bitmap_region();
401 bool map_aot_code_region(ReservedSpace rs);
445 return header()->region_at(i);
446 }
447
448 BitMapView bitmap_view(int region_index, bool is_oopmap);
449 BitMapView oopmap_view(int region_index);
450 BitMapView ptrmap_view(int region_index);
451
452 void print(outputStream* st) const;
453
454 const char* vm_version() {
455 return header()->jvm_ident();
456 }
457 bool can_use_heap_region();
458
459 private:
460 bool open_for_read();
461 void seek_to_position(size_t pos);
462
463 MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
464 bool relocate_pointers_in_core_regions(intx addr_delta);
465 void relocate_pointers_in_aot_code_region();
466 char* map_auxiliary_region(int region_index, bool read_only);
467
468 public:
469
470 private:
471
472 #if INCLUDE_JVMTI
473 static ClassPathEntry** _classpath_entries_for_jvmti;
474 static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
475 #endif
476 };
477
478 #endif // SHARE_CDS_FILEMAP_HPP
|