< prev index next >
src/share/vm/memory/filemap.cpp
Print this page
*** 705,720 ****
--- 705,724 ----
char* addr = (char*)string_ranges[i].start();
char* base = os::map_memory(_fd, _full_path, si->_file_offset,
addr, string_ranges[i].byte_size(), si->_read_only,
si->_allow_exec);
if (base == NULL || base != addr) {
+ // dealloc the string regions from java heap
+ dealloc_string_regions();
fail_continue("Unable to map shared string space at required address.");
return false;
}
}
if (!verify_string_regions()) {
+ // dealloc the string regions from java heap
+ dealloc_string_regions();
fail_continue("Shared string regions are corrupt");
return false;
}
// the shared string data is mapped successfully
*** 743,758 ****
--- 747,764 ----
}
return true;
}
void FileMapInfo::fixup_string_regions() {
+ #if INCLUDE_ALL_GCS
// If any string regions were found, call the fill routine to make them parseable.
// Note that string_ranges may be non-NULL even if no ranges were found.
if (num_ranges != 0) {
assert(string_ranges != NULL, "Null string_ranges array with non-zero count");
G1CollectedHeap::heap()->fill_archive_regions(string_ranges, num_ranges);
}
+ #endif
}
bool FileMapInfo::verify_region_checksum(int i) {
if (!VerifySharedSpaces) {
return true;
*** 791,814 ****
if (!os::unmap_memory(addr, size)) {
fail_stop("Unable to unmap shared space.");
}
}
! void FileMapInfo::unmap_string_regions() {
! for (int i = MetaspaceShared::first_string;
! i < MetaspaceShared::first_string + MetaspaceShared::max_strings; i++) {
! struct FileMapInfo::FileMapHeader::space_info* si = &_header->_space[i];
! size_t used = si->_used;
! if (used > 0) {
! size_t size = align_size_up(used, os::vm_allocation_granularity());
! char* addr = (char*)((void*)oopDesc::decode_heap_oop_not_null(
! (narrowOop)si->_addr._offset));
! if (!os::unmap_memory(addr, size)) {
! fail_stop("Unable to unmap shared space.");
! }
! }
}
}
void FileMapInfo::assert_mark(bool check) {
if (!check) {
fail_stop("Mark mismatch while restoring from shared file.");
--- 797,814 ----
if (!os::unmap_memory(addr, size)) {
fail_stop("Unable to unmap shared space.");
}
}
! // dealloc the archived string region from java heap
! void FileMapInfo::dealloc_string_regions() {
! #if INCLUDE_ALL_GCS
! if (num_ranges > 0) {
! assert(string_ranges != NULL, "Null string_ranges array with non-zero count");
! G1CollectedHeap::heap()->dealloc_archive_regions(string_ranges, num_ranges);
}
+ #endif
}
void FileMapInfo::assert_mark(bool check) {
if (!check) {
fail_stop("Mark mismatch while restoring from shared file.");
*** 965,974 ****
if (addr != NULL && !MetaspaceShared::is_string_region(i)) {
map_info->unmap_region(i);
map_info->_header->_space[i]._addr._base = NULL;
}
}
! map_info->unmap_string_regions();
} else if (DumpSharedSpaces) {
fail_stop("%s", msg);
}
}
--- 965,976 ----
if (addr != NULL && !MetaspaceShared::is_string_region(i)) {
map_info->unmap_region(i);
map_info->_header->_space[i]._addr._base = NULL;
}
}
! // Dealloc the string regions only without unmapping. The string regions are part
! // of the java heap. Unmapping of the heap regions are managed by GC.
! map_info->dealloc_string_regions();
} else if (DumpSharedSpaces) {
fail_stop("%s", msg);
}
}
< prev index next >