< prev index next >

src/hotspot/share/classfile/systemDictionaryShared.cpp

Print this page




 480 //
 481 // NOTE: there's a lot of assumption about the Java code. If any of that change, this
 482 // needs to be redesigned.
 483 //
 484 // An alternative is to modify the Java code of AppClassLoader.loadClass().
 485 //
 486 InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
 487                  Symbol* name, Handle class_loader, TRAPS) {
 488   if (DumpSharedSpaces) {
 489     return NULL;
 490   }
 491 
 492   InstanceKlass* k = NULL;
 493   if (shared_dictionary() != NULL &&
 494       UseAppCDS && (SystemDictionary::is_system_class_loader(class_loader()) ||
 495                     SystemDictionary::is_platform_class_loader(class_loader()))) {
 496 
 497     // Fix for 4474172; see evaluation for more details
 498     class_loader = Handle(
 499       THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
 500     ClassLoaderData *loader_data = register_loader(class_loader, CHECK_NULL);
 501     Dictionary* dictionary = loader_data->dictionary();
 502 
 503     unsigned int d_hash = dictionary->compute_hash(name);
 504 
 505     bool DoObjectLock = true;
 506     if (is_parallelCapable(class_loader)) {
 507       DoObjectLock = false;
 508     }
 509 
 510     // Make sure we are synchronized on the class loader before we proceed
 511     //
 512     // Note: currently, find_or_load_shared_class is called only from
 513     // JVM_FindLoadedClass and used for PlatformClassLoader and AppClassLoader,
 514     // which are parallel-capable loaders, so this lock is NOT taken.
 515     Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
 516     check_loader_lock_contention(lockObject, THREAD);
 517     ObjectLocker ol(lockObject, THREAD, DoObjectLock);
 518 
 519     {
 520       MutexLocker mu(SystemDictionary_lock, THREAD);




 480 //
 481 // NOTE: there's a lot of assumption about the Java code. If any of that change, this
 482 // needs to be redesigned.
 483 //
 484 // An alternative is to modify the Java code of AppClassLoader.loadClass().
 485 //
 486 InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
 487                  Symbol* name, Handle class_loader, TRAPS) {
 488   if (DumpSharedSpaces) {
 489     return NULL;
 490   }
 491 
 492   InstanceKlass* k = NULL;
 493   if (shared_dictionary() != NULL &&
 494       UseAppCDS && (SystemDictionary::is_system_class_loader(class_loader()) ||
 495                     SystemDictionary::is_platform_class_loader(class_loader()))) {
 496 
 497     // Fix for 4474172; see evaluation for more details
 498     class_loader = Handle(
 499       THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
 500     ClassLoaderData *loader_data = register_loader(class_loader);
 501     Dictionary* dictionary = loader_data->dictionary();
 502 
 503     unsigned int d_hash = dictionary->compute_hash(name);
 504 
 505     bool DoObjectLock = true;
 506     if (is_parallelCapable(class_loader)) {
 507       DoObjectLock = false;
 508     }
 509 
 510     // Make sure we are synchronized on the class loader before we proceed
 511     //
 512     // Note: currently, find_or_load_shared_class is called only from
 513     // JVM_FindLoadedClass and used for PlatformClassLoader and AppClassLoader,
 514     // which are parallel-capable loaders, so this lock is NOT taken.
 515     Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
 516     check_loader_lock_contention(lockObject, THREAD);
 517     ObjectLocker ol(lockObject, THREAD, DoObjectLock);
 518 
 519     {
 520       MutexLocker mu(SystemDictionary_lock, THREAD);


< prev index next >