< prev index next > src/hotspot/share/cds/filemap.cpp
Print this page
#ifndef O_BINARY // if defined (Win32) use binary files.
#define O_BINARY 0 // otherwise do nothing.
#endif
+ inline void CDSMustMatchFlags::do_print(outputStream* st, bool v) {
+ st->print("%s", v ? "true" : "false");
+ }
+
+ inline void CDSMustMatchFlags::do_print(outputStream* st, intx v) {
+ st->print(INTX_FORMAT, v);
+ }
+
+ inline void CDSMustMatchFlags::do_print(outputStream* st, uintx v) {
+ st->print(UINTX_FORMAT, v);
+ }
+
+ inline void CDSMustMatchFlags::do_print(outputStream* st, double v) {
+ st->print("%f", v);
+ }
+
+ void CDSMustMatchFlags::init() {
+ Arguments::assert_is_dumping_archive();
+ _max_name_width = 0;
+
+ #define INIT_CDS_MUST_MATCH_FLAG(n) \
+ _v_##n = n; \
+ _max_name_width = MAX2(_max_name_width,strlen(#n));
+ CDS_MUST_MATCH_FLAGS_DO(INIT_CDS_MUST_MATCH_FLAG);
+ #undef INIT_CDS_MUST_MATCH_FLAG
+ }
+
+ bool CDSMustMatchFlags::runtime_check() const {
+ #define CHECK_CDS_MUST_MATCH_FLAG(n) \
+ if (_v_##n != n) { \
+ ResourceMark rm; \
+ stringStream ss; \
+ ss.print("VM option %s is different between dumptime (", #n); \
+ do_print(&ss, _v_ ## n); \
+ ss.print(") and runtime ("); \
+ do_print(&ss, n); \
+ ss.print(")"); \
+ log_info(cds)("%s", ss.as_string()); \
+ return false; \
+ }
+ CDS_MUST_MATCH_FLAGS_DO(CHECK_CDS_MUST_MATCH_FLAG);
+ #undef CHECK_CDS_MUST_MATCH_FLAG
+
+ return true;
+ }
+
+ void CDSMustMatchFlags::print_info() const {
+ LogTarget(Info, cds) lt;
+ if (lt.is_enabled()) {
+ LogStream ls(lt);
+ ls.print_cr("Recorded VM flags during dumptime:");
+ print(&ls);
+ }
+ }
+
+ void CDSMustMatchFlags::print(outputStream* st) const {
+ #define PRINT_CDS_MUST_MATCH_FLAG(n) \
+ st->print("- %-s ", #n); \
+ st->sp(int(_max_name_width - strlen(#n))); \
+ do_print(st, _v_##n); \
+ st->cr();
+ CDS_MUST_MATCH_FLAGS_DO(PRINT_CDS_MUST_MATCH_FLAG);
+ #undef PRINT_CDS_MUST_MATCH_FLAG
+ }
+
// Fill in the fileMapInfo structure with data about this VM instance.
// This method copies the vm version info into header_version. If the version is too
// long then a truncated version, which has a hash code appended to it, is copied.
//
_has_platform_or_app_classes = ClassLoaderExt::has_platform_or_app_classes();
_has_non_jar_in_classpath = ClassLoaderExt::has_non_jar_in_classpath();
_requested_base_address = (char*)SharedBaseAddress;
_mapped_base_address = (char*)SharedBaseAddress;
_allow_archiving_with_java_agent = AllowArchivingWithJavaAgent;
+ _must_match.init();
if (!DynamicDumpSharedSpaces) {
set_shared_path_table(info->_shared_path_table);
}
}
st->print_cr("- heap_roots_offset: " SIZE_FORMAT, _heap_roots_offset);
st->print_cr("- allow_archiving_with_java_agent:%d", _allow_archiving_with_java_agent);
st->print_cr("- use_optimized_module_handling: %d", _use_optimized_module_handling);
st->print_cr("- use_full_module_graph %d", _use_full_module_graph);
st->print_cr("- ptrmap_size_in_bits: " SIZE_FORMAT, _ptrmap_size_in_bits);
+ _must_match.print(st);
}
void SharedClassPathEntry::init_as_non_existent(const char* path, TRAPS) {
_type = non_existent_entry;
set_name(path, CHECK);
log_warning(cds)("The shared archive file has been truncated.");
return false;
}
}
+ if (!header()->check_must_match_flags()) {
+ return false;
+ }
+
return true;
}
void FileMapInfo::seek_to_position(size_t pos) {
if (os::lseek(_fd, (long)pos, SEEK_SET) < 0) {
< prev index next >