24 25 #ifndef SHARE_MEMORY_FILEMAP_HPP 26 #define SHARE_MEMORY_FILEMAP_HPP 27 28 #include "classfile/classLoader.hpp" 29 #include "include/cds.h" 30 #include "memory/metaspaceShared.hpp" 31 #include "memory/metaspace.hpp" 32 #include "oops/compressedOops.hpp" 33 #include "utilities/align.hpp" 34 35 // Layout of the file: 36 // header: dump of archive instance plus versioning info, datestamp, etc. 37 // [magic # = 0xF00BABA2] 38 // ... padding to align on page-boundary 39 // read-write space 40 // read-only space 41 // misc data (block offset table, string table, symbols, dictionary, etc.) 42 // tag(666) 43 44 static const int JVM_IDENT_MAX = 256; 45 46 class SharedClassPathEntry { 47 enum { 48 modules_image_entry, 49 jar_entry, 50 signed_jar_entry, 51 dir_entry, 52 unknown_entry 53 }; 54 protected: 55 u1 _type; 56 bool _from_class_path_attr; 57 time_t _timestamp; // jar timestamp, 0 if is directory, modules image or other 58 long _filesize; // jar/jimage file size, -1 if is directory, -2 if other 59 Array<char>* _name; 60 Array<u1>* _manifest; 61 62 public: 63 void init(bool is_modules_image, ClassPathEntry* cpe, TRAPS); 64 void metaspace_pointers_do(MetaspaceClosure* it); 65 bool validate(bool is_class_path = true); 121 122 struct FileMapHeader : public CDSFileMapHeaderBase { 123 size_t _header_size; 124 size_t _alignment; // how shared archive should be aligned 125 int _obj_alignment; // value of ObjectAlignmentInBytes 126 address _narrow_oop_base; // compressed oop encoding base 127 int _narrow_oop_shift; // compressed oop encoding shift 128 bool _compact_strings; // value of CompactStrings 129 uintx _max_heap_size; // java max heap size during dumping 130 CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode 131 int _narrow_klass_shift; // save narrow klass base and shift 132 address _narrow_klass_base; 133 char* _misc_data_patching_start; 134 char* _read_only_tables_start; 135 address _cds_i2i_entry_code_buffers; 136 size_t _cds_i2i_entry_code_buffers_size; 137 size_t _core_spaces_size; // number of bytes allocated by the core spaces 138 // (mc, md, ro, rw and od). 139 MemRegion _heap_reserved; // reserved region for the entire heap at dump time. 140 bool _base_archive_is_default; // indicates if the base archive is the system default one 141 142 // The following fields are all sanity checks for whether this archive 143 // will function correctly with this JVM and the bootclasspath it's 144 // invoked with. 145 char _jvm_ident[JVM_IDENT_MAX]; // identifier for jvm 146 147 // size of the base archive name including NULL terminator 148 int _base_archive_name_size; 149 150 // The _paths_misc_info is a variable-size structure that records "miscellaneous" 151 // information during dumping. It is generated and validated by the 152 // SharedPathsMiscInfo class. See SharedPathsMiscInfo.hpp for 153 // detailed description. 154 // 155 // The _paths_misc_info data is stored as a byte array in the archive file header, 156 // immediately after the _header field. This information is used only when 157 // checking the validity of the archive and is deallocated after the archive is loaded. 158 // 159 // Note that the _paths_misc_info does NOT include information for JAR files 160 // that existed during dump time. Their information is stored in _shared_path_table. 161 int _paths_misc_info_size; 162 163 // The following is a table of all the class path entries that were used 164 // during dumping. At run time, we require these files to exist and have the same 165 // size/modification time, or else the archive will refuse to load. | 24 25 #ifndef SHARE_MEMORY_FILEMAP_HPP 26 #define SHARE_MEMORY_FILEMAP_HPP 27 28 #include "classfile/classLoader.hpp" 29 #include "include/cds.h" 30 #include "memory/metaspaceShared.hpp" 31 #include "memory/metaspace.hpp" 32 #include "oops/compressedOops.hpp" 33 #include "utilities/align.hpp" 34 35 // Layout of the file: 36 // header: dump of archive instance plus versioning info, datestamp, etc. 37 // [magic # = 0xF00BABA2] 38 // ... padding to align on page-boundary 39 // read-write space 40 // read-only space 41 // misc data (block offset table, string table, symbols, dictionary, etc.) 42 // tag(666) 43 44 class SharedClassPathEntry { 45 enum { 46 modules_image_entry, 47 jar_entry, 48 signed_jar_entry, 49 dir_entry, 50 unknown_entry 51 }; 52 protected: 53 u1 _type; 54 bool _from_class_path_attr; 55 time_t _timestamp; // jar timestamp, 0 if is directory, modules image or other 56 long _filesize; // jar/jimage file size, -1 if is directory, -2 if other 57 Array<char>* _name; 58 Array<u1>* _manifest; 59 60 public: 61 void init(bool is_modules_image, ClassPathEntry* cpe, TRAPS); 62 void metaspace_pointers_do(MetaspaceClosure* it); 63 bool validate(bool is_class_path = true); 119 120 struct FileMapHeader : public CDSFileMapHeaderBase { 121 size_t _header_size; 122 size_t _alignment; // how shared archive should be aligned 123 int _obj_alignment; // value of ObjectAlignmentInBytes 124 address _narrow_oop_base; // compressed oop encoding base 125 int _narrow_oop_shift; // compressed oop encoding shift 126 bool _compact_strings; // value of CompactStrings 127 uintx _max_heap_size; // java max heap size during dumping 128 CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode 129 int _narrow_klass_shift; // save narrow klass base and shift 130 address _narrow_klass_base; 131 char* _misc_data_patching_start; 132 char* _read_only_tables_start; 133 address _cds_i2i_entry_code_buffers; 134 size_t _cds_i2i_entry_code_buffers_size; 135 size_t _core_spaces_size; // number of bytes allocated by the core spaces 136 // (mc, md, ro, rw and od). 137 MemRegion _heap_reserved; // reserved region for the entire heap at dump time. 138 bool _base_archive_is_default; // indicates if the base archive is the system default one 139 140 // size of the base archive name including NULL terminator 141 int _base_archive_name_size; 142 143 // The _paths_misc_info is a variable-size structure that records "miscellaneous" 144 // information during dumping. It is generated and validated by the 145 // SharedPathsMiscInfo class. See SharedPathsMiscInfo.hpp for 146 // detailed description. 147 // 148 // The _paths_misc_info data is stored as a byte array in the archive file header, 149 // immediately after the _header field. This information is used only when 150 // checking the validity of the archive and is deallocated after the archive is loaded. 151 // 152 // Note that the _paths_misc_info does NOT include information for JAR files 153 // that existed during dump time. Their information is stored in _shared_path_table. 154 int _paths_misc_info_size; 155 156 // The following is a table of all the class path entries that were used 157 // during dumping. At run time, we require these files to exist and have the same 158 // size/modification time, or else the archive will refuse to load. |