comparison src/share/vm/classfile/systemDictionary.cpp @ 8667:1f9994892f89

8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive Summary: SystemDictionary::find(...) should not create and register ClassLoaderData objects for class loaders. Reviewed-by: coleenp, acorn Contributed-by: Stefan Karlsson <stefan.karlsson@oracle.com>, Erik Helin <erik.helin@oracle.com>
author stefank
date Thu, 21 Feb 2013 17:22:15 +0100
parents 8b46b0196eb0
children 1fc4d4768b90
comparison
equal deleted inserted replaced
8106:ec2eddfed950 8667:1f9994892f89
864 // Callers should be aware that an entry could be added just after 864 // Callers should be aware that an entry could be added just after
865 // _dictionary->bucket(index) is read here, so the caller will not see 865 // _dictionary->bucket(index) is read here, so the caller will not see
866 // the new entry. 866 // the new entry.
867 867
868 Klass* SystemDictionary::find(Symbol* class_name, 868 Klass* SystemDictionary::find(Symbol* class_name,
869 Handle class_loader, 869 Handle class_loader,
870 Handle protection_domain, 870 Handle protection_domain,
871 TRAPS) { 871 TRAPS) {
872 872
873 // UseNewReflection 873 // UseNewReflection
874 // The result of this call should be consistent with the result 874 // The result of this call should be consistent with the result
875 // of the call to resolve_instance_class_or_null(). 875 // of the call to resolve_instance_class_or_null().
876 // See evaluation 6790209 and 4474172 for more details. 876 // See evaluation 6790209 and 4474172 for more details.
877 class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader())); 877 class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
878 ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL); 878 ClassLoaderData* loader_data = ClassLoaderData::class_loader_data_or_null(class_loader());
879
880 if (loader_data == NULL) {
881 // If the ClassLoaderData has not been setup,
882 // then the class loader has no entries in the dictionary.
883 return NULL;
884 }
879 885
880 unsigned int d_hash = dictionary()->compute_hash(class_name, loader_data); 886 unsigned int d_hash = dictionary()->compute_hash(class_name, loader_data);
881 int d_index = dictionary()->hash_to_index(d_hash); 887 int d_index = dictionary()->hash_to_index(d_hash);
882 888
883 { 889 {