< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page
rev 54084 : 8208061: runtime/LoadClass/TestResize.java fails with "Load factor too high" when running in CDS mode.
Summary: Allow resizing for all system dictionaries except for the shared dictionary at runtime.
Reviewed-by: iklam, gziemski


1122   if (HAS_PENDING_EXCEPTION) {
1123     assert(k != NULL, "Must have an instance klass here!");
1124     loader_data->add_to_deallocate_list(k);
1125     return NULL;
1126   }
1127 
1128   // Make sure we have an entry in the SystemDictionary on success
1129   debug_only( {
1130     MutexLocker mu(SystemDictionary_lock, THREAD);
1131 
1132     Klass* check = find_class(h_name, k->class_loader_data());
1133     assert(check == k, "should be present in the dictionary");
1134   } );
1135 
1136   return k;
1137 }
1138 
1139 #if INCLUDE_CDS
1140 void SystemDictionary::set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
1141                                              int number_of_entries) {

1142   assert(length == _shared_dictionary_size * sizeof(HashtableBucket<mtClass>),
1143          "bad shared dictionary size.");
1144   _shared_dictionary = new Dictionary(ClassLoaderData::the_null_class_loader_data(),
1145                                       _shared_dictionary_size, t, number_of_entries);

1146 }
1147 
1148 
1149 // If there is a shared dictionary, then find the entry for the
1150 // given shared system class, if any.
1151 
1152 InstanceKlass* SystemDictionary::find_shared_class(Symbol* class_name) {
1153   if (shared_dictionary() != NULL) {
1154     unsigned int d_hash = shared_dictionary()->compute_hash(class_name);
1155     int d_index = shared_dictionary()->hash_to_index(d_hash);
1156 
1157     return shared_dictionary()->find_shared_class(d_index, d_hash, class_name);
1158   } else {
1159     return NULL;
1160   }
1161 }
1162 
1163 
1164 // Load a class from the shared spaces (found through the shared system
1165 // dictionary).  Force the superclass and all interfaces to be loaded.




1122   if (HAS_PENDING_EXCEPTION) {
1123     assert(k != NULL, "Must have an instance klass here!");
1124     loader_data->add_to_deallocate_list(k);
1125     return NULL;
1126   }
1127 
1128   // Make sure we have an entry in the SystemDictionary on success
1129   debug_only( {
1130     MutexLocker mu(SystemDictionary_lock, THREAD);
1131 
1132     Klass* check = find_class(h_name, k->class_loader_data());
1133     assert(check == k, "should be present in the dictionary");
1134   } );
1135 
1136   return k;
1137 }
1138 
1139 #if INCLUDE_CDS
1140 void SystemDictionary::set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
1141                                              int number_of_entries) {
1142   assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
1143   assert(length == _shared_dictionary_size * sizeof(HashtableBucket<mtClass>),
1144          "bad shared dictionary size.");
1145   _shared_dictionary = new Dictionary(ClassLoaderData::the_null_class_loader_data(),
1146                                       _shared_dictionary_size, t, number_of_entries,
1147                                       false /* explicitly set _resizable to false */);
1148 }
1149 
1150 
1151 // If there is a shared dictionary, then find the entry for the
1152 // given shared system class, if any.
1153 
1154 InstanceKlass* SystemDictionary::find_shared_class(Symbol* class_name) {
1155   if (shared_dictionary() != NULL) {
1156     unsigned int d_hash = shared_dictionary()->compute_hash(class_name);
1157     int d_index = shared_dictionary()->hash_to_index(d_hash);
1158 
1159     return shared_dictionary()->find_shared_class(d_index, d_hash, class_name);
1160   } else {
1161     return NULL;
1162   }
1163 }
1164 
1165 
1166 // Load a class from the shared spaces (found through the shared system
1167 // dictionary).  Force the superclass and all interfaces to be loaded.


< prev index next >