951 952 // Verify the integrity of the allocated space. 953 if (metaspace_or_null() != NULL) { 954 metaspace_or_null()->verify(); 955 } 956 957 for (Klass* k = _klasses; k != NULL; k = k->next_link()) { 958 guarantee(k->class_loader_data() == this, "Must be the same"); 959 k->verify(); 960 assert(k != k->next_link(), "no loops!"); 961 } 962 } 963 964 bool ClassLoaderData::contains_klass(Klass* klass) { 965 // Lock-free access requires load_acquire 966 for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) { 967 if (k == klass) return true; 968 } 969 return false; 970 } | 951 952 // Verify the integrity of the allocated space. 953 if (metaspace_or_null() != NULL) { 954 metaspace_or_null()->verify(); 955 } 956 957 for (Klass* k = _klasses; k != NULL; k = k->next_link()) { 958 guarantee(k->class_loader_data() == this, "Must be the same"); 959 k->verify(); 960 assert(k != k->next_link(), "no loops!"); 961 } 962 } 963 964 bool ClassLoaderData::contains_klass(Klass* klass) { 965 // Lock-free access requires load_acquire 966 for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) { 967 if (k == klass) return true; 968 } 969 return false; 970 } 971 972 InstanceKlass* ClassLoaderData::replace_class(Symbol* class_name, InstanceKlass* k) { 973 assert_locked_or_safepoint(SystemDictionary_lock); 974 Dictionary* dict = dictionary(); 975 unsigned hash = dict->compute_hash(class_name); 976 int index = dict->hash_to_index(hash); 977 978 return dict->replace_class(index, hash, class_name, k); 979 } |