< prev index next >

src/hotspot/share/classfile/classLoaderData.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


 640 
 641 const int _boot_loader_dictionary_size    = 1009;
 642 const int _default_loader_dictionary_size = 107;
 643 
 644 Dictionary* ClassLoaderData::create_dictionary() {
 645   assert(!is_anonymous(), "anonymous class loader data do not have a dictionary");
 646   int size;
 647   bool resizable = false;
 648   if (_the_null_class_loader_data == NULL) {
 649     size = _boot_loader_dictionary_size;
 650     resizable = true;
 651   } else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) {
 652     size = 1;  // there's only one class in relection class loader and no initiated classes
 653   } else if (is_system_class_loader_data()) {
 654     size = _boot_loader_dictionary_size;
 655     resizable = true;
 656   } else {
 657     size = _default_loader_dictionary_size;
 658     resizable = true;
 659   }
 660   if (!DynamicallyResizeSystemDictionaries || DumpSharedSpaces || UseSharedSpaces) {
 661     resizable = false;
 662   }
 663   return new Dictionary(this, size, resizable);
 664 }
 665 
 666 // Tell the GC to keep this klass alive while iterating ClassLoaderDataGraph
 667 oop ClassLoaderData::holder_phantom() const {
 668   // A klass that was previously considered dead can be looked up in the
 669   // CLD/SD, and its _java_mirror or _class_loader can be stored in a root
 670   // or a reachable object making it alive again. The SATB part of G1 needs
 671   // to get notified about this potential resurrection, otherwise the marking
 672   // might not find the object.
 673   if (!_holder.is_null()) {  // NULL class_loader
 674     return _holder.resolve();
 675   } else {
 676     return NULL;
 677   }
 678 }
 679 
 680 // Unloading support




 640 
 641 const int _boot_loader_dictionary_size    = 1009;
 642 const int _default_loader_dictionary_size = 107;
 643 
 644 Dictionary* ClassLoaderData::create_dictionary() {
 645   assert(!is_anonymous(), "anonymous class loader data do not have a dictionary");
 646   int size;
 647   bool resizable = false;
 648   if (_the_null_class_loader_data == NULL) {
 649     size = _boot_loader_dictionary_size;
 650     resizable = true;
 651   } else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) {
 652     size = 1;  // there's only one class in relection class loader and no initiated classes
 653   } else if (is_system_class_loader_data()) {
 654     size = _boot_loader_dictionary_size;
 655     resizable = true;
 656   } else {
 657     size = _default_loader_dictionary_size;
 658     resizable = true;
 659   }
 660   if (!DynamicallyResizeSystemDictionaries || DumpSharedSpaces) {
 661     resizable = false;
 662   }
 663   return new Dictionary(this, size, resizable);
 664 }
 665 
 666 // Tell the GC to keep this klass alive while iterating ClassLoaderDataGraph
 667 oop ClassLoaderData::holder_phantom() const {
 668   // A klass that was previously considered dead can be looked up in the
 669   // CLD/SD, and its _java_mirror or _class_loader can be stored in a root
 670   // or a reachable object making it alive again. The SATB part of G1 needs
 671   // to get notified about this potential resurrection, otherwise the marking
 672   // might not find the object.
 673   if (!_holder.is_null()) {  // NULL class_loader
 674     return _holder.resolve();
 675   } else {
 676     return NULL;
 677   }
 678 }
 679 
 680 // Unloading support


< prev index next >