8308236: Remove SystemDictionaryShared::clone_dumptime_tables()

Reviewed-by: vlivanov, ccheung
This commit is contained in:
Ioi Lam 2023-05-18 04:10:49 +00:00
parent 83c096d6e2
commit 6f75dd8741
8 changed files with 0 additions and 162 deletions

View File

@ -31,51 +31,6 @@
#include "classfile/systemDictionaryShared.hpp"
#include "memory/resourceArea.hpp"
// This constructor is used only by SystemDictionaryShared::clone_dumptime_tables().
// See comments there about the need for making a deep copy.
DumpTimeClassInfo::DumpTimeClassInfo(const DumpTimeClassInfo& src) {
assert(DynamicDumpSharedSpaces, "must be");
_klass = src._klass;
_nest_host = src._nest_host;
_failed_verification = src._failed_verification;
_is_archived_lambda_proxy = src._is_archived_lambda_proxy;
_has_checked_exclusion = src._has_checked_exclusion;
_id = src._id;
_clsfile_size = src._clsfile_size;
_clsfile_crc32 = src._clsfile_crc32;
_excluded = src._excluded;
_is_early_klass = src._is_early_klass;
_verifier_constraints = nullptr;
_verifier_constraint_flags = nullptr;
_loader_constraints = nullptr;
assert(src._enum_klass_static_fields == nullptr, "This should not happen with dynamic dump.");
_enum_klass_static_fields = nullptr;
{
int n = src.num_verifier_constraints();
if (n > 0) {
_verifier_constraints = new (mtClass) GrowableArray<DTVerifierConstraint>(n, mtClass);
_verifier_constraint_flags = new (mtClass) GrowableArray<char>(n, mtClass);
for (int i = 0; i < n; i++) {
_verifier_constraints->append(src._verifier_constraints->at(i));
_verifier_constraint_flags->append(src._verifier_constraint_flags->at(i));
}
}
}
{
int n = src.num_loader_constraints();
if (n > 0) {
_loader_constraints = new (mtClass) GrowableArray<DTLoaderConstraint>(n, mtClass);
for (int i = 0; i < n; i++) {
_loader_constraints->append(src._loader_constraints->at(i));
}
}
}
}
DumpTimeClassInfo::~DumpTimeClassInfo() {
if (_verifier_constraints != nullptr) {
assert(_verifier_constraint_flags != nullptr, "must be");

View File

@ -145,7 +145,6 @@ public:
_loader_constraints = nullptr;
_enum_klass_static_fields = nullptr;
}
DumpTimeClassInfo(const DumpTimeClassInfo& src);
DumpTimeClassInfo& operator=(const DumpTimeClassInfo&) = delete;
~DumpTimeClassInfo();

View File

@ -117,9 +117,6 @@ public:
return;
}
// save dumptime tables
SystemDictionaryShared::clone_dumptime_tables();
init_header();
gather_source_objs();
reserve_buffer();
@ -167,9 +164,6 @@ public:
post_dump();
// Restore dumptime tables
SystemDictionaryShared::restore_dumptime_tables();
assert(_num_dump_regions_used == _total_dump_regions, "must be");
verify_universe("After CDS dynamic dump");
}

View File

@ -472,8 +472,6 @@ public:
}
static void allocate_shared_path_table(TRAPS);
static void copy_shared_path_table(ClassLoaderData* loader_data, TRAPS);
static void clone_shared_path_table(TRAPS);
static int add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS);
static void check_nonempty_dir_in_shared_path_table();
bool check_module_paths();

View File

