< prev index next >
src/hotspot/share/memory/filemap.hpp
Print this page
*** 85,101 ****
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;
--- 85,106 ----
void set_manifest(Array<u1>* manifest) {
_manifest = manifest;
}
};
+ struct ArchiveHeapOopmapInfo {
+ address _oopmap; // bitmap for relocating embedded oops
+ size_t _oopmap_size_in_bits;
+ };
+
class FileMapInfo : public CHeapObj<mtInternal> {
private:
friend class ManifestStream;
friend class VMStructs;
enum {
_invalid_version = -1,
! _current_version = 4
};
bool _file_open;
int _fd;
size_t _file_offset;
*** 114,133 ****
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
--- 119,141 ----
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);
}
! FileMapHeader() {
! memset(data(), 0, data_size());
! }
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
*** 142,151 ****
--- 150,160 ----
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).
+ MemRegion _g1_reserved; // reserved region at dump time.
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
*** 153,162 ****
--- 162,188 ----
// 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?
+ address _oopmap; // bitmap for relocating embedded oops
+ size_t _oopmap_size_in_bits;
+ narrowOop offset() {
+ return (narrowOop)_addr._offset;
+ }
+
+ // The starting address, as calculated with CompressedOop::decode_non_null()
+ address start_address_with_current_oop_encoding_mode() {
+ return decode_start_address(true);
+ }
+
+ // The starting address, as calculated with HeapShared::decode_with_archived_oop_encoding_mode()
+ address start_address_with_archived_oop_encoding_mode() {
+ return decode_start_address(false);
+ }
+ private:
+ address decode_start_address(bool with_current_oop_encoding_mode);
} _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.
*** 212,221 ****
--- 238,248 ----
const char* _full_path;
char* _paths_misc_info;
static FileMapInfo* _current_info;
+ static bool _heap_pointers_need_patching;
bool init_from_file(int fd);
void align_file_position();
bool validate_header_impl();
static void metaspace_pointers_do(MetaspaceClosure* it);
*** 272,287 ****
--- 299,321 ----
void open_for_write();
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,
+ GrowableArray<ArchiveHeapOopmapInfo> *oopmaps,
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_impl() NOT_CDS_JAVA_HEAP_RETURN;
void map_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
void fixup_mapped_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
+ void patch_archived_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
+ void patch_archived_heap_embedded_pointers(MemRegion* ranges, int num_ranges,
+ int first_region_idx) NOT_CDS_JAVA_HEAP_RETURN;
+ bool has_heap_regions() NOT_CDS_JAVA_HEAP_RETURN;
+ MemRegion get_heap_regions_range_with_current_oop_encoding_mode();
void unmap_region(int i);
bool verify_region_checksum(int i);
void close();
bool is_open() { return _file_open; }
ReservedSpace reserve_shared_memory();
*** 293,303 ****
// Errors.
static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
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_shared_path_table();
--- 327,336 ----
*** 327,334 ****
--- 360,372 ----
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) NOT_CDS_JAVA_HEAP_RETURN;
+
+ FileMapHeader::space_info* space_at(int i) {
+ assert(i >= 0 && i <= MetaspaceShared::last_valid_region, "invalid region");
+ return &_header->_space[i];
+ }
};
#endif // SHARE_VM_MEMORY_FILEMAP_HPP
< prev index next >