< prev index next >

src/share/vm/memory/filemap.hpp

Print this page

*** 37,81 **** // misc data (block offset table, string table, symbols, dictionary, etc.) // tag(666) static const int JVM_IDENT_MAX = 256; - class Metaspace; - class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC { ! public: ! const char *_name; time_t _timestamp; // jar/jimage timestamp, 0 if is directory or other long _filesize; // jar/jimage file size, -1 if is directory, -2 if other // The _timestamp only gets set for jar files and "modules" jimage. bool is_jar_or_bootimage() { return _timestamp != 0; } ! bool is_dir() { ! return _filesize == -1; } ! ! bool is_jrt() { ! return ClassLoader::is_jrt(_name); } }; class FileMapInfo : public CHeapObj<mtInternal> { private: friend class ManifestStream; enum { _invalid_version = -1, ! _current_version = 2 }; bool _file_open; int _fd; size_t _file_offset; private: ! static SharedClassPathEntry* _classpath_entry_table; static int _classpath_entry_table_size; static size_t _classpath_entry_size; static bool _validating_classpath_entry_table; // FileMapHeader describes the shared space data in the file to be --- 37,90 ---- // misc data (block offset table, string table, symbols, dictionary, etc.) // tag(666) static const int JVM_IDENT_MAX = 256; class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC { ! protected: ! bool _is_dir; time_t _timestamp; // jar/jimage timestamp, 0 if is directory or other long _filesize; // jar/jimage file size, -1 if is directory, -2 if other + Array<char>* _name; + Array<u1>* _manifest; + + public: + void init(const char* name, TRAPS); + void metaspace_pointers_do(MetaspaceClosure* it); + bool validate(); // The _timestamp only gets set for jar files and "modules" jimage. bool is_jar_or_bootimage() { return _timestamp != 0; } ! bool is_dir() { return _is_dir; } ! bool is_jrt() { return ClassLoader::is_jrt(name()); } ! time_t timestamp() const { return _timestamp; } ! long filesize() const { return _filesize; } ! const char* name() const { return _name->data(); } ! const char* manifest() const { ! return (_manifest == NULL) ? NULL : (const char*)_manifest->data(); } ! int manifest_size() const { ! return (_manifest == NULL) ? 0 : _manifest->length(); } }; class FileMapInfo : public CHeapObj<mtInternal> { private: friend class ManifestStream; enum { _invalid_version = -1, ! _current_version = 3 }; bool _file_open; int _fd; size_t _file_offset; private: ! static Array<u8>* _classpath_entry_table; static int _classpath_entry_table_size; static size_t _classpath_entry_size; static bool _validating_classpath_entry_table; // FileMapHeader describes the shared space data in the file to be
*** 105,126 **** uintx _max_heap_size; // java max heap size during dumping Universe::NARROW_OOP_MODE _narrow_oop_mode; // compressed oop encoding mode int _narrow_klass_shift; // save narrow klass base and shift address _narrow_klass_base; char* _misc_data_patching_start; address _cds_i2i_entry_code_buffers; size_t _cds_i2i_entry_code_buffers_size; 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 string space } _addr; - size_t _capacity; // for validity checking 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]; --- 114,137 ---- uintx _max_heap_size; // java max heap size during dumping Universe::NARROW_OOP_MODE _narrow_oop_mode; // compressed oop encoding mode int _narrow_klass_shift; // save narrow klass base and shift address _narrow_klass_base; char* _misc_data_patching_start; + 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 string 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];
*** 153,163 **** // FIXME -- if JAR files in the tail of the list were specified but not used during dumping, // they should be removed from this table, to save space and to avoid spurious // loading failures during runtime. int _classpath_entry_table_size; size_t _classpath_entry_size; ! SharedClassPathEntry* _classpath_entry_table; char* region_addr(int idx); virtual bool validate(); virtual void populate(FileMapInfo* info, size_t alignment); --- 164,174 ---- // FIXME -- if JAR files in the tail of the list were specified but not used during dumping, // they should be removed from this table, to save space and to avoid spurious // loading failures during runtime. int _classpath_entry_table_size; size_t _classpath_entry_size; ! Array<u8>* _classpath_entry_table; char* region_addr(int idx); virtual bool validate(); virtual void populate(FileMapInfo* info, size_t alignment);
*** 172,181 **** --- 183,193 ---- static FileMapInfo* _current_info; bool init_from_file(int fd); void align_file_position(); bool validate_header_impl(); + static void metaspace_pointers_do(MetaspaceClosure* it); public: FileMapInfo(); ~FileMapInfo();
*** 190,203 **** Universe::NARROW_OOP_MODE narrow_oop_mode() { return _header->_narrow_oop_mode; } int narrow_oop_shift() { return _header->_narrow_oop_shift; } uintx max_heap_size() { return _header->_max_heap_size; } address narrow_klass_base() const { return _header->_narrow_klass_base; } int narrow_klass_shift() const { return _header->_narrow_klass_shift; } - size_t space_capacity(int i) { return _header->_space[i]._capacity; } struct FileMapHeader* header() { return _header; } char* misc_data_patching_start() { return _header->_misc_data_patching_start; } void set_misc_data_patching_start(char* p) { _header->_misc_data_patching_start = p; } address cds_i2i_entry_code_buffers() { return _header->_cds_i2i_entry_code_buffers; } void set_cds_i2i_entry_code_buffers(address addr) { --- 202,216 ---- Universe::NARROW_OOP_MODE narrow_oop_mode() { return _header->_narrow_oop_mode; } int narrow_oop_shift() { return _header->_narrow_oop_shift; } uintx max_heap_size() { return _header->_max_heap_size; } address narrow_klass_base() const { return _header->_narrow_klass_base; } int narrow_klass_shift() const { return _header->_narrow_klass_shift; } struct FileMapHeader* header() { return _header; } char* misc_data_patching_start() { return _header->_misc_data_patching_start; } void set_misc_data_patching_start(char* p) { _header->_misc_data_patching_start = p; } + char* read_only_tables_start() { return _header->_read_only_tables_start; } + void set_read_only_tables_start(char* p) { _header->_read_only_tables_start = p; } address cds_i2i_entry_code_buffers() { return _header->_cds_i2i_entry_code_buffers; } void set_cds_i2i_entry_code_buffers(address addr) {
*** 207,216 **** --- 220,231 ---- return _header->_cds_i2i_entry_code_buffers_size; } void set_cds_i2i_entry_code_buffers_size(size_t s) { _header->_cds_i2i_entry_code_buffers_size = s; } + void set_core_spaces_size(size_t s) { _header->_core_spaces_size = s; } + size_t core_spaces_size() { return _header->_core_spaces_size; } static FileMapInfo* current_info() { CDS_ONLY(return _current_info;) NOT_CDS(return NULL;) }
*** 220,232 **** // File manipulation. bool initialize() NOT_CDS_RETURN_(false); bool open_for_read(); void open_for_write(); void write_header(); - void write_space(int i, Metaspace* space, bool read_only); void write_region(int region, char* base, size_t size, ! size_t capacity, bool read_only, bool allow_exec); void write_string_regions(GrowableArray<MemRegion> *regions); void write_bytes(const void* buffer, int count); void write_bytes_aligned(const void* buffer, int count); char* map_region(int i); bool map_string_regions(); --- 235,246 ---- // File manipulation. bool initialize() NOT_CDS_RETURN_(false); bool open_for_read(); void open_for_write(); void write_header(); void write_region(int region, char* base, size_t size, ! bool read_only, bool allow_exec); void write_string_regions(GrowableArray<MemRegion> *regions); void write_bytes(const void* buffer, int count); void write_bytes_aligned(const void* buffer, int count); char* map_region(int i); bool map_string_regions();
*** 250,299 **** // Return true if given address is in the mapped shared space. bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); void print_shared_spaces() NOT_CDS_RETURN; - // The ro+rw+md+mc spaces size - static size_t core_spaces_size() { - return align_size_up((SharedReadOnlySize + SharedReadWriteSize + - SharedMiscDataSize + SharedMiscCodeSize), - os::vm_allocation_granularity()); - } - - // The estimated optional space size. - // - // Currently the optional space only has archived class bytes. - // The core_spaces_size is the size of all class metadata, which is a good - // estimate of the total class bytes to be archived. Only the portion - // containing data is written out to the archive and mapped at runtime. - // There is no memory waste due to unused portion in optional space. - static size_t optional_space_size() { - return core_spaces_size(); - } - - // Total shared_spaces size includes the ro, rw, md, mc and od spaces - static size_t shared_spaces_size() { - return core_spaces_size() + optional_space_size(); - } - // Stop CDS sharing and unmap CDS regions. static void stop_sharing_and_unmap(const char* msg); static void allocate_classpath_entry_table(); bool validate_classpath_entry_table(); static SharedClassPathEntry* shared_classpath(int index) { if (index < 0) { return NULL; } ! char* p = (char*)_classpath_entry_table; p += _classpath_entry_size * index; return (SharedClassPathEntry*)p; } static const char* shared_classpath_name(int index) { assert(index >= 0, "Sanity"); ! return shared_classpath(index)->_name; } static int get_number_of_share_classpaths() { return _classpath_entry_table_size; } --- 264,291 ---- // Return true if given address is in the mapped shared space. bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); void print_shared_spaces() NOT_CDS_RETURN; // Stop CDS sharing and unmap CDS regions. static void stop_sharing_and_unmap(const char* msg); static void allocate_classpath_entry_table(); bool validate_classpath_entry_table(); static SharedClassPathEntry* shared_classpath(int index) { if (index < 0) { return NULL; } ! assert(index < _classpath_entry_table_size, "sanity"); ! char* p = (char*)_classpath_entry_table->data(); p += _classpath_entry_size * index; return (SharedClassPathEntry*)p; } static const char* shared_classpath_name(int index) { assert(index >= 0, "Sanity"); ! return shared_classpath(index)->name(); } static int get_number_of_share_classpaths() { return _classpath_entry_table_size; }
< prev index next >