mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 17:14:41 +02:00
8319944: Remove DynamicDumpSharedSpaces
Reviewed-by: dholmes, ccheung, matsaave
This commit is contained in:
parent
c0507af5a4
commit
115b0744c6
15 changed files with 52 additions and 50 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include "cds/archiveBuilder.hpp"
|
#include "cds/archiveBuilder.hpp"
|
||||||
#include "cds/archiveHeapWriter.hpp"
|
#include "cds/archiveHeapWriter.hpp"
|
||||||
#include "cds/archiveUtils.hpp"
|
#include "cds/archiveUtils.hpp"
|
||||||
|
#include "cds/cdsConfig.hpp"
|
||||||
#include "cds/cppVtables.hpp"
|
#include "cds/cppVtables.hpp"
|
||||||
#include "cds/dumpAllocStats.hpp"
|
#include "cds/dumpAllocStats.hpp"
|
||||||
#include "cds/dynamicArchive.hpp"
|
#include "cds/dynamicArchive.hpp"
|
||||||
|
@ -515,7 +516,7 @@ bool ArchiveBuilder::is_excluded(Klass* klass) {
|
||||||
Klass* bottom = ObjArrayKlass::cast(klass)->bottom_klass();
|
Klass* bottom = ObjArrayKlass::cast(klass)->bottom_klass();
|
||||||
if (MetaspaceShared::is_shared_static(bottom)) {
|
if (MetaspaceShared::is_shared_static(bottom)) {
|
||||||
// The bottom class is in the static archive so it's clearly not excluded.
|
// The bottom class is in the static archive so it's clearly not excluded.
|
||||||
assert(DynamicDumpSharedSpaces, "sanity");
|
assert(CDSConfig::is_dumping_dynamic_archive(), "sanity");
|
||||||
return false;
|
return false;
|
||||||
} else if (bottom->is_instance_klass()) {
|
} else if (bottom->is_instance_klass()) {
|
||||||
return SystemDictionaryShared::is_excluded_class(InstanceKlass::cast(bottom));
|
return SystemDictionaryShared::is_excluded_class(InstanceKlass::cast(bottom));
|
||||||
|
@ -743,7 +744,7 @@ void ArchiveBuilder::make_klasses_shareable() {
|
||||||
assert(k->is_instance_klass(), " must be");
|
assert(k->is_instance_klass(), " must be");
|
||||||
num_instance_klasses ++;
|
num_instance_klasses ++;
|
||||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
InstanceKlass* ik = InstanceKlass::cast(k);
|
||||||
if (DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
// For static dump, class loader type are already set.
|
// For static dump, class loader type are already set.
|
||||||
ik->assign_class_loader_type();
|
ik->assign_class_loader_type();
|
||||||
}
|
}
|
||||||
|
@ -816,7 +817,7 @@ uintx ArchiveBuilder::buffer_to_offset(address p) const {
|
||||||
|
|
||||||
uintx ArchiveBuilder::any_to_offset(address p) const {
|
uintx ArchiveBuilder::any_to_offset(address p) const {
|
||||||
if (is_in_mapped_static_archive(p)) {
|
if (is_in_mapped_static_archive(p)) {
|
||||||
assert(DynamicDumpSharedSpaces, "must be");
|
assert(CDSConfig::is_dumping_dynamic_archive(), "must be");
|
||||||
return p - _mapped_static_archive_bottom;
|
return p - _mapped_static_archive_bottom;
|
||||||
}
|
}
|
||||||
if (!is_in_buffer_space(p)) {
|
if (!is_in_buffer_space(p)) {
|
||||||
|
@ -924,7 +925,7 @@ void ArchiveBuilder::relocate_to_requested() {
|
||||||
RelocateBufferToRequested<true> patcher(this);
|
RelocateBufferToRequested<true> patcher(this);
|
||||||
patcher.doit();
|
patcher.doit();
|
||||||
} else {
|
} else {
|
||||||
assert(DynamicDumpSharedSpaces, "must be");
|
assert(CDSConfig::is_dumping_dynamic_archive(), "must be");
|
||||||
_requested_dynamic_archive_top = _requested_dynamic_archive_bottom + my_archive_size;
|
_requested_dynamic_archive_top = _requested_dynamic_archive_bottom + my_archive_size;
|
||||||
RelocateBufferToRequested<false> patcher(this);
|
RelocateBufferToRequested<false> patcher(this);
|
||||||
patcher.doit();
|
patcher.doit();
|
||||||
|
|
|
@ -26,18 +26,12 @@
|
||||||
#include "cds/cdsConfig.hpp"
|
#include "cds/cdsConfig.hpp"
|
||||||
#include "cds/heapShared.hpp"
|
#include "cds/heapShared.hpp"
|
||||||
|
|
||||||
bool CDSConfig::is_dumping_archive() {
|
bool CDSConfig::_is_dumping_dynamic_archive = false;
|
||||||
return is_dumping_static_archive() || is_dumping_dynamic_archive();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CDSConfig::is_dumping_static_archive() {
|
bool CDSConfig::is_dumping_static_archive() {
|
||||||
return DumpSharedSpaces;
|
return DumpSharedSpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDSConfig::is_dumping_dynamic_archive() {
|
|
||||||
return DynamicDumpSharedSpaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if INCLUDE_CDS_JAVA_HEAP
|
#if INCLUDE_CDS_JAVA_HEAP
|
||||||
bool CDSConfig::is_dumping_heap() {
|
bool CDSConfig::is_dumping_heap() {
|
||||||
// heap dump is not supported in dynamic dump
|
// heap dump is not supported in dynamic dump
|
||||||
|
|
|
@ -29,11 +29,17 @@
|
||||||
#include "utilities/macros.hpp"
|
#include "utilities/macros.hpp"
|
||||||
|
|
||||||
class CDSConfig : public AllStatic {
|
class CDSConfig : public AllStatic {
|
||||||
|
#if INCLUDE_CDS
|
||||||
|
static bool _is_dumping_dynamic_archive;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Basic CDS features
|
// Basic CDS features
|
||||||
static bool is_dumping_archive() NOT_CDS_RETURN_(false);
|
static bool is_dumping_archive() { return is_dumping_static_archive() || is_dumping_dynamic_archive(); }
|
||||||
static bool is_dumping_static_archive() NOT_CDS_RETURN_(false);
|
static bool is_dumping_static_archive() NOT_CDS_RETURN_(false);
|
||||||
static bool is_dumping_dynamic_archive() NOT_CDS_RETURN_(false);
|
static bool is_dumping_dynamic_archive() { return CDS_ONLY(_is_dumping_dynamic_archive) NOT_CDS(false); }
|
||||||
|
static void enable_dumping_dynamic_archive() { CDS_ONLY(_is_dumping_dynamic_archive = true); }
|
||||||
|
static void disable_dumping_dynamic_archive() { CDS_ONLY(_is_dumping_dynamic_archive = false); }
|
||||||
|
|
||||||
// CDS archived heap
|
// CDS archived heap
|
||||||
static bool is_dumping_heap() NOT_CDS_JAVA_HEAP_RETURN_(false);
|
static bool is_dumping_heap() NOT_CDS_JAVA_HEAP_RETURN_(false);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "cds/archiveHeapWriter.hpp"
|
#include "cds/archiveHeapWriter.hpp"
|
||||||
#include "cds/archiveUtils.inline.hpp"
|
#include "cds/archiveUtils.inline.hpp"
|
||||||
#include "cds/cds_globals.hpp"
|
#include "cds/cds_globals.hpp"
|
||||||
|
#include "cds/cdsConfig.hpp"
|
||||||
#include "cds/classPrelinker.hpp"
|
#include "cds/classPrelinker.hpp"
|
||||||
#include "cds/dynamicArchive.hpp"
|
#include "cds/dynamicArchive.hpp"
|
||||||
#include "cds/regeneratedClasses.hpp"
|
#include "cds/regeneratedClasses.hpp"
|
||||||
|
@ -409,7 +410,7 @@ void DynamicArchive::append_array_klass(ObjArrayKlass* ak) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicArchive::dump_array_klasses() {
|
void DynamicArchive::dump_array_klasses() {
|
||||||
assert(DynamicDumpSharedSpaces, "DynamicDumpSharedSpaces only");
|
assert(CDSConfig::is_dumping_dynamic_archive(), "sanity");
|
||||||
if (_array_klasses != nullptr) {
|
if (_array_klasses != nullptr) {
|
||||||
ArchiveBuilder* builder = ArchiveBuilder::current();
|
ArchiveBuilder* builder = ArchiveBuilder::current();
|
||||||
int num_array_klasses = _array_klasses->length();
|
int num_array_klasses = _array_klasses->length();
|
||||||
|
@ -469,7 +470,7 @@ int DynamicArchive::num_array_klasses() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicArchive::check_for_dynamic_dump() {
|
void DynamicArchive::check_for_dynamic_dump() {
|
||||||
if (DynamicDumpSharedSpaces && !UseSharedSpaces) {
|
if (CDSConfig::is_dumping_dynamic_archive() && !UseSharedSpaces) {
|
||||||
// This could happen if SharedArchiveFile has failed to load:
|
// This could happen if SharedArchiveFile has failed to load:
|
||||||
// - -Xshare:off was specified
|
// - -Xshare:off was specified
|
||||||
// - SharedArchiveFile points to an non-existent file.
|
// - SharedArchiveFile points to an non-existent file.
|
||||||
|
@ -485,7 +486,7 @@ void DynamicArchive::check_for_dynamic_dump() {
|
||||||
log_warning(cds)("-XX:ArchiveClassesAtExit" __THEMSG);
|
log_warning(cds)("-XX:ArchiveClassesAtExit" __THEMSG);
|
||||||
}
|
}
|
||||||
#undef __THEMSG
|
#undef __THEMSG
|
||||||
DynamicDumpSharedSpaces = false;
|
CDSConfig::disable_dumping_dynamic_archive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +494,7 @@ void DynamicArchive::dump_at_exit(JavaThread* current, const char* archive_name)
|
||||||
ExceptionMark em(current);
|
ExceptionMark em(current);
|
||||||
ResourceMark rm(current);
|
ResourceMark rm(current);
|
||||||
|
|
||||||
if (!DynamicDumpSharedSpaces || archive_name == nullptr) {
|
if (!CDSConfig::is_dumping_dynamic_archive() || archive_name == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,14 +517,14 @@ void DynamicArchive::dump_at_exit(JavaThread* current, const char* archive_name)
|
||||||
log_error(cds)("%s: %s", ex->klass()->external_name(),
|
log_error(cds)("%s: %s", ex->klass()->external_name(),
|
||||||
java_lang_String::as_utf8_string(java_lang_Throwable::message(ex)));
|
java_lang_String::as_utf8_string(java_lang_Throwable::message(ex)));
|
||||||
CLEAR_PENDING_EXCEPTION;
|
CLEAR_PENDING_EXCEPTION;
|
||||||
DynamicDumpSharedSpaces = false; // Just for good measure
|
CDSConfig::disable_dumping_dynamic_archive(); // Just for good measure
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called by "jcmd VM.cds dynamic_dump"
|
// This is called by "jcmd VM.cds dynamic_dump"
|
||||||
void DynamicArchive::dump_for_jcmd(const char* archive_name, TRAPS) {
|
void DynamicArchive::dump_for_jcmd(const char* archive_name, TRAPS) {
|
||||||
assert(UseSharedSpaces && RecordDynamicDumpInfo, "already checked in arguments.cpp");
|
assert(UseSharedSpaces && RecordDynamicDumpInfo, "already checked in arguments.cpp");
|
||||||
assert(ArchiveClassesAtExit == nullptr, "already checked in arguments.cpp");
|
assert(ArchiveClassesAtExit == nullptr, "already checked in arguments.cpp");
|
||||||
assert(DynamicDumpSharedSpaces, "already checked by check_for_dynamic_dump() during VM startup");
|
assert(CDSConfig::is_dumping_dynamic_archive(), "already checked by check_for_dynamic_dump() during VM startup");
|
||||||
MetaspaceShared::link_shared_classes(true/*from jcmd*/, CHECK);
|
MetaspaceShared::link_shared_classes(true/*from jcmd*/, CHECK);
|
||||||
// copy shared path table to saved.
|
// copy shared path table to saved.
|
||||||
VM_PopulateDynamicDumpSharedSpace op(archive_name);
|
VM_PopulateDynamicDumpSharedSpace op(archive_name);
|
||||||
|
|
|
@ -194,7 +194,7 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment,
|
||||||
set_base_archive_name_offset((unsigned int)base_archive_name_offset);
|
set_base_archive_name_offset((unsigned int)base_archive_name_offset);
|
||||||
set_base_archive_name_size((unsigned int)base_archive_name_size);
|
set_base_archive_name_size((unsigned int)base_archive_name_size);
|
||||||
set_common_app_classpath_prefix_size((unsigned int)common_app_classpath_prefix_size);
|
set_common_app_classpath_prefix_size((unsigned int)common_app_classpath_prefix_size);
|
||||||
set_magic(DynamicDumpSharedSpaces ? CDS_DYNAMIC_ARCHIVE_MAGIC : CDS_ARCHIVE_MAGIC);
|
set_magic(CDSConfig::is_dumping_dynamic_archive() ? CDS_DYNAMIC_ARCHIVE_MAGIC : CDS_ARCHIVE_MAGIC);
|
||||||
set_version(CURRENT_CDS_ARCHIVE_VERSION);
|
set_version(CURRENT_CDS_ARCHIVE_VERSION);
|
||||||
|
|
||||||
if (!info->is_static() && base_archive_name_size != 0) {
|
if (!info->is_static() && base_archive_name_size != 0) {
|
||||||
|
@ -235,7 +235,7 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment,
|
||||||
_mapped_base_address = (char*)SharedBaseAddress;
|
_mapped_base_address = (char*)SharedBaseAddress;
|
||||||
_allow_archiving_with_java_agent = AllowArchivingWithJavaAgent;
|
_allow_archiving_with_java_agent = AllowArchivingWithJavaAgent;
|
||||||
|
|
||||||
if (!DynamicDumpSharedSpaces) {
|
if (!CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
set_shared_path_table(info->_shared_path_table);
|
set_shared_path_table(info->_shared_path_table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -932,7 +932,7 @@ bool FileMapInfo::validate_shared_path_table() {
|
||||||
|
|
||||||
// Load the shared path table info from the archive header
|
// Load the shared path table info from the archive header
|
||||||
_shared_path_table = header()->shared_path_table();
|
_shared_path_table = header()->shared_path_table();
|
||||||
if (DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
// Only support dynamic dumping with the usage of the default CDS archive
|
// Only support dynamic dumping with the usage of the default CDS archive
|
||||||
// or a simple base archive.
|
// or a simple base archive.
|
||||||
// If the base layer archive contains additional path component besides
|
// If the base layer archive contains additional path component besides
|
||||||
|
@ -942,13 +942,13 @@ bool FileMapInfo::validate_shared_path_table() {
|
||||||
// to include the application path and stored in the top layer archive.
|
// to include the application path and stored in the top layer archive.
|
||||||
assert(shared_path(0)->is_modules_image(), "first shared_path must be the modules image");
|
assert(shared_path(0)->is_modules_image(), "first shared_path must be the modules image");
|
||||||
if (header()->app_class_paths_start_index() > 1) {
|
if (header()->app_class_paths_start_index() > 1) {
|
||||||
DynamicDumpSharedSpaces = false;
|
CDSConfig::disable_dumping_dynamic_archive();
|
||||||
log_warning(cds)(
|
log_warning(cds)(
|
||||||
"Dynamic archiving is disabled because base layer archive has appended boot classpath");
|
"Dynamic archiving is disabled because base layer archive has appended boot classpath");
|
||||||
}
|
}
|
||||||
if (header()->num_module_paths() > 0) {
|
if (header()->num_module_paths() > 0) {
|
||||||
if (!check_module_paths()) {
|
if (!check_module_paths()) {
|
||||||
DynamicDumpSharedSpaces = false;
|
CDSConfig::disable_dumping_dynamic_archive();
|
||||||
log_warning(cds)(
|
log_warning(cds)(
|
||||||
"Dynamic archiving is disabled because base layer archive has a different module path");
|
"Dynamic archiving is disabled because base layer archive has a different module path");
|
||||||
}
|
}
|
||||||
|
@ -1523,7 +1523,7 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
|
||||||
} else if (HeapShared::is_heap_region(region)) {
|
} else if (HeapShared::is_heap_region(region)) {
|
||||||
assert(HeapShared::can_write(), "sanity");
|
assert(HeapShared::can_write(), "sanity");
|
||||||
#if INCLUDE_CDS_JAVA_HEAP
|
#if INCLUDE_CDS_JAVA_HEAP
|
||||||
assert(!DynamicDumpSharedSpaces, "must be");
|
assert(!CDSConfig::is_dumping_dynamic_archive(), "must be");
|
||||||
requested_base = (char*)ArchiveHeapWriter::requested_address();
|
requested_base = (char*)ArchiveHeapWriter::requested_address();
|
||||||
if (UseCompressedOops) {
|
if (UseCompressedOops) {
|
||||||
mapping_offset = (size_t)((address)requested_base - CompressedOops::base());
|
mapping_offset = (size_t)((address)requested_base - CompressedOops::base());
|
||||||
|
@ -2272,7 +2272,7 @@ bool FileMapInfo::initialize() {
|
||||||
} else {
|
} else {
|
||||||
log_info(cds)("Initialize dynamic archive failed.");
|
log_info(cds)("Initialize dynamic archive failed.");
|
||||||
if (AutoCreateSharedArchive) {
|
if (AutoCreateSharedArchive) {
|
||||||
DynamicDumpSharedSpaces = true;
|
CDSConfig::enable_dumping_dynamic_archive();
|
||||||
ArchiveClassesAtExit = Arguments::GetSharedDynamicArchivePath();
|
ArchiveClassesAtExit = Arguments::GetSharedDynamicArchivePath();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -279,7 +279,7 @@ void MetaspaceShared::post_initialize(TRAPS) {
|
||||||
int size = FileMapInfo::get_number_of_shared_paths();
|
int size = FileMapInfo::get_number_of_shared_paths();
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
CDSProtectionDomain::allocate_shared_data_arrays(size, CHECK);
|
CDSProtectionDomain::allocate_shared_data_arrays(size, CHECK);
|
||||||
if (!DynamicDumpSharedSpaces) {
|
if (!CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
FileMapInfo* info;
|
FileMapInfo* info;
|
||||||
if (FileMapInfo::dynamic_info() == nullptr) {
|
if (FileMapInfo::dynamic_info() == nullptr) {
|
||||||
info = FileMapInfo::current_info();
|
info = FileMapInfo::current_info();
|
||||||
|
@ -584,7 +584,7 @@ bool MetaspaceShared::may_be_eagerly_linked(InstanceKlass* ik) {
|
||||||
// linked/verified at runtime.
|
// linked/verified at runtime.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DynamicDumpSharedSpaces && ik->is_shared_unregistered_class()) {
|
if (CDSConfig::is_dumping_dynamic_archive() && ik->is_shared_unregistered_class()) {
|
||||||
// Linking of unregistered classes at this stage may cause more
|
// Linking of unregistered classes at this stage may cause more
|
||||||
// classes to be resolved, resulting in calls to ClassLoader.loadClass()
|
// classes to be resolved, resulting in calls to ClassLoader.loadClass()
|
||||||
// that may not be expected by custom class loaders.
|
// that may not be expected by custom class loaders.
|
||||||
|
@ -949,13 +949,13 @@ void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set_shared_metaspace_range(nullptr, nullptr, nullptr);
|
set_shared_metaspace_range(nullptr, nullptr, nullptr);
|
||||||
if (DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
log_warning(cds)("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.");
|
log_warning(cds)("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.");
|
||||||
}
|
}
|
||||||
UseSharedSpaces = false;
|
UseSharedSpaces = false;
|
||||||
// The base archive cannot be mapped. We cannot dump the dynamic shared archive.
|
// The base archive cannot be mapped. We cannot dump the dynamic shared archive.
|
||||||
AutoCreateSharedArchive = false;
|
AutoCreateSharedArchive = false;
|
||||||
DynamicDumpSharedSpaces = false;
|
CDSConfig::disable_dumping_dynamic_archive();
|
||||||
log_info(cds)("Unable to map shared spaces");
|
log_info(cds)("Unable to map shared spaces");
|
||||||
if (PrintSharedArchiveAndExit) {
|
if (PrintSharedArchiveAndExit) {
|
||||||
MetaspaceShared::unrecoverable_loading_error("Unable to use shared archive.");
|
MetaspaceShared::unrecoverable_loading_error("Unable to use shared archive.");
|
||||||
|
@ -991,7 +991,7 @@ FileMapInfo* MetaspaceShared::open_static_archive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileMapInfo* MetaspaceShared::open_dynamic_archive() {
|
FileMapInfo* MetaspaceShared::open_dynamic_archive() {
|
||||||
if (DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const char* dynamic_archive = Arguments::GetSharedDynamicArchivePath();
|
const char* dynamic_archive = Arguments::GetSharedDynamicArchivePath();
|
||||||
|
@ -1486,7 +1486,7 @@ void MetaspaceShared::initialize_shared_spaces() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up LambdaFormInvokers::_lambdaform_lines for dynamic dump
|
// Set up LambdaFormInvokers::_lambdaform_lines for dynamic dump
|
||||||
if (DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
// Read stored LF format lines stored in static archive
|
// Read stored LF format lines stored in static archive
|
||||||
LambdaFormInvokers::read_static_archive_invokers();
|
LambdaFormInvokers::read_static_archive_invokers();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1126,9 +1126,9 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
|
||||||
// check will determine if a shared class is visible based on the runtime
|
// check will determine if a shared class is visible based on the runtime
|
||||||
// environment, including the runtime --patch-module setting.
|
// environment, including the runtime --patch-module setting.
|
||||||
//
|
//
|
||||||
// DynamicDumpSharedSpaces requires UseSharedSpaces to be enabled. Since --patch-module
|
// Dynamic dumping requires UseSharedSpaces to be enabled. Since --patch-module
|
||||||
// is not supported with UseSharedSpaces, it is not supported with DynamicDumpSharedSpaces.
|
// is not supported with UseSharedSpaces, we can never come here during dynamic dumping.
|
||||||
assert(!DynamicDumpSharedSpaces, "sanity");
|
assert(!CDSConfig::is_dumping_dynamic_archive(), "sanity");
|
||||||
if (!DumpSharedSpaces) {
|
if (!DumpSharedSpaces) {
|
||||||
stream = search_module_entries(THREAD, _patch_mod_entries, class_name, file_name);
|
stream = search_module_entries(THREAD, _patch_mod_entries, class_name, file_name);
|
||||||
}
|
}
|
||||||
|
@ -1491,7 +1491,7 @@ void ClassLoader::classLoader_init2(JavaThread* current) {
|
||||||
// entries will be added to the exploded build array.
|
// entries will be added to the exploded build array.
|
||||||
if (!has_jrt_entry()) {
|
if (!has_jrt_entry()) {
|
||||||
assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with exploded module builds");
|
assert(!DumpSharedSpaces, "DumpSharedSpaces not supported with exploded module builds");
|
||||||
assert(!DynamicDumpSharedSpaces, "DynamicDumpSharedSpaces not supported with exploded module builds");
|
assert(!CDSConfig::is_dumping_dynamic_archive(), "not supported with exploded module builds");
|
||||||
assert(!UseSharedSpaces, "UsedSharedSpaces not supported with exploded module builds");
|
assert(!UseSharedSpaces, "UsedSharedSpaces not supported with exploded module builds");
|
||||||
// Set up the boot loader's _exploded_entries list. Note that this gets
|
// Set up the boot loader's _exploded_entries list. Note that this gets
|
||||||
// done before loading any classes, by the same thread that will
|
// done before loading any classes, by the same thread that will
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "cds/archiveBuilder.hpp"
|
#include "cds/archiveBuilder.hpp"
|
||||||
|
#include "cds/cdsConfig.hpp"
|
||||||
#include "cds/dynamicArchive.hpp"
|
#include "cds/dynamicArchive.hpp"
|
||||||
#include "classfile/altHashing.hpp"
|
#include "classfile/altHashing.hpp"
|
||||||
#include "classfile/classLoaderData.hpp"
|
#include "classfile/classLoaderData.hpp"
|
||||||
|
@ -671,10 +672,11 @@ size_t SymbolTable::estimate_size_for_archive() {
|
||||||
void SymbolTable::write_to_archive(GrowableArray<Symbol*>* symbols) {
|
void SymbolTable::write_to_archive(GrowableArray<Symbol*>* symbols) {
|
||||||
CompactHashtableWriter writer(int(_items_count), ArchiveBuilder::symbol_stats());
|
CompactHashtableWriter writer(int(_items_count), ArchiveBuilder::symbol_stats());
|
||||||
copy_shared_symbol_table(symbols, &writer);
|
copy_shared_symbol_table(symbols, &writer);
|
||||||
if (!DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_static_archive()) {
|
||||||
_shared_table.reset();
|
_shared_table.reset();
|
||||||
writer.dump(&_shared_table, "symbol");
|
writer.dump(&_shared_table, "symbol");
|
||||||
} else {
|
} else {
|
||||||
|
assert(CDSConfig::is_dumping_dynamic_archive(), "must be");
|
||||||
_dynamic_shared_table.reset();
|
_dynamic_shared_table.reset();
|
||||||
writer.dump(&_dynamic_shared_table, "symbol");
|
writer.dump(&_dynamic_shared_table, "symbol");
|
||||||
}
|
}
|
||||||
|
|
|
@ -986,7 +986,7 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
|
||||||
assert(klass_loader != nullptr, "should not be called for boot loader");
|
assert(klass_loader != nullptr, "should not be called for boot loader");
|
||||||
assert(loader1 != loader2, "must be");
|
assert(loader1 != loader2, "must be");
|
||||||
|
|
||||||
if (DynamicDumpSharedSpaces && Thread::current()->is_VM_thread()) {
|
if (CDSConfig::is_dumping_dynamic_archive() && Thread::current()->is_VM_thread()) {
|
||||||
// We are re-laying out the vtable/itables of the *copy* of
|
// We are re-laying out the vtable/itables of the *copy* of
|
||||||
// a class during the final stage of dynamic dumping. The
|
// a class during the final stage of dynamic dumping. The
|
||||||
// linking constraints for this class has already been recorded.
|
// linking constraints for this class has already been recorded.
|
||||||
|
|
|
@ -120,7 +120,7 @@ void Rewriter::make_constant_pool_cache(TRAPS) {
|
||||||
#if INCLUDE_CDS
|
#if INCLUDE_CDS
|
||||||
if (!HAS_PENDING_EXCEPTION && CDSConfig::is_dumping_archive()) {
|
if (!HAS_PENDING_EXCEPTION && CDSConfig::is_dumping_archive()) {
|
||||||
if (_pool->pool_holder()->is_shared()) {
|
if (_pool->pool_holder()->is_shared()) {
|
||||||
assert(DynamicDumpSharedSpaces, "must be");
|
assert(CDSConfig::is_dumping_dynamic_archive(), "must be");
|
||||||
// We are linking a shared class from the base archive. This
|
// We are linking a shared class from the base archive. This
|
||||||
// class won't be written into the dynamic archive, so there's no
|
// class won't be written into the dynamic archive, so there's no
|
||||||
// need to save its CpCaches.
|
// need to save its CpCaches.
|
||||||
|
|
|
@ -1875,7 +1875,7 @@ NOINLINE int linear_search(const Array<Method*>* methods, const Symbol* name) {
|
||||||
|
|
||||||
inline int InstanceKlass::quick_search(const Array<Method*>* methods, const Symbol* name) {
|
inline int InstanceKlass::quick_search(const Array<Method*>* methods, const Symbol* name) {
|
||||||
if (_disable_method_binary_search) {
|
if (_disable_method_binary_search) {
|
||||||
assert(DynamicDumpSharedSpaces, "must be");
|
assert(CDSConfig::is_dumping_dynamic_archive(), "must be");
|
||||||
// At the final stage of dynamic dumping, the methods array may not be sorted
|
// At the final stage of dynamic dumping, the methods array may not be sorted
|
||||||
// by ascending addresses of their names, so we can't use binary search anymore.
|
// by ascending addresses of their names, so we can't use binary search anymore.
|
||||||
// However, methods with the same name are still laid out consecutively inside the
|
// However, methods with the same name are still laid out consecutively inside the
|
||||||
|
@ -2696,7 +2696,7 @@ void InstanceKlass::init_shared_package_entry() {
|
||||||
#else
|
#else
|
||||||
if (!MetaspaceShared::use_full_module_graph()) {
|
if (!MetaspaceShared::use_full_module_graph()) {
|
||||||
_package_entry = nullptr;
|
_package_entry = nullptr;
|
||||||
} else if (DynamicDumpSharedSpaces) {
|
} else if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
if (!MetaspaceShared::is_in_shared_metaspace(_package_entry)) {
|
if (!MetaspaceShared::is_in_shared_metaspace(_package_entry)) {
|
||||||
_package_entry = nullptr;
|
_package_entry = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3726,7 +3726,7 @@ JVM_END
|
||||||
|
|
||||||
JVM_LEAF(jboolean, JVM_IsDumpingClassList(JNIEnv *env))
|
JVM_LEAF(jboolean, JVM_IsDumpingClassList(JNIEnv *env))
|
||||||
#if INCLUDE_CDS
|
#if INCLUDE_CDS
|
||||||
return ClassListWriter::is_enabled() || DynamicDumpSharedSpaces;
|
return ClassListWriter::is_enabled() || CDSConfig::is_dumping_dynamic_archive();
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif // INCLUDE_CDS
|
#endif // INCLUDE_CDS
|
||||||
|
@ -3734,12 +3734,12 @@ JVM_END
|
||||||
|
|
||||||
JVM_ENTRY(void, JVM_LogLambdaFormInvoker(JNIEnv *env, jstring line))
|
JVM_ENTRY(void, JVM_LogLambdaFormInvoker(JNIEnv *env, jstring line))
|
||||||
#if INCLUDE_CDS
|
#if INCLUDE_CDS
|
||||||
assert(ClassListWriter::is_enabled() || DynamicDumpSharedSpaces, "Should be set and open or do dynamic dump");
|
assert(ClassListWriter::is_enabled() || CDSConfig::is_dumping_dynamic_archive(), "Should be set and open or do dynamic dump");
|
||||||
if (line != nullptr) {
|
if (line != nullptr) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
Handle h_line (THREAD, JNIHandles::resolve_non_null(line));
|
Handle h_line (THREAD, JNIHandles::resolve_non_null(line));
|
||||||
char* c_line = java_lang_String::as_utf8_string(h_line());
|
char* c_line = java_lang_String::as_utf8_string(h_line());
|
||||||
if (DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
// Note: LambdaFormInvokers::append take same format which is not
|
// Note: LambdaFormInvokers::append take same format which is not
|
||||||
// same as below the print format. The line does not include LAMBDA_FORM_TAG.
|
// same as below the print format. The line does not include LAMBDA_FORM_TAG.
|
||||||
LambdaFormInvokers::append(os::strdup((const char*)c_line, mtInternal));
|
LambdaFormInvokers::append(os::strdup((const char*)c_line, mtInternal));
|
||||||
|
|
|
@ -3063,9 +3063,9 @@ jint Arguments::finalize_vm_init_args(bool patch_mod_javabase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ArchiveClassesAtExit == nullptr && !RecordDynamicDumpInfo) {
|
if (ArchiveClassesAtExit == nullptr && !RecordDynamicDumpInfo) {
|
||||||
DynamicDumpSharedSpaces = false;
|
CDSConfig::disable_dumping_dynamic_archive();
|
||||||
} else {
|
} else {
|
||||||
DynamicDumpSharedSpaces = true;
|
CDSConfig::enable_dumping_dynamic_archive();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoCreateSharedArchive) {
|
if (AutoCreateSharedArchive) {
|
||||||
|
@ -3086,7 +3086,7 @@ jint Arguments::finalize_vm_init_args(bool patch_mod_javabase) {
|
||||||
UseSharedSpaces = false;
|
UseSharedSpaces = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
|
if (CDSConfig::is_dumping_archive()) {
|
||||||
// Always verify non-system classes during CDS dump
|
// Always verify non-system classes during CDS dump
|
||||||
if (!BytecodeVerificationRemote) {
|
if (!BytecodeVerificationRemote) {
|
||||||
BytecodeVerificationRemote = true;
|
BytecodeVerificationRemote = true;
|
||||||
|
@ -3493,7 +3493,7 @@ void Arguments::init_shared_archive_paths() {
|
||||||
// If +AutoCreateSharedArchive and the specified shared archive does not exist,
|
// If +AutoCreateSharedArchive and the specified shared archive does not exist,
|
||||||
// regenerate the dynamic archive base on default archive.
|
// regenerate the dynamic archive base on default archive.
|
||||||
if (AutoCreateSharedArchive && !os::file_exists(SharedArchiveFile)) {
|
if (AutoCreateSharedArchive && !os::file_exists(SharedArchiveFile)) {
|
||||||
DynamicDumpSharedSpaces = true;
|
CDSConfig::enable_dumping_dynamic_archive();
|
||||||
ArchiveClassesAtExit = const_cast<char *>(SharedArchiveFile);
|
ArchiveClassesAtExit = const_cast<char *>(SharedArchiveFile);
|
||||||
SharedArchivePath = get_default_shared_archive_path();
|
SharedArchivePath = get_default_shared_archive_path();
|
||||||
SharedArchiveFile = nullptr;
|
SharedArchiveFile = nullptr;
|
||||||
|
|
|
@ -41,7 +41,6 @@ int BitsPerHeapOop = 0;
|
||||||
|
|
||||||
// Old CDS options
|
// Old CDS options
|
||||||
bool DumpSharedSpaces;
|
bool DumpSharedSpaces;
|
||||||
bool DynamicDumpSharedSpaces;
|
|
||||||
bool RequireSharedSpaces;
|
bool RequireSharedSpaces;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
JNIEXPORT jboolean UseSharedSpaces = true;
|
JNIEXPORT jboolean UseSharedSpaces = true;
|
||||||
|
|
|
@ -554,7 +554,6 @@ const int max_method_code_size = 64*K - 1; // JVM spec, 2nd ed. section 4.8.1 (
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// old CDS options
|
// old CDS options
|
||||||
extern bool DumpSharedSpaces;
|
extern bool DumpSharedSpaces;
|
||||||
extern bool DynamicDumpSharedSpaces;
|
|
||||||
extern bool RequireSharedSpaces;
|
extern bool RequireSharedSpaces;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// Make sure UseSharedSpaces is accessible to the serviceability agent.
|
// Make sure UseSharedSpaces is accessible to the serviceability agent.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue