< prev index next >

src/hotspot/share/classfile/classLoaderDataShared.cpp

Print this page

 85   if (loader_data != nullptr) {
 86     // We can't create hashtables at dump time because the hashcode depends on the
 87     // address of the Symbols, which may be relocated at runtime due to ASLR.
 88     // So we store the packages/modules in Arrays. At runtime, we create
 89     // the hashtables using these arrays.
 90     _packages = loader_data->packages()->allocate_archived_entries();
 91     _modules  = loader_data->modules() ->allocate_archived_entries();
 92   }
 93 }
 94 
 95 void ArchivedClassLoaderData::init_archived_entries(ClassLoaderData* loader_data) {
 96   assert(CDSConfig::is_dumping_full_module_graph(), "must be");
 97   assert_valid(loader_data);
 98   if (loader_data != nullptr) {
 99     loader_data->packages()->init_archived_entries(_packages);
100     loader_data->modules() ->init_archived_entries(_modules);
101   }
102 }
103 
104 void ArchivedClassLoaderData::restore(ClassLoaderData* loader_data, bool do_entries, bool do_oops) {
105   assert(CDSConfig::is_using_archive(), "must be");
106   assert_valid(loader_data);
107   if (_modules != nullptr) { // Could be null if we have archived no modules for platform/system loaders
108     ModuleEntryTable* modules = loader_data->modules();
109     PackageEntryTable* packages = loader_data->packages();
110 
111     MutexLocker m1(Module_lock);
112     if (do_entries) {
113       modules->load_archived_entries(loader_data, _modules);
114       packages->load_archived_entries(_packages);
115     }
116     if (do_oops) {
117       modules->restore_archived_oops(loader_data, _modules);
118     }
119   }
120 }
121 
122 void ArchivedClassLoaderData::clear_archived_oops() {
123   assert(CDSConfig::is_using_archive(), "must be");
124   if (_modules != nullptr) {
125     for (int i = 0; i < _modules->length(); i++) {
126       _modules->at(i)->clear_archived_oops();
127     }
128   }
129 }
130 
131 // ------------------------------
132 
133 static ClassLoaderData* null_class_loader_data() {
134   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
135   assert(loader_data != nullptr, "must be");
136   return loader_data;
137 }
138 
139 static ClassLoaderData* java_platform_loader_data_or_null() {
140   return ClassLoaderData::class_loader_data_or_null(SystemDictionary::java_platform_loader());
141 }
142 
143 static ClassLoaderData* java_system_loader_data_or_null() {

 85   if (loader_data != nullptr) {
 86     // We can't create hashtables at dump time because the hashcode depends on the
 87     // address of the Symbols, which may be relocated at runtime due to ASLR.
 88     // So we store the packages/modules in Arrays. At runtime, we create
 89     // the hashtables using these arrays.
 90     _packages = loader_data->packages()->allocate_archived_entries();
 91     _modules  = loader_data->modules() ->allocate_archived_entries();
 92   }
 93 }
 94 
 95 void ArchivedClassLoaderData::init_archived_entries(ClassLoaderData* loader_data) {
 96   assert(CDSConfig::is_dumping_full_module_graph(), "must be");
 97   assert_valid(loader_data);
 98   if (loader_data != nullptr) {
 99     loader_data->packages()->init_archived_entries(_packages);
100     loader_data->modules() ->init_archived_entries(_modules);
101   }
102 }
103 
104 void ArchivedClassLoaderData::restore(ClassLoaderData* loader_data, bool do_entries, bool do_oops) {
105   assert(CDSConfig::is_using_full_module_graph(), "must be");
106   assert_valid(loader_data);
107   if (_modules != nullptr) { // Could be null if we have archived no modules for platform/system loaders
108     ModuleEntryTable* modules = loader_data->modules();
109     PackageEntryTable* packages = loader_data->packages();
110 
111     MutexLocker m1(Module_lock);
112     if (do_entries) {
113       modules->load_archived_entries(loader_data, _modules);
114       packages->load_archived_entries(_packages);
115     }
116     if (do_oops) {
117       modules->restore_archived_oops(loader_data, _modules);
118     }
119   }
120 }
121 
122 void ArchivedClassLoaderData::clear_archived_oops() {
123   assert(!CDSConfig::is_using_full_module_graph(), "must be");
124   if (_modules != nullptr) {
125     for (int i = 0; i < _modules->length(); i++) {
126       _modules->at(i)->clear_archived_oops();
127     }
128   }
129 }
130 
131 // ------------------------------
132 
133 static ClassLoaderData* null_class_loader_data() {
134   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
135   assert(loader_data != nullptr, "must be");
136   return loader_data;
137 }
138 
139 static ClassLoaderData* java_platform_loader_data_or_null() {
140   return ClassLoaderData::class_loader_data_or_null(SystemDictionary::java_platform_loader());
141 }
142 
143 static ClassLoaderData* java_system_loader_data_or_null() {
< prev index next >