diff --git a/src/hotspot/share/cds/dumpTimeClassInfo.cpp b/src/hotspot/share/cds/dumpTimeClassInfo.cpp index e7e3b5c7b56..6ee18c17a57 100644 --- a/src/hotspot/share/cds/dumpTimeClassInfo.cpp +++ b/src/hotspot/share/cds/dumpTimeClassInfo.cpp @@ -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(n, mtClass); - _verifier_constraint_flags = new (mtClass) GrowableArray(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(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"); diff --git a/src/hotspot/share/cds/dumpTimeClassInfo.hpp b/src/hotspot/share/cds/dumpTimeClassInfo.hpp index 9a360d662b1..d5ad90f35d5 100644 --- a/src/hotspot/share/cds/dumpTimeClassInfo.hpp +++ b/src/hotspot/share/cds/dumpTimeClassInfo.hpp @@ -145,7 +145,6 @@ public: _loader_constraints = nullptr; _enum_klass_static_fields = nullptr; } - DumpTimeClassInfo(const DumpTimeClassInfo& src); DumpTimeClassInfo& operator=(const DumpTimeClassInfo&) = delete; ~DumpTimeClassInfo(); diff --git a/src/hotspot/share/cds/dynamicArchive.cpp b/src/hotspot/share/cds/dynamicArchive.cpp index 34ba3e69afc..e2754a839bd 100644 --- a/src/hotspot/share/cds/dynamicArchive.cpp +++ b/src/hotspot/share/cds/dynamicArchive.cpp @@ -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"); } diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index 00dd542c52b..160f598796d 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -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(); diff --git a/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp b/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp index 0f0bcb1b9b9..2eef543f9db 100644 --- a/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp +++ b/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp @@ -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(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; diff --git a/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp b/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp index c3ad88b8632..ed7c2fc71f3 100644 --- a/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp +++ b/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp @@ -114,7 +114,6 @@ class DumpTimeLambdaProxyClassInfo { public: GrowableArray* _proxy_klasses; DumpTimeLambdaProxyClassInfo() : _proxy_klasses(nullptr) {} - DumpTimeLambdaProxyClassInfo(const DumpTimeLambdaProxyClassInfo& src); DumpTimeLambdaProxyClassInfo& operator=(const DumpTimeLambdaProxyClassInfo&) = delete; ~DumpTimeLambdaProxyClassInfo(); diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 4b182b80d96..790b263215a 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -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(©_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(©_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) { diff --git a/src/hotspot/share/classfile/systemDictionaryShared.hpp b/src/hotspot/share/classfile/systemDictionaryShared.hpp index d3bfaa1f785..f43ab838ae6 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.hpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp @@ -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);