--- old/src/hotspot/share/classfile/moduleEntry.hpp 2020-08-31 08:09:14.119420969 -0700 +++ new/src/hotspot/share/classfile/moduleEntry.hpp 2020-08-31 08:09:13.895412537 -0700 @@ -47,6 +47,7 @@ #define JAVA_BASE_NAME "java.base" #define JAVA_BASE_NAME_LEN 9 +template class Array; class ModuleClosure; // A ModuleEntry describes a module that has been defined by a call to JVM_DefineModule. @@ -63,7 +64,7 @@ class ModuleEntry : public HashtableEntry { private: OopHandle _module; // java.lang.Module - OopHandle _pd; // java.security.ProtectionDomain, cached + OopHandle _shared_pd; // java.security.ProtectionDomain, cached // for shared classes from this module ClassLoaderData* _loader_data; GrowableArray* _reads; // list of modules that are readable by this module @@ -75,13 +76,15 @@ bool _must_walk_reads; // walk module's reads list at GC safepoints to purge out dead modules bool _is_open; // whether the packages in the module are all unqualifiedly exported bool _is_patched; // whether the module is patched via --patch-module + CDS_JAVA_HEAP_ONLY(narrowOop _archived_module_narrow_oop;) + JFR_ONLY(DEFINE_TRACE_ID_FIELD;) enum {MODULE_READS_SIZE = 101}; // Initial size of list of modules that the module can read. public: void init() { _module = OopHandle(); - _pd = OopHandle(); + _shared_pd = OopHandle(); _loader_data = NULL; _reads = NULL; _version = NULL; @@ -188,6 +191,17 @@ CDS_ONLY(int shared_path_index() { return _shared_path_index;}) JFR_ONLY(DEFINE_TRACE_ID_METHODS;) + +#if INCLUDE_CDS_JAVA_HEAP + ModuleEntry* allocate_archived_entry() const; + void init_as_archived_entry(); + void init_archived_oops(); + static ModuleEntry* get_archived_entry(ModuleEntry* orig_entry); + static Array* write_archived_entry_array(GrowableArray* array); + static GrowableArray* read_archived_entry_array(Array* archived_array); + void load_from_archive(ClassLoaderData* loader_data); + void restore_archive_oops(ClassLoaderData* loader_data); +#endif }; // Iterator interface @@ -270,6 +284,16 @@ void print(outputStream* st = tty); void verify(); + +#if INCLUDE_CDS_JAVA_HEAP + Array* allocate_archived_entries(); + void init_archived_entries(Array* archived_modules); + void init_archived_oops(Array* archived_modules); + void load_archived_entries(ClassLoaderData* loader_data, + Array* archived_modules); + void restore_archived_oops(ClassLoaderData* loader_data, + Array* archived_modules); +#endif }; #endif // SHARE_CLASSFILE_MODULEENTRY_HPP