< prev index next >

src/hotspot/share/memory/filemap.cpp

Print this page

*** 190,204 **** _narrow_klass_base = Universe::narrow_klass_base(); _narrow_klass_shift = Universe::narrow_klass_shift(); _shared_path_table_size = mapinfo->_shared_path_table_size; _shared_path_table = mapinfo->_shared_path_table; _shared_path_entry_size = mapinfo->_shared_path_entry_size; - #if INCLUDE_CDS_JAVA_HEAP if (MetaspaceShared::is_heap_object_archiving_allowed()) { ! _g1_reserved = G1CollectedHeap::heap()->g1_reserved(); } - #endif // The following fields are for sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's // invoked with. --- 190,202 ---- _narrow_klass_base = Universe::narrow_klass_base(); _narrow_klass_shift = Universe::narrow_klass_shift(); _shared_path_table_size = mapinfo->_shared_path_table_size; _shared_path_table = mapinfo->_shared_path_table; _shared_path_entry_size = mapinfo->_shared_path_entry_size; if (MetaspaceShared::is_heap_object_archiving_allowed()) { ! _heap_reserved = Universe::heap()->reserved_region(); } // The following fields are for sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's // invoked with.
*** 853,863 **** *top_ret = base + size; return base; } - address FileMapInfo::FileMapHeader::space_info::decode_start_address(bool with_current_oop_encoding_mode) { if (with_current_oop_encoding_mode) { return (address)CompressedOops::decode_not_null(offset()); } else { return (address)HeapShared::decode_with_archived_oop_encoding_mode(offset()); --- 851,860 ----
*** 872,883 **** #if INCLUDE_CDS_JAVA_HEAP bool FileMapInfo::has_heap_regions() { return (_header->_space[MetaspaceShared::first_string]._used > 0); } ! // Returns the address range where the heap regions would occupy using the ! // current oop encoding mode. MemRegion FileMapInfo::get_heap_regions_range_with_current_oop_encoding_mode() { address start = (address) max_uintx; address end = NULL; for (int i = MetaspaceShared::first_string; i <= MetaspaceShared::last_valid_region; i++) { --- 869,882 ---- #if INCLUDE_CDS_JAVA_HEAP bool FileMapInfo::has_heap_regions() { return (_header->_space[MetaspaceShared::first_string]._used > 0); } ! // Returns the address range of the archived heap regions computed using the ! // current oop encoding mode. This range may be different than the one seen at ! // dump time due to encoding mode differences. The result is used in determining ! // if/how these regions should be relocated at run time. MemRegion FileMapInfo::get_heap_regions_range_with_current_oop_encoding_mode() { address start = (address) max_uintx; address end = NULL; for (int i = MetaspaceShared::first_string; i <= MetaspaceShared::last_valid_region; i++) {
*** 900,912 **** // // Map the shared string objects and open archive heap objects to the runtime // java heap. // ! // The shared strings are mapped near the runtime java heap top. The ! // mapped strings contain no out-going references to any other java heap ! // regions. GC does not write into the mapped shared strings. // // The open archive heap objects are mapped below the shared strings in // the runtime java heap. The mapped open archive heap data only contain // references to the shared strings and open archive objects initially. // During runtime execution, out-going references to any other java heap --- 899,911 ---- // // Map the shared string objects and open archive heap objects to the runtime // java heap. // ! // The shared strings are mapped close to the end of the java heap top in ! // closed archive regions. The mapped strings contain no out-going references ! // to any other java heap regions. GC does not write into the mapped shared strings. // // The open archive heap objects are mapped below the shared strings in // the runtime java heap. The mapped open archive heap data only contain // references to the shared strings and open archive objects initially. // During runtime execution, out-going references to any other java heap
*** 917,959 **** log_info(cds)("CDS heap data is being ignored. UseG1GC, " "UseCompressedOops and UseCompressedClassPointers are required."); return; } ! MemRegion g1_reserved = G1CollectedHeap::heap()->g1_reserved(); ! log_info(cds)("CDS archive was created with max heap size = " UINTX_FORMAT "M, and the following configuration:", max_heap_size()/M); log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d", p2i(narrow_klass_base()), narrow_klass_shift()); log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d", narrow_oop_mode(), p2i(narrow_oop_base()), narrow_oop_shift()); ! log_info(cds)("The current max heap size = " UINTX_FORMAT "M, HeapRegion::GrainBytes = " UINTX_FORMAT, ! g1_reserved.byte_size()/M, HeapRegion::GrainBytes); log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d", p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift()); log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d", Universe::narrow_oop_mode(), p2i(Universe::narrow_oop_base()), Universe::narrow_oop_shift()); if (narrow_klass_base() != Universe::narrow_klass_base() || narrow_klass_shift() != Universe::narrow_klass_shift()) { ! log_info(cds)("CDS heap data cannot be used because the archive was created with an incompatible heap size."); return; } if (narrow_oop_mode() != Universe::narrow_oop_mode() || narrow_oop_base() != Universe::narrow_oop_base() || narrow_oop_shift() != Universe::narrow_oop_shift()) { ! log_info(cds)("CDS heap data need to be relocated because the archive was created with an incompatible heap size."); _heap_pointers_need_patching = true; } else { MemRegion range = get_heap_regions_range_with_current_oop_encoding_mode(); ! if (!g1_reserved.contains(range)) { log_info(cds)("CDS heap data need to be relocated because"); log_info(cds)("the desired range " PTR_FORMAT " - " PTR_FORMAT, p2i(range.start()), p2i(range.end())); ! log_info(cds)("is outside of the heap " PTR_FORMAT " - " PTR_FORMAT, p2i(g1_reserved.start()), p2i(g1_reserved.end())); _heap_pointers_need_patching = true; } } ptrdiff_t delta = 0; --- 916,958 ---- log_info(cds)("CDS heap data is being ignored. UseG1GC, " "UseCompressedOops and UseCompressedClassPointers are required."); return; } ! MemRegion heap_reserved = Universe::heap()->reserved_region(); ! log_info(cds)("CDS archive was created with max heap size = " SIZE_FORMAT "M, and the following configuration:", max_heap_size()/M); log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d", p2i(narrow_klass_base()), narrow_klass_shift()); log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d", narrow_oop_mode(), p2i(narrow_oop_base()), narrow_oop_shift()); ! log_info(cds)("The current max heap size = " SIZE_FORMAT "M, HeapRegion::GrainBytes = " SIZE_FORMAT, ! heap_reserved.byte_size()/M, HeapRegion::GrainBytes); log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d", p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift()); log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d", Universe::narrow_oop_mode(), p2i(Universe::narrow_oop_base()), Universe::narrow_oop_shift()); if (narrow_klass_base() != Universe::narrow_klass_base() || narrow_klass_shift() != Universe::narrow_klass_shift()) { ! log_info(cds)("CDS heap data cannot be used because the archive was created with an incompatible oop encoding mode."); return; } if (narrow_oop_mode() != Universe::narrow_oop_mode() || narrow_oop_base() != Universe::narrow_oop_base() || narrow_oop_shift() != Universe::narrow_oop_shift()) { ! log_info(cds)("CDS heap data need to be relocated because the archive was created with an incompatible oop encoding mode."); _heap_pointers_need_patching = true; } else { MemRegion range = get_heap_regions_range_with_current_oop_encoding_mode(); ! if (!heap_reserved.contains(range)) { log_info(cds)("CDS heap data need to be relocated because"); log_info(cds)("the desired range " PTR_FORMAT " - " PTR_FORMAT, p2i(range.start()), p2i(range.end())); ! log_info(cds)("is outside of the heap " PTR_FORMAT " - " PTR_FORMAT, p2i(heap_reserved.start()), p2i(heap_reserved.end())); _heap_pointers_need_patching = true; } } ptrdiff_t delta = 0;
*** 965,976 **** // // At dump time, the archived heap regions were near the top of the heap. // At run time, they may not be inside the heap, so we move them so // that they are now near the top of the runtime time. This can be done by // the simple math of adding the delta as shown above. ! address dumptime_heap_end = (address)_header->_g1_reserved.end(); ! address runtime_heap_end = (address)g1_reserved.end(); delta = runtime_heap_end - dumptime_heap_end; } log_info(cds)("CDS heap data relocation delta = " INTX_FORMAT " bytes", delta); HeapShared::init_narrow_oop_decoding(narrow_oop_base() + delta, narrow_oop_shift()); --- 964,975 ---- // // At dump time, the archived heap regions were near the top of the heap. // At run time, they may not be inside the heap, so we move them so // that they are now near the top of the runtime time. This can be done by // the simple math of adding the delta as shown above. ! address dumptime_heap_end = (address)_header->_heap_reserved.end(); ! address runtime_heap_end = (address)heap_reserved.end(); delta = runtime_heap_end - dumptime_heap_end; } log_info(cds)("CDS heap data relocation delta = " INTX_FORMAT " bytes", delta); HeapShared::init_narrow_oop_decoding(narrow_oop_base() + delta, narrow_oop_shift());
*** 983,993 **** // the same G1 region. Otherwise we will fail to map the open regions. size_t align = size_t(relocated_strings_bottom) % HeapRegion::GrainBytes; delta -= align; assert(is_aligned(relocated_strings_bottom + delta, HeapRegion::GrainBytes), "must be"); ! log_info(cds)("CDS heap data need to be relocated lower by a further " UINTX_FORMAT " bytes to be aligned with HeapRegion::GrainBytes", align); HeapShared::init_narrow_oop_decoding(narrow_oop_base() + delta, narrow_oop_shift()); _heap_pointers_need_patching = true; } --- 982,992 ---- // the same G1 region. Otherwise we will fail to map the open regions. size_t align = size_t(relocated_strings_bottom) % HeapRegion::GrainBytes; delta -= align; assert(is_aligned(relocated_strings_bottom + delta, HeapRegion::GrainBytes), "must be"); ! log_info(cds)("CDS heap data need to be relocated lower by a further " SIZE_FORMAT " bytes to be aligned with HeapRegion::GrainBytes", align); HeapShared::init_narrow_oop_decoding(narrow_oop_base() + delta, narrow_oop_shift()); _heap_pointers_need_patching = true; }
*** 1037,1048 **** size_t size = si->_used; if (size > 0) { HeapWord* start = (HeapWord*)si->start_address_with_archived_oop_encoding_mode(); regions[region_num] = MemRegion(start, size / HeapWordSize); region_num ++; ! log_info(cds)("Trying to map heap data: region[%d] at " INTPTR_FORMAT ", size = %8d bytes", ! i, p2i(start), int(size)); } } if (region_num == 0) { return false; // no archived java heap data --- 1036,1047 ---- size_t size = si->_used; if (size > 0) { HeapWord* start = (HeapWord*)si->start_address_with_archived_oop_encoding_mode(); regions[region_num] = MemRegion(start, size / HeapWordSize); region_num ++; ! log_info(cds)("Trying to map heap data: region[%d] at " INTPTR_FORMAT ", size = " SIZE_FORMAT_W(8) " bytes", ! i, p2i(start), size); } } if (region_num == 0) { return false; // no archived java heap data
*** 1072,1082 **** si->_allow_exec); if (base == NULL || base != addr) { // dealloc the regions from java heap dealloc_archive_heap_regions(regions, region_num); log_info(cds)("UseSharedSpaces: Unable to map at required address in java heap. " ! INTPTR_FORMAT ", size = " UINTX_FORMAT " bytes", p2i(addr), regions[i].byte_size()); return false; } } --- 1071,1081 ---- si->_allow_exec); if (base == NULL || base != addr) { // dealloc the regions from java heap dealloc_archive_heap_regions(regions, region_num); log_info(cds)("UseSharedSpaces: Unable to map at required address in java heap. " ! INTPTR_FORMAT ", size = " SIZE_FORMAT " bytes", p2i(addr), regions[i].byte_size()); return false; } }
< prev index next >