< prev index next >

src/hotspot/share/memory/filemap.hpp

Print this page

        

*** 24,33 **** --- 24,34 ---- #ifndef SHARE_VM_MEMORY_FILEMAP_HPP #define SHARE_VM_MEMORY_FILEMAP_HPP #include "classfile/classLoader.hpp" + #include "include/cds.h" #include "memory/metaspaceShared.hpp" #include "memory/metaspace.hpp" #include "memory/universe.hpp" #include "utilities/align.hpp"
*** 85,136 **** void set_manifest(Array<u1>* manifest) { _manifest = manifest; } }; ! class FileMapInfo : public CHeapObj<mtInternal> { ! private: ! friend class ManifestStream; ! friend class VMStructs; ! enum { ! _invalid_version = -1, ! _current_version = 3 ! }; ! ! bool _file_open; ! int _fd; ! size_t _file_offset; ! ! private: ! static Array<u8>* _shared_path_table; ! static int _shared_path_table_size; ! static size_t _shared_path_entry_size; ! static bool _validating_shared_path_table; ! ! // FileMapHeader describes the shared space data in the file to be ! // mapped. This structure gets written to a file. It is not a class, so ! // that the compilers don't add any compiler-private data to it. ! ! public: ! struct FileMapHeaderBase : public CHeapObj<mtClass> { ! // Need to put something here. Otherwise, in product build, because CHeapObj has no virtual ! // methods, we would get sizeof(FileMapHeaderBase) == 1 with gcc. ! intx _dummy; ! }; ! struct FileMapHeader : FileMapHeaderBase { ! // Use data() and data_size() to memcopy to/from the FileMapHeader. We need to ! // avoid read/writing the C++ vtable pointer. ! static size_t data_size() { ! return sizeof(FileMapHeader) - sizeof(FileMapInfo::FileMapHeaderBase); ! } ! char* data() { ! return ((char*)this) + sizeof(FileMapHeaderBase); ! } ! ! int _magic; // identify file type. ! int _crc; // header crc checksum. ! int _version; // (from enum, above.) size_t _alignment; // how shared archive should be aligned int _obj_alignment; // value of ObjectAlignmentInBytes address _narrow_oop_base; // compressed oop encoding base int _narrow_oop_shift; // compressed oop encoding shift bool _compact_strings; // value of CompactStrings --- 86,96 ---- void set_manifest(Array<u1>* manifest) { _manifest = manifest; } }; ! struct FileMapHeader : public CDSFileMapHeaderBase { size_t _alignment; // how shared archive should be aligned int _obj_alignment; // value of ObjectAlignmentInBytes address _narrow_oop_base; // compressed oop encoding base int _narrow_oop_shift; // compressed oop encoding shift bool _compact_strings; // value of CompactStrings
*** 142,163 **** char* _read_only_tables_start; address _cds_i2i_entry_code_buffers; size_t _cds_i2i_entry_code_buffers_size; size_t _core_spaces_size; // number of bytes allocated by the core spaces // (mc, md, ro, rw and od). - struct space_info { - int _crc; // crc checksum of the current space - size_t _file_offset; // sizeof(this) rounded to vm page size - union { - char* _base; // copy-on-write base address - intx _offset; // offset from the compressed oop encoding base, only used - // by archive heap space - } _addr; - size_t _used; // for setting space top on read - bool _read_only; // read only space? - bool _allow_exec; // executable code in space? - } _space[MetaspaceShared::n_regions]; // The following fields are all sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's // invoked with. char _jvm_ident[JVM_IDENT_MAX]; // identifier for jvm --- 102,111 ----
*** 207,218 **** --- 155,195 ---- char* region_addr(int idx); bool validate(); void populate(FileMapInfo* info, size_t alignment); int compute_crc(); + }; + + + class FileMapInfo : public CHeapObj<mtInternal> { + private: + friend class ManifestStream; + friend class VMStructs; + friend struct FileMapHeader; + + bool _file_open; + int _fd; + size_t _file_offset; + + private: + static Array<u8>* _shared_path_table; + static int _shared_path_table_size; + static size_t _shared_path_entry_size; + static bool _validating_shared_path_table; + + // FileMapHeader describes the shared space data in the file to be + // mapped. This structure gets written to a file. It is not a class, so + // that the compilers don't add any compiler-private data to it. + + public: + struct FileMapHeaderBase : public CHeapObj<mtClass> { + // Need to put something here. Otherwise, in product build, because CHeapObj has no virtual + // methods, we would get sizeof(FileMapHeaderBase) == 1 with gcc. + intx _dummy; }; + FileMapHeader * _header; const char* _full_path; char* _paths_misc_info;
*** 225,235 **** public: FileMapInfo(); ~FileMapInfo(); - static int current_version() { return _current_version; } int compute_header_crc() { return _header->compute_crc(); } void set_header_crc(int crc) { _header->_crc = crc; } void populate_header(size_t alignment); bool validate_header(); void invalidate(); --- 202,211 ----
*** 276,287 **** void write_header(); void write_region(int region, char* base, size_t size, bool read_only, bool allow_exec); size_t write_archive_heap_regions(GrowableArray<MemRegion> *heap_mem, int first_region_id, int max_num_regions); ! void write_bytes(const void* buffer, int count); ! void write_bytes_aligned(const void* buffer, int count); char* map_region(int i, char** top_ret); void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; void unmap_region(int i); bool verify_region_checksum(int i); --- 252,263 ---- void write_header(); void write_region(int region, char* base, size_t size, bool read_only, bool allow_exec); size_t write_archive_heap_regions(GrowableArray<MemRegion> *heap_mem, int first_region_id, int max_num_regions); ! void write_bytes(const void* buffer, size_t count); ! void write_bytes_aligned(const void* buffer, size_t count); char* map_region(int i, char** top_ret); void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN; void unmap_region(int i); bool verify_region_checksum(int i);
*** 330,337 **** --- 306,318 ---- private: bool map_heap_data(MemRegion **heap_mem, int first, int max, int* num, bool is_open = false) NOT_CDS_JAVA_HEAP_RETURN_(false); bool verify_mapped_heap_regions(int first, int num) NOT_CDS_JAVA_HEAP_RETURN_(false); void dealloc_archive_heap_regions(MemRegion* regions, int num, bool is_open) NOT_CDS_JAVA_HEAP_RETURN; + + CDSFileMapRegion* space_at(int i) { + assert(i >= 0 && i < NUM_CDS_REGIONS, "invalid region"); + return &_header->_space[i]; + } }; #endif // SHARE_VM_MEMORY_FILEMAP_HPP
< prev index next >