170 void init_ptrmap(size_t offset, size_t size_in_bits);
171 bool has_ptrmap() { return _ptrmap_size_in_bits != 0; }
172
173 bool check_region_crc(char* base) 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 uintx _max_heap_size; // java max heap size during dumping
191 CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode
192 bool _compressed_oops; // save the flag UseCompressedOops
193 bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers
194 bool _use_secondary_supers_table; // save the flag UseSecondarySupersTable
195 size_t _cloned_vtables_offset; // The address of the first cloned vtable
196 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
197 bool _has_non_jar_in_classpath; // non-jar file entry exists in classpath
198 unsigned int _common_app_classpath_prefix_size; // size of the common prefix of app class paths
199 // 0 if no common prefix exists
200
201 // The following fields are all sanity checks for whether this archive
202 // will function correctly with this JVM and the bootclasspath it's
203 // invoked with.
204 char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump
205
206 // The following is a table of all the boot/app/module path entries that were used
207 // during dumping. At run time, we validate these entries according to their
208 // SharedClassPathEntry::_type. See:
209 // check_nonempty_dir_in_shared_path_table()
210 // validate_shared_path_table()
211 // validate_non_existent_class_paths()
212 size_t _shared_path_table_offset;
213
214 jshort _app_class_paths_start_index; // Index of first app classpath entry
242 int version() const { return _generic_header._version; }
243 unsigned int header_size() const { return _generic_header._header_size; }
244 unsigned int base_archive_name_offset() const { return _generic_header._base_archive_name_offset; }
245 unsigned int base_archive_name_size() const { return _generic_header._base_archive_name_size; }
246 unsigned int common_app_classpath_prefix_size() const { return _common_app_classpath_prefix_size; }
247
248 void set_magic(unsigned int m) { _generic_header._magic = m; }
249 void set_crc(int crc_value) { _generic_header._crc = crc_value; }
250 void set_version(int v) { _generic_header._version = v; }
251 void set_header_size(unsigned int s) { _generic_header._header_size = s; }
252 void set_base_archive_name_offset(unsigned int s) { _generic_header._base_archive_name_offset = s; }
253 void set_base_archive_name_size(unsigned int s) { _generic_header._base_archive_name_size = s; }
254 void set_common_app_classpath_prefix_size(unsigned int s) { _common_app_classpath_prefix_size = s; }
255
256 bool is_static() const { return magic() == CDS_ARCHIVE_MAGIC; }
257 size_t core_region_alignment() const { return _core_region_alignment; }
258 int obj_alignment() const { return _obj_alignment; }
259 address narrow_oop_base() const { return _narrow_oop_base; }
260 int narrow_oop_shift() const { return _narrow_oop_shift; }
261 bool compact_strings() const { return _compact_strings; }
262 uintx max_heap_size() const { return _max_heap_size; }
263 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
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 const char* jvm_ident() const { return _jvm_ident; }
267 char* requested_base_address() const { return _requested_base_address; }
268 char* mapped_base_address() const { return _mapped_base_address; }
269 bool has_platform_or_app_classes() const { return _has_platform_or_app_classes; }
270 bool has_non_jar_in_classpath() const { return _has_non_jar_in_classpath; }
271 bool compressed_oops() const { return _compressed_oops; }
272 bool compressed_class_pointers() const { return _compressed_class_ptrs; }
273 size_t heap_roots_offset() const { return _heap_roots_offset; }
274 size_t heap_oopmap_start_pos() const { return _heap_oopmap_start_pos; }
275 size_t heap_ptrmap_start_pos() const { return _heap_ptrmap_start_pos; }
276 size_t rw_ptrmap_start_pos() const { return _rw_ptrmap_start_pos; }
277 size_t ro_ptrmap_start_pos() const { return _ro_ptrmap_start_pos; }
278 // FIXME: These should really return int
279 jshort max_used_path_index() const { return _max_used_path_index; }
280 jshort app_module_paths_start_index() const { return _app_module_paths_start_index; }
281 jshort app_class_paths_start_index() const { return _app_class_paths_start_index; }
282 int num_module_paths() const { return _num_module_paths; }
283
284 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
285 void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); }
286 void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); }
287 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
288 void set_heap_roots_offset(size_t n) { _heap_roots_offset = n; }
289 void set_heap_oopmap_start_pos(size_t n) { _heap_oopmap_start_pos = n; }
290 void set_heap_ptrmap_start_pos(size_t n) { _heap_ptrmap_start_pos = n; }
291 void set_rw_ptrmap_start_pos(size_t n) { _rw_ptrmap_start_pos = n; }
292 void set_ro_ptrmap_start_pos(size_t n) { _ro_ptrmap_start_pos = n; }
|
170 void init_ptrmap(size_t offset, size_t size_in_bits);
171 bool has_ptrmap() { return _ptrmap_size_in_bits != 0; }
172
173 bool check_region_crc(char* base) 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 bool _compressed_oops; // save the flag UseCompressedOops
194 bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers
195 bool _use_secondary_supers_table; // save the flag UseSecondarySupersTable
196 int _narrow_klass_pointer_bits; // save number of bits in narrowKlass
197 int _narrow_klass_shift; // save shift width used to pre-compute narrowKlass IDs in archived heap objects
198 size_t _cloned_vtables_offset; // The address of the first cloned vtable
199 size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
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
245 int version() const { return _generic_header._version; }
246 unsigned int header_size() const { return _generic_header._header_size; }
247 unsigned int base_archive_name_offset() const { return _generic_header._base_archive_name_offset; }
248 unsigned int base_archive_name_size() const { return _generic_header._base_archive_name_size; }
249 unsigned int common_app_classpath_prefix_size() const { return _common_app_classpath_prefix_size; }
250
251 void set_magic(unsigned int m) { _generic_header._magic = m; }
252 void set_crc(int crc_value) { _generic_header._crc = crc_value; }
253 void set_version(int v) { _generic_header._version = v; }
254 void set_header_size(unsigned int s) { _generic_header._header_size = s; }
255 void set_base_archive_name_offset(unsigned int s) { _generic_header._base_archive_name_offset = s; }
256 void set_base_archive_name_size(unsigned int s) { _generic_header._base_archive_name_size = s; }
257 void set_common_app_classpath_prefix_size(unsigned int s) { _common_app_classpath_prefix_size = s; }
258
259 bool is_static() const { return magic() == CDS_ARCHIVE_MAGIC; }
260 size_t core_region_alignment() const { return _core_region_alignment; }
261 int obj_alignment() const { return _obj_alignment; }
262 address narrow_oop_base() const { return _narrow_oop_base; }
263 int narrow_oop_shift() const { return _narrow_oop_shift; }
264 bool compact_strings() const { return _compact_strings; }
265 bool compact_headers() const { return _compact_headers; }
266 uintx max_heap_size() const { return _max_heap_size; }
267 CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; }
268 char* cloned_vtables() const { return from_mapped_offset(_cloned_vtables_offset); }
269 char* serialized_data() const { return from_mapped_offset(_serialized_data_offset); }
270 const char* jvm_ident() const { return _jvm_ident; }
271 char* requested_base_address() const { return _requested_base_address; }
272 char* mapped_base_address() const { return _mapped_base_address; }
273 bool has_platform_or_app_classes() const { return _has_platform_or_app_classes; }
274 bool has_non_jar_in_classpath() const { return _has_non_jar_in_classpath; }
275 bool compressed_oops() const { return _compressed_oops; }
276 bool compressed_class_pointers() const { return _compressed_class_ptrs; }
277 int narrow_klass_pointer_bits() const { return _narrow_klass_pointer_bits; }
278 int narrow_klass_shift() const { return _narrow_klass_shift; }
279 size_t heap_roots_offset() const { return _heap_roots_offset; }
280 size_t heap_oopmap_start_pos() const { return _heap_oopmap_start_pos; }
281 size_t heap_ptrmap_start_pos() const { return _heap_ptrmap_start_pos; }
282 size_t rw_ptrmap_start_pos() const { return _rw_ptrmap_start_pos; }
283 size_t ro_ptrmap_start_pos() const { return _ro_ptrmap_start_pos; }
284 // FIXME: These should really return int
285 jshort max_used_path_index() const { return _max_used_path_index; }
286 jshort app_module_paths_start_index() const { return _app_module_paths_start_index; }
287 jshort app_class_paths_start_index() const { return _app_class_paths_start_index; }
288 int num_module_paths() const { return _num_module_paths; }
289
290 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
291 void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); }
292 void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); }
293 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
294 void set_heap_roots_offset(size_t n) { _heap_roots_offset = n; }
295 void set_heap_oopmap_start_pos(size_t n) { _heap_oopmap_start_pos = n; }
296 void set_heap_ptrmap_start_pos(size_t n) { _heap_ptrmap_start_pos = n; }
297 void set_rw_ptrmap_start_pos(size_t n) { _rw_ptrmap_start_pos = n; }
298 void set_ro_ptrmap_start_pos(size_t n) { _ro_ptrmap_start_pos = n; }
|