< prev index next >

src/hotspot/share/classfile/classLoaderData.cpp

Print this page




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




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


< prev index next >