144
145 // Accessors
146 int crc() const { return _crc; }
147 size_t file_offset() const { return _file_offset; }
148 size_t mapping_offset() const { return _mapping_offset; }
149 size_t mapping_end_offset() const { return _mapping_offset + used_aligned(); }
150 size_t used() const { return _used; }
151 size_t used_aligned() const; // aligned up to os::vm_allocation_granularity()
152 char* mapped_base() const { assert_is_not_heap_region(); return _mapped_base; }
153 char* mapped_end() const { return mapped_base() + used_aligned(); }
154 bool read_only() const { return _read_only != 0; }
155 bool allow_exec() const { return _allow_exec != 0; }
156 bool mapped_from_file() const { return _mapped_from_file != 0; }
157 size_t oopmap_offset() const { assert_is_heap_region(); return _oopmap_offset; }
158 size_t oopmap_size_in_bits() const { assert_is_heap_region(); return _oopmap_size_in_bits; }
159
160 void set_file_offset(size_t s) { _file_offset = s; }
161 void set_read_only(bool v) { _read_only = v; }
162 void set_mapped_base(char* p) { _mapped_base = p; }
163 void set_mapped_from_file(bool v) { _mapped_from_file = v; }
164 void init(bool is_heap_region, char* base, size_t size, bool read_only,
165 bool allow_exec, int crc);
166
167 void init_oopmap(size_t oopmap_offset, size_t size_in_bits) {
168 _oopmap_offset = oopmap_offset;
169 _oopmap_size_in_bits = size_in_bits;
170 }
171 };
172
173 class FileMapHeader: private CDSFileMapHeaderBase {
174 friend class CDSOffsets;
175 friend class VMStructs;
176
177 size_t _header_size;
178
179 // The following fields record the states of the VM during dump time.
180 // They are compared with the runtime states to see if the archive
181 // can be used.
182 size_t _alignment; // how shared archive should be aligned
183 int _obj_alignment; // value of ObjectAlignmentInBytes
184 address _narrow_oop_base; // compressed oop encoding base
270 jshort app_module_paths_start_index() const { return _app_module_paths_start_index; }
271 jshort app_class_paths_start_index() const { return _app_class_paths_start_index; }
272 jshort num_module_paths() const { return _num_module_paths; }
273
274 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
275 void set_misc_data_patching_start(char* p) { set_mapped_offset(p, &_misc_data_patching_offset); }
276 void set_serialized_data_start(char* p) { set_mapped_offset(p, &_serialized_data_offset); }
277 void set_base_archive_name_size(size_t s) { _base_archive_name_size = s; }
278 void set_base_archive_is_default(bool b) { _base_archive_is_default = b; }
279 void set_header_size(size_t s) { _header_size = s; }
280 void set_ptrmap_size_in_bits(size_t s) { _ptrmap_size_in_bits = s; }
281 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
282 void set_i2i_entry_code_buffers(address p, size_t s) {
283 set_mapped_offset((char*)p, &_i2i_entry_code_buffers_offset);
284 _i2i_entry_code_buffers_size = s;
285 }
286
287 void set_shared_path_table(SharedPathTable table) {
288 set_mapped_offset((char*)table.table(), &_shared_path_table_offset);
289 _shared_path_table_size = table.size();
290 }
291
292 void set_shared_path_table(size_t offset, int size) {
293 _shared_path_table_offset = offset;
294 _shared_path_table_size = size;
295 }
296
297 void set_final_requested_base(char* b) {
298 _requested_base_address = b;
299 _mapped_base_address = 0;
300 }
301
302 SharedPathTable shared_path_table() const {
303 return SharedPathTable((Array<u8>*)from_mapped_offset(_shared_path_table_offset),
304 _shared_path_table_size);
305 }
306
307 bool validate();
308 int compute_crc();
309
310 FileMapRegion* space_at(int i) {
311 assert(is_valid_region(i), "invalid region");
312 return FileMapRegion::cast(&_space[i]);
313 }
314
|
144
145 // Accessors
146 int crc() const { return _crc; }
147 size_t file_offset() const { return _file_offset; }
148 size_t mapping_offset() const { return _mapping_offset; }
149 size_t mapping_end_offset() const { return _mapping_offset + used_aligned(); }
150 size_t used() const { return _used; }
151 size_t used_aligned() const; // aligned up to os::vm_allocation_granularity()
152 char* mapped_base() const { assert_is_not_heap_region(); return _mapped_base; }
153 char* mapped_end() const { return mapped_base() + used_aligned(); }
154 bool read_only() const { return _read_only != 0; }
155 bool allow_exec() const { return _allow_exec != 0; }
156 bool mapped_from_file() const { return _mapped_from_file != 0; }
157 size_t oopmap_offset() const { assert_is_heap_region(); return _oopmap_offset; }
158 size_t oopmap_size_in_bits() const { assert_is_heap_region(); return _oopmap_size_in_bits; }
159
160 void set_file_offset(size_t s) { _file_offset = s; }
161 void set_read_only(bool v) { _read_only = v; }
162 void set_mapped_base(char* p) { _mapped_base = p; }
163 void set_mapped_from_file(bool v) { _mapped_from_file = v; }
164 void init(int region_index, char* base, size_t size, bool read_only,
165 bool allow_exec, int crc);
166
167 void init_oopmap(size_t oopmap_offset, size_t size_in_bits) {
168 _oopmap_offset = oopmap_offset;
169 _oopmap_size_in_bits = size_in_bits;
170 }
171 };
172
173 class FileMapHeader: private CDSFileMapHeaderBase {
174 friend class CDSOffsets;
175 friend class VMStructs;
176
177 size_t _header_size;
178
179 // The following fields record the states of the VM during dump time.
180 // They are compared with the runtime states to see if the archive
181 // can be used.
182 size_t _alignment; // how shared archive should be aligned
183 int _obj_alignment; // value of ObjectAlignmentInBytes
184 address _narrow_oop_base; // compressed oop encoding base
270 jshort app_module_paths_start_index() const { return _app_module_paths_start_index; }
271 jshort app_class_paths_start_index() const { return _app_class_paths_start_index; }
272 jshort num_module_paths() const { return _num_module_paths; }
273
274 void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; }
275 void set_misc_data_patching_start(char* p) { set_mapped_offset(p, &_misc_data_patching_offset); }
276 void set_serialized_data_start(char* p) { set_mapped_offset(p, &_serialized_data_offset); }
277 void set_base_archive_name_size(size_t s) { _base_archive_name_size = s; }
278 void set_base_archive_is_default(bool b) { _base_archive_is_default = b; }
279 void set_header_size(size_t s) { _header_size = s; }
280 void set_ptrmap_size_in_bits(size_t s) { _ptrmap_size_in_bits = s; }
281 void set_mapped_base_address(char* p) { _mapped_base_address = p; }
282 void set_i2i_entry_code_buffers(address p, size_t s) {
283 set_mapped_offset((char*)p, &_i2i_entry_code_buffers_offset);
284 _i2i_entry_code_buffers_size = s;
285 }
286
287 void set_shared_path_table(SharedPathTable table) {
288 set_mapped_offset((char*)table.table(), &_shared_path_table_offset);
289 _shared_path_table_size = table.size();
290 }
291
292 void set_final_requested_base(char* b) {
293 _requested_base_address = b;
294 _mapped_base_address = 0;
295 }
296
297 SharedPathTable shared_path_table() const {
298 return SharedPathTable((Array<u8>*)from_mapped_offset(_shared_path_table_offset),
299 _shared_path_table_size);
300 }
301
302 bool validate();
303 int compute_crc();
304
305 FileMapRegion* space_at(int i) {
306 assert(is_valid_region(i), "invalid region");
307 return FileMapRegion::cast(&_space[i]);
308 }
309
|