@ -28,19 +28,6 @@
#include "classfile/systemDictionaryShared.hpp"
#include "memory/resourceArea.hpp"
// This constructor is used only by SystemDictionaryShared::clone_dumptime_tables().
// See comments there about the need for making a deep copy.
DumpTimeLambdaProxyClassInfo::DumpTimeLambdaProxyClassInfo(const DumpTimeLambdaProxyClassInfo& src) {
_proxy_klasses = nullptr;
if (src._proxy_klasses != nullptr && src._proxy_klasses->length() > 0) {
int n = src._proxy_klasses->length();
_proxy_klasses = new (mtClassShared) GrowableArray<InstanceKlass*>(n, mtClassShared);
for (int i = 0; i < n; i++) {
_proxy_klasses->append(src._proxy_klasses->at(i));
}
}
}
DumpTimeLambdaProxyClassInfo::~DumpTimeLambdaProxyClassInfo() {
if (_proxy_klasses != nullptr) {
delete _proxy_klasses;

View File

@ -114,7 +114,6 @@ class DumpTimeLambdaProxyClassInfo {
public:
GrowableArray<InstanceKlass*>* _proxy_klasses;
DumpTimeLambdaProxyClassInfo() : _proxy_klasses(nullptr) {}
DumpTimeLambdaProxyClassInfo(const DumpTimeLambdaProxyClassInfo& src);
DumpTimeLambdaProxyClassInfo& operator=(const DumpTimeLambdaProxyClassInfo&) = delete;
~DumpTimeLambdaProxyClassInfo();

View File

@ -77,9 +77,7 @@ SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_static_archive;
SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_dynamic_archive;
DumpTimeSharedClassTable* SystemDictionaryShared::_dumptime_table = nullptr;
DumpTimeSharedClassTable* SystemDictionaryShared::_cloned_dumptime_table = nullptr;
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_dumptime_lambda_proxy_class_dictionary = nullptr;
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_cloned_dumptime_lambda_proxy_class_dictionary = nullptr;
// Used by NoClassLoadingMark
DEBUG_ONLY(bool SystemDictionaryShared::_class_loading_may_happen = true;)
@ -1440,87 +1438,6 @@ bool SystemDictionaryShared::is_dumptime_table_empty() {
return false;
}
class CloneDumpTimeClassTable: public StackObj {
DumpTimeSharedClassTable* _table;
DumpTimeSharedClassTable* _cloned_table;
public:
CloneDumpTimeClassTable(DumpTimeSharedClassTable* table, DumpTimeSharedClassTable* clone) :
_table(table), _cloned_table(clone) {
assert(_table != nullptr, "_dumptime_table is nullptr");
assert(_cloned_table != nullptr, "_cloned_table is nullptr");
}
void do_entry(InstanceKlass* k, DumpTimeClassInfo& info) {
bool created;
_cloned_table->put_if_absent(k, info, &created);
assert(created, "must be");
}
};
class CloneDumpTimeLambdaProxyClassTable: StackObj {
DumpTimeLambdaProxyClassDictionary* _table;
DumpTimeLambdaProxyClassDictionary* _cloned_table;
public:
CloneDumpTimeLambdaProxyClassTable(DumpTimeLambdaProxyClassDictionary* table,
DumpTimeLambdaProxyClassDictionary* clone) :
_table(table), _cloned_table(clone) {
assert(_table != nullptr, "_dumptime_table is nullptr");
assert(_cloned_table != nullptr, "_cloned_table is nullptr");
}
bool do_entry(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) {
assert_lock_strong(DumpTimeTable_lock);
bool created;
// make copies then store in _clone_table
LambdaProxyClassKey keyCopy = key;
_cloned_table->put_if_absent(keyCopy, info, &created);
assert(created, "must be");
++ _cloned_table->_count;
return true; // keep on iterating
}
};
// When dumping the CDS archive, the ArchiveBuilder will irrecoverably modify the
// _dumptime_table and _dumptime_lambda_proxy_class_dictionary (e.g., metaspace
// pointers are changed to use "buffer" addresses.)
//
// We save a copy of these tables and restore them after the dumping is finished.
// This makes it possible to repeat the dumping operation (e.g., use
// "jcmd VM.cds dynamic_dump" multiple times on the same JVM process).
//
// We use the copy constructors to clone the values in these tables. The copy constructors
// must make a deep copy, as internal data structures such as the contents of
// DumpTimeClassInfo::_loader_constraints are also modified by the ArchiveBuilder.
void SystemDictionaryShared::clone_dumptime_tables() {
Arguments::assert_is_dumping_archive();
assert_lock_strong(DumpTimeTable_lock);
assert(_cloned_dumptime_table == nullptr, "_cloned_dumptime_table must be cleaned");
_cloned_dumptime_table = new (mtClass) DumpTimeSharedClassTable;
CloneDumpTimeClassTable copy_classes(_dumptime_table, _cloned_dumptime_table);
_dumptime_table->iterate_all_live_classes(&copy_classes);
_cloned_dumptime_table->update_counts();
assert(_cloned_dumptime_lambda_proxy_class_dictionary == nullptr,
"_cloned_dumptime_lambda_proxy_class_dictionary must be cleaned");
_cloned_dumptime_lambda_proxy_class_dictionary =
new (mtClass) DumpTimeLambdaProxyClassDictionary;
CloneDumpTimeLambdaProxyClassTable copy_proxy_classes(_dumptime_lambda_proxy_class_dictionary,
_cloned_dumptime_lambda_proxy_class_dictionary);
_dumptime_lambda_proxy_class_dictionary->iterate(&copy_proxy_classes);
}
void SystemDictionaryShared::restore_dumptime_tables() {
assert_lock_strong(DumpTimeTable_lock);
delete _dumptime_table;
_dumptime_table = _cloned_dumptime_table;
_cloned_dumptime_table = nullptr;
delete _dumptime_lambda_proxy_class_dictionary;
_dumptime_lambda_proxy_class_dictionary = _cloned_dumptime_lambda_proxy_class_dictionary;
_cloned_dumptime_lambda_proxy_class_dictionary = nullptr;
}
class CleanupDumpTimeLambdaProxyClassTable: StackObj {
public:
bool do_entry(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) {

View File

@ -164,9 +164,7 @@ public:
private:
static DumpTimeSharedClassTable* _dumptime_table;
static DumpTimeSharedClassTable* _cloned_dumptime_table;
static DumpTimeLambdaProxyClassDictionary* _dumptime_lambda_proxy_class_dictionary;
static DumpTimeLambdaProxyClassDictionary* _cloned_dumptime_lambda_proxy_class_dictionary;
static ArchiveInfo _static_archive;
static ArchiveInfo _dynamic_archive;
@ -290,15 +288,6 @@ public:
}
static bool add_unregistered_class(Thread* current, InstanceKlass* k);
// For repeatable dumping, we
// 1. clone DumpTimeSharedClassTable, same for DumpTimeLambdaProxyClassDictionary
// clone SharedClassPathTable
// 2. do dumping
// 3. restore DumpTimeSharedClassTable, DumpTimeLambdaProxyClassDictionary and SharedClassPathTable
// from cloned versions.
static void clone_dumptime_tables();
static void restore_dumptime_tables();
static void check_excluded_classes();
static bool check_for_exclusion(InstanceKlass* k, DumpTimeClassInfo* info);
static void validate_before_archiving(InstanceKlass* k);