< prev index next >

src/share/vm/classfile/systemDictionary.cpp

Print this page




 893 
 894   if (HAS_PENDING_EXCEPTION || k == NULL) {
 895     return NULL;
 896   }
 897 
 898   post_class_load_event(&class_load_start_event, k, loader_data);
 899 
 900 #ifdef ASSERT
 901   {
 902     ClassLoaderData* loader_data = k->class_loader_data();
 903     MutexLocker mu(SystemDictionary_lock, THREAD);
 904     Klass* kk = find_class(name, loader_data);
 905     assert(kk == k, "should be present in dictionary");
 906   }
 907 #endif
 908 
 909   // return if the protection domain in NULL
 910   if (protection_domain() == NULL) return k;
 911 
 912   // Check the protection domain has the right access
 913   {
 914     MutexLocker mu(SystemDictionary_lock, THREAD);
 915     if (dictionary->is_valid_protection_domain(d_index, d_hash, name,
 916                                                protection_domain)) {
 917       return k;
 918     }
 919   }
 920 
 921   // Verify protection domain. If it fails an exception is thrown
 922   validate_protection_domain(k, class_loader, protection_domain, CHECK_NULL);
 923 
 924   return k;
 925 }
 926 
 927 
 928 // This routine does not lock the system dictionary.
 929 //
 930 // Since readers don't hold a lock, we must make sure that system
 931 // dictionary entries are only removed at a safepoint (when only one
 932 // thread is running), and are added to in a safe way (all links must
 933 // be updated in an MT-safe manner).
 934 //
 935 // Callers should be aware that an entry could be added just after
 936 // _dictionary->bucket(index) is read here, so the caller will not see
 937 // the new entry.
 938 




 893 
 894   if (HAS_PENDING_EXCEPTION || k == NULL) {
 895     return NULL;
 896   }
 897 
 898   post_class_load_event(&class_load_start_event, k, loader_data);
 899 
 900 #ifdef ASSERT
 901   {
 902     ClassLoaderData* loader_data = k->class_loader_data();
 903     MutexLocker mu(SystemDictionary_lock, THREAD);
 904     Klass* kk = find_class(name, loader_data);
 905     assert(kk == k, "should be present in dictionary");
 906   }
 907 #endif
 908 
 909   // return if the protection domain in NULL
 910   if (protection_domain() == NULL) return k;
 911 
 912   // Check the protection domain has the right access


 913   if (dictionary->is_valid_protection_domain(d_index, d_hash, name,
 914                                              protection_domain)) {
 915     return k;

 916   }
 917 
 918   // Verify protection domain. If it fails an exception is thrown
 919   validate_protection_domain(k, class_loader, protection_domain, CHECK_NULL);
 920 
 921   return k;
 922 }
 923 
 924 
 925 // This routine does not lock the system dictionary.
 926 //
 927 // Since readers don't hold a lock, we must make sure that system
 928 // dictionary entries are only removed at a safepoint (when only one
 929 // thread is running), and are added to in a safe way (all links must
 930 // be updated in an MT-safe manner).
 931 //
 932 // Callers should be aware that an entry could be added just after
 933 // _dictionary->bucket(index) is read here, so the caller will not see
 934 // the new entry.
 935 


< prev index next >