< prev index next > src/hotspot/share/cds/filemap.cpp
Print this page
#include "memory/oopFactory.hpp"
#include "memory/universe.hpp"
#include "nmt/memTracker.hpp"
#include "oops/compressedOops.hpp"
#include "oops/compressedOops.inline.hpp"
+ #include "oops/compressedKlass.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/globals_extension.hpp"
copy_base_archive_name(CDSConfig::static_archive_path());
}
_core_region_alignment = core_region_alignment;
_obj_alignment = ObjectAlignmentInBytes;
_compact_strings = CompactStrings;
+ _compact_headers = UseCompactObjectHeaders;
if (CDSConfig::is_dumping_heap()) {
_narrow_oop_mode = CompressedOops::mode();
_narrow_oop_base = CompressedOops::base();
_narrow_oop_shift = CompressedOops::shift();
}
_compressed_oops = UseCompressedOops;
_compressed_class_ptrs = UseCompressedClassPointers;
_use_secondary_supers_table = UseSecondarySupersTable;
+ if (UseCompressedClassPointers) {
+ #ifdef _LP64
+ _narrow_klass_pointer_bits = CompressedKlassPointers::narrow_klass_pointer_bits();
+ _narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift();
+ #endif
+ } else {
+ _narrow_klass_pointer_bits = _narrow_klass_shift = -1;
+ }
_max_heap_size = MaxHeapSize;
_use_optimized_module_handling = CDSConfig::is_using_optimized_module_handling();
_has_full_module_graph = CDSConfig::is_dumping_full_module_graph();
// The following fields are for sanity checks for whether this archive
st->print_cr("- obj_alignment: %d", _obj_alignment);
st->print_cr("- narrow_oop_base: " INTPTR_FORMAT, p2i(_narrow_oop_base));
st->print_cr("- narrow_oop_base: " INTPTR_FORMAT, p2i(_narrow_oop_base));
st->print_cr("- narrow_oop_shift %d", _narrow_oop_shift);
st->print_cr("- compact_strings: %d", _compact_strings);
+ st->print_cr("- compact_headers: %d", _compact_headers);
st->print_cr("- max_heap_size: " UINTX_FORMAT, _max_heap_size);
st->print_cr("- narrow_oop_mode: %d", _narrow_oop_mode);
st->print_cr("- compressed_oops: %d", _compressed_oops);
st->print_cr("- compressed_class_ptrs: %d", _compressed_class_ptrs);
st->print_cr("- use_secondary_supers_table: %d", _use_secondary_supers_table);
+ st->print_cr("- narrow_klass_pointer_bits: %d", _narrow_klass_pointer_bits);
+ st->print_cr("- narrow_klass_shift: %d", _narrow_klass_shift);
st->print_cr("- cloned_vtables_offset: " SIZE_FORMAT_X, _cloned_vtables_offset);
st->print_cr("- serialized_data_offset: " SIZE_FORMAT_X, _serialized_data_offset);
st->print_cr("- jvm_ident: %s", _jvm_ident);
st->print_cr("- shared_path_table_offset: " SIZE_FORMAT_X, _shared_path_table_offset);
st->print_cr("- app_class_paths_start_index: %d", _app_class_paths_start_index);
// because we won't install an archived object subgraph if the klass of any of the
// referenced objects are replaced. See HeapShared::initialize_from_archived_subgraph().
}
// We pre-compute narrow Klass IDs with the runtime mapping start intended to be the base, and a shift of
! // ArchiveHeapWriter::precomputed_narrow_klass_shift. We enforce this encoding at runtime (see
// CompressedKlassPointers::initialize_for_given_encoding()). Therefore, the following assertions must
// hold:
address archive_narrow_klass_base = (address)header()->mapped_base_address();
! const int archive_narrow_klass_shift = ArchiveHeapWriter::precomputed_narrow_klass_shift;
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 at mapping start address, narrow_klass_shift = %d",
! archive_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, G1HeapRegion::GrainBytes = " SIZE_FORMAT,
MaxHeapSize/M, G1HeapRegion::GrainBytes);
! log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d",
! p2i(CompressedKlassPointers::base()), CompressedKlassPointers::shift());
log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d",
CompressedOops::mode(), p2i(CompressedOops::base()), CompressedOops::shift());
log_info(cds)(" heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
UseCompressedOops ? p2i(CompressedOops::begin()) :
UseG1GC ? p2i((address)G1CollectedHeap::heap()->reserved().start()) : 0L,
UseCompressedOops ? p2i(CompressedOops::end()) :
UseG1GC ? p2i((address)G1CollectedHeap::heap()->reserved().end()) : 0L);
! assert(archive_narrow_klass_base == CompressedKlassPointers::base(), "Unexpected encoding base encountered "
! "(" PTR_FORMAT ", expected " PTR_FORMAT ")", p2i(CompressedKlassPointers::base()), p2i(archive_narrow_klass_base));
! assert(archive_narrow_klass_shift == CompressedKlassPointers::shift(), "Unexpected encoding shift encountered "
! "(%d, expected %d)", CompressedKlassPointers::shift(), archive_narrow_klass_shift);
return true;
}
// The actual address of this region during dump time.
// because we won't install an archived object subgraph if the klass of any of the
// referenced objects are replaced. See HeapShared::initialize_from_archived_subgraph().
}
// We pre-compute narrow Klass IDs with the runtime mapping start intended to be the base, and a shift of
! // ArchiveBuilder::precomputed_narrow_klass_shift. We enforce this encoding at runtime (see
// CompressedKlassPointers::initialize_for_given_encoding()). Therefore, the following assertions must
// hold:
address archive_narrow_klass_base = (address)header()->mapped_base_address();
! const int archive_narrow_klass_pointer_bits = header()->narrow_klass_pointer_bits();
+ const int archive_narrow_klass_shift = header()->narrow_klass_shift();
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 at mapping start address, narrow_klass_pointer_bits = %d, narrow_klass_shift = %d",
! archive_narrow_klass_pointer_bits, archive_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, G1HeapRegion::GrainBytes = " SIZE_FORMAT,
MaxHeapSize/M, G1HeapRegion::GrainBytes);
! log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", arrow_klass_pointer_bits = %d, narrow_klass_shift = %d",
! p2i(CompressedKlassPointers::base()), CompressedKlassPointers::narrow_klass_pointer_bits(), CompressedKlassPointers::shift());
log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d",
CompressedOops::mode(), p2i(CompressedOops::base()), CompressedOops::shift());
log_info(cds)(" heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
UseCompressedOops ? p2i(CompressedOops::begin()) :
UseG1GC ? p2i((address)G1CollectedHeap::heap()->reserved().start()) : 0L,
UseCompressedOops ? p2i(CompressedOops::end()) :
UseG1GC ? p2i((address)G1CollectedHeap::heap()->reserved().end()) : 0L);
! int err = 0;
! if ( archive_narrow_klass_base != CompressedKlassPointers::base() ||
! (err = 1, archive_narrow_klass_pointer_bits != CompressedKlassPointers::narrow_klass_pointer_bits()) ||
! (err = 2, archive_narrow_klass_shift != CompressedKlassPointers::shift()) ) {
+ stringStream ss;
+ switch (err) {
+ case 0:
+ ss.print("Unexpected encoding base encountered (" PTR_FORMAT ", expected " PTR_FORMAT ")",
+ p2i(CompressedKlassPointers::base()), p2i(archive_narrow_klass_base));
+ break;
+ case 1:
+ ss.print("Unexpected narrow Klass bit length encountered (%d, expected %d)",
+ CompressedKlassPointers::narrow_klass_pointer_bits(), archive_narrow_klass_pointer_bits);
+ break;
+ case 2:
+ ss.print("Unexpected narrow Klass shift encountered (%d, expected %d)",
+ CompressedKlassPointers::shift(), archive_narrow_klass_shift);
+ break;
+ default:
+ ShouldNotReachHere();
+ };
+ LogTarget(Info, cds) lt;
+ if (lt.is_enabled()) {
+ LogStream ls(lt);
+ ls.print_raw(ss.base());
+ header()->print(&ls);
+ }
+ assert(false, "%s", ss.base());
+ }
return true;
}
// The actual address of this region during dump time.
if (! _use_secondary_supers_table && UseSecondarySupersTable) {
log_warning(cds)("The shared archive was created without UseSecondarySupersTable.");
return false;
}
+ if (compact_headers() != UseCompactObjectHeaders) {
+ log_info(cds)("The shared archive file's UseCompactObjectHeaders setting (%s)"
+ " does not equal the current UseCompactObjectHeaders setting (%s).",
+ _compact_headers ? "enabled" : "disabled",
+ UseCompactObjectHeaders ? "enabled" : "disabled");
+ return false;
+ }
+
if (!_use_optimized_module_handling) {
CDSConfig::stop_using_optimized_module_handling();
log_info(cds)("optimized module handling: disabled because archive was created without optimized module handling");
}
< prev index next >