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