@@ -652,7 +652,7 @@ class DynamicArchiveBuilder : ResourceObj {
652
652
it->push (&_symbols->at (i));
653
653
}
654
654
655
- _header->_shared_path_table . metaspace_pointers_do (it);
655
+ _header->shared_path_table_metaspace_pointers_do (it);
656
656
657
657
// Do not call these again, as we have already collected all the classes and symbols
658
658
// that we want to archive. Also, these calls would corrupt the tables when
@@ -733,14 +733,13 @@ void DynamicArchiveBuilder::init_header(address reserved_bottom) {
733
733
init_first_dump_space (reserved_bottom);
734
734
735
735
FileMapInfo* mapinfo = new FileMapInfo (false );
736
- _header = (DynamicArchiveHeader*) mapinfo->_header ;
736
+ _header = mapinfo->dynamic_header () ;
737
737
738
738
Thread* THREAD = Thread::current ();
739
739
FileMapInfo* base_info = FileMapInfo::current_info ();
740
- int * crc = _header->_base_archive_crc ;
741
- *crc++ = base_info->crc (); // base archive header crc
740
+ _header->set_base_header_crc (base_info->crc ());
742
741
for (int i = 0 ; i < MetaspaceShared::n_regions; i++) {
743
- *crc++ = base_info->space_crc (i);
742
+ _header-> set_base_region_crc (i, base_info->space_crc (i) );
744
743
}
745
744
_header->populate (base_info, os::vm_allocation_granularity ());
746
745
}
@@ -907,9 +906,9 @@ void DynamicArchiveBuilder::relocate_buffer_to_target() {
907
906
RelocateBufferToTarget patcher (this , (address*)_alloc_bottom, _buffer_to_target_delta);
908
907
_ptrmap.iterate(&patcher);
909
908
910
- Array<u8 >* table = _header->_shared_path_table .table ();
909
+ Array<u8 >* table = _header->shared_path_table () .table ();
911
910
table = to_target (table);
912
- _header->_shared_path_table . set_table (table);
911
+ _header->relocate_shared_path_table (table);
913
912
}
914
913
915
914
static void write_archive_info (FileMapInfo* dynamic_info, DynamicArchiveHeader *header) {
@@ -933,7 +932,7 @@ void DynamicArchiveBuilder::write_archive(char* read_only_tables_start) {
933
932
int num_klasses = _klasses->length ();
934
933
int num_symbols = _symbols->length ();
935
934
936
- _header->_read_only_tables_start = to_target (read_only_tables_start);
935
+ _header->set_read_only_tables_start ( to_target (read_only_tables_start) );
937
936
938
937
FileMapInfo* dynamic_info = FileMapInfo::dynamic_info ();
939
938
assert (dynamic_info != NULL , " Sanity" );
@@ -953,10 +952,11 @@ void DynamicArchiveBuilder::write_archive(char* read_only_tables_start) {
953
952
954
953
address base = to_target (_alloc_bottom);
955
954
address top = address (current_dump_space ()->top ()) + _buffer_to_target_delta;
956
- int file_size = int (top - base);
955
+ size_t file_size = pointer_delta (top, base, sizeof ( char ) );
957
956
958
- log_info (cds, dynamic)(" Written dynamic archive " PTR_FORMAT " - " PTR_FORMAT " [%d bytes header, %d bytes total]" ,
959
- p2i (base), p2i (top), (int )_header->_header_size , file_size);
957
+ log_info (cds, dynamic)(" Written dynamic archive " PTR_FORMAT " - " PTR_FORMAT
958
+ " [" SIZE_FORMAT " bytes header, " SIZE_FORMAT " bytes total]" ,
959
+ p2i (base), p2i (top), _header->header_size (), file_size);
960
960
log_info (cds, dynamic)(" %d klasses; %d symbols" , num_klasses, num_symbols);
961
961
}
962
962
@@ -1046,8 +1046,8 @@ static DynamicArchiveHeader *_dynamic_header = NULL;
1046
1046
DynamicArchiveBuilder* DynamicArchive::_builder = NULL ;
1047
1047
1048
1048
void DynamicArchive::map_failed (FileMapInfo* mapinfo) {
1049
- if (mapinfo->_header != NULL ) {
1050
- os::free (mapinfo->_header );
1049
+ if (mapinfo->dynamic_header () != NULL ) {
1050
+ os::free (( void *) mapinfo->dynamic_header () );
1051
1051
}
1052
1052
delete mapinfo;
1053
1053
}
@@ -1081,15 +1081,12 @@ address DynamicArchive::map() {
1081
1081
}
1082
1082
1083
1083
address DynamicArchive::map_impl (FileMapInfo* mapinfo) {
1084
-
1085
-
1086
1084
// Read header
1087
1085
if (!mapinfo->initialize (false )) {
1088
1086
return NULL ;
1089
1087
}
1090
1088
1091
- _dynamic_header = (DynamicArchiveHeader*)mapinfo->header ();
1092
-
1089
+ _dynamic_header = mapinfo->dynamic_header ();
1093
1090
int regions[] = {MetaspaceShared::rw,
1094
1091
MetaspaceShared::ro,
1095
1092
MetaspaceShared::mc};
@@ -1111,7 +1108,7 @@ address DynamicArchive::map_impl(FileMapInfo* mapinfo) {
1111
1108
return NULL ;
1112
1109
}
1113
1110
1114
- intptr_t * buffer = (intptr_t *)_dynamic_header->_read_only_tables_start ;
1111
+ intptr_t * buffer = (intptr_t *)_dynamic_header->read_only_tables_start () ;
1115
1112
ReadClosure rc (&buffer);
1116
1113
SymbolTable::serialize_shared_table_header (&rc, false );
1117
1114
SystemDictionaryShared::serialize_dictionary_headers (&rc, false );
@@ -1122,18 +1119,17 @@ address DynamicArchive::map_impl(FileMapInfo* mapinfo) {
1122
1119
bool DynamicArchive::validate (FileMapInfo* dynamic_info) {
1123
1120
// Check if the recorded base archive matches with the current one
1124
1121
FileMapInfo* base_info = FileMapInfo::current_info ();
1125
- DynamicArchiveHeader* dynamic_header = (DynamicArchiveHeader*)dynamic_info->header ();
1126
- int * crc = dynamic_header->_base_archive_crc ;
1122
+ DynamicArchiveHeader* dynamic_header = dynamic_info->dynamic_header ();
1127
1123
1128
1124
// Check the header crc
1129
- if (*crc++ != base_info->crc ()) {
1125
+ if (dynamic_header-> base_header_crc () != base_info->crc ()) {
1130
1126
FileMapInfo::fail_continue (" Archive header checksum verification failed." );
1131
1127
return false ;
1132
1128
}
1133
1129
1134
1130
// Check each space's crc
1135
1131
for (int i = 0 ; i < MetaspaceShared::n_regions; i++) {
1136
- if (*crc++ != base_info->space_crc (i)) {
1132
+ if (dynamic_header-> base_region_crc (i) != base_info->space_crc (i)) {
1137
1133
FileMapInfo::fail_continue (" Archive region #%d checksum verification failed." , i);
1138
1134
return false ;
1139
1135
}
0 commit comments