< prev index next >
src/hotspot/share/classfile/systemDictionaryShared.cpp
Print this page
*** 503,515 ****
check_loader_lock_contention(lockObject, THREAD);
ObjectLocker ol(lockObject, THREAD, DoObjectLock);
{
MutexLocker mu(SystemDictionary_lock, THREAD);
! Klass* check = find_class(d_hash, name, dictionary);
if (check != NULL) {
! return InstanceKlass::cast(check);
}
}
k = load_shared_class_for_builtin_loader(name, class_loader, THREAD);
if (k != NULL) {
--- 503,515 ----
check_loader_lock_contention(lockObject, THREAD);
ObjectLocker ol(lockObject, THREAD, DoObjectLock);
{
MutexLocker mu(SystemDictionary_lock, THREAD);
! InstanceKlass* check = find_class(d_hash, name, dictionary);
if (check != NULL) {
! return check;
}
}
k = load_shared_class_for_builtin_loader(name, class_loader, THREAD);
if (k != NULL) {
*** 522,535 ****
InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
Symbol* class_name, Handle class_loader, TRAPS) {
assert(UseSharedSpaces, "must be");
assert(shared_dictionary() != NULL, "already checked");
! Klass* k = shared_dictionary()->find_class_for_builtin_loader(class_name);
! if (k != NULL) {
! InstanceKlass* ik = InstanceKlass::cast(k);
if ((ik->is_shared_app_class() &&
SystemDictionary::is_system_class_loader(class_loader())) ||
(ik->is_shared_platform_class() &&
SystemDictionary::is_platform_class_loader(class_loader()))) {
Handle protection_domain =
--- 522,534 ----
InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
Symbol* class_name, Handle class_loader, TRAPS) {
assert(UseSharedSpaces, "must be");
assert(shared_dictionary() != NULL, "already checked");
! InstanceKlass* ik = shared_dictionary()->find_class_for_builtin_loader(class_name);
! if (ik != NULL) {
if ((ik->is_shared_app_class() &&
SystemDictionary::is_system_class_loader(class_loader())) ||
(ik->is_shared_platform_class() &&
SystemDictionary::is_platform_class_loader(class_loader()))) {
Handle protection_domain =
*** 592,602 ****
// Do nothing for the BUILTIN loaders.
return NULL;
}
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
! Klass* k;
{ // UNREGISTERED loader
if (!shared_dictionary()->class_exists_for_unregistered_loader(class_name)) {
// No classes of this name for unregistered loaders.
return NULL;
--- 591,601 ----
// Do nothing for the BUILTIN loaders.
return NULL;
}
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
! InstanceKlass* k;
{ // UNREGISTERED loader
if (!shared_dictionary()->class_exists_for_unregistered_loader(class_name)) {
// No classes of this name for unregistered loaders.
return NULL;
*** 611,621 ****
if (k == NULL) { // not archived
return NULL;
}
! return acquire_class_for_current_thread(InstanceKlass::cast(k), class_loader,
protection_domain, THREAD);
}
InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread(
InstanceKlass *ik,
--- 610,620 ----
if (k == NULL) { // not archived
return NULL;
}
! return acquire_class_for_current_thread(k, class_loader,
protection_domain, THREAD);
}
InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread(
InstanceKlass *ik,
*** 670,680 ****
// where "super:" (and optionally "interface:") have been specified.
//
// java/lang/Object id: 0
// Interface id: 2 super: 0 source: cust.jar
// ChildClass id: 4 super: 0 interfaces: 2 source: cust.jar
! Klass* SystemDictionaryShared::dump_time_resolve_super_or_fail(
Symbol* child_name, Symbol* class_name, Handle class_loader,
Handle protection_domain, bool is_superclass, TRAPS) {
assert(DumpSharedSpaces, "only when dumping");
--- 669,679 ----
// where "super:" (and optionally "interface:") have been specified.
//
// java/lang/Object id: 0
// Interface id: 2 super: 0 source: cust.jar
// ChildClass id: 4 super: 0 interfaces: 2 source: cust.jar
! InstanceKlass* SystemDictionaryShared::dump_time_resolve_super_or_fail(
Symbol* child_name, Symbol* class_name, Handle class_loader,
Handle protection_domain, bool is_superclass, TRAPS) {
assert(DumpSharedSpaces, "only when dumping");
*** 698,715 ****
return NULL;
}
}
struct SharedMiscInfo {
! Klass* _klass;
int _clsfile_size;
int _clsfile_crc32;
};
static GrowableArray<SharedMiscInfo>* misc_info_array = NULL;
! void SystemDictionaryShared::set_shared_class_misc_info(Klass* k, ClassFileStream* cfs) {
assert(DumpSharedSpaces, "only when dumping");
int clsfile_size = cfs->length();
int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
if (misc_info_array == NULL) {
--- 697,714 ----
return NULL;
}
}
struct SharedMiscInfo {
! InstanceKlass* _klass;
int _clsfile_size;
int _clsfile_crc32;
};
static GrowableArray<SharedMiscInfo>* misc_info_array = NULL;
! void SystemDictionaryShared::set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs) {
assert(DumpSharedSpaces, "only when dumping");
int clsfile_size = cfs->length();
int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
if (misc_info_array == NULL) {
*** 729,739 ****
misc_info._clsfile_crc32 = clsfile_crc32;
misc_info_array->append(misc_info);
}
! void SystemDictionaryShared::init_shared_dictionary_entry(Klass* k, DictionaryEntry* ent) {
SharedDictionaryEntry* entry = (SharedDictionaryEntry*)ent;
entry->_id = -1;
entry->_clsfile_size = -1;
entry->_clsfile_crc32 = -1;
entry->_verifier_constraints = NULL;
--- 728,738 ----
misc_info._clsfile_crc32 = clsfile_crc32;
misc_info_array->append(misc_info);
}
! void SystemDictionaryShared::init_shared_dictionary_entry(InstanceKlass* k, DictionaryEntry* ent) {
SharedDictionaryEntry* entry = (SharedDictionaryEntry*)ent;
entry->_id = -1;
entry->_clsfile_size = -1;
entry->_clsfile_crc32 = -1;
entry->_verifier_constraints = NULL;
*** 750,760 ****
}
}
}
}
! bool SystemDictionaryShared::add_verification_constraint(Klass* k, Symbol* name,
Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
assert(DumpSharedSpaces, "called at dump time only");
// Skip anonymous classes, which are not archived as they are not in
// dictionary (see assert_no_anonymoys_classes_in_dictionaries() in
--- 749,759 ----
}
}
}
}
! bool SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
assert(DumpSharedSpaces, "called at dump time only");
// Skip anonymous classes, which are not archived as they are not in
// dictionary (see assert_no_anonymoys_classes_in_dictionaries() in
*** 794,804 ****
SharedDictionaryEntry* entry = shared_dictionary()->find_entry_for(klass);
assert(entry != NULL, "call this only for shared classes");
entry->check_verification_constraints(klass, THREAD);
}
! SharedDictionaryEntry* SharedDictionary::find_entry_for(Klass* klass) {
Symbol* class_name = klass->name();
unsigned int hash = compute_hash(class_name);
int index = hash_to_index(hash);
for (SharedDictionaryEntry* entry = bucket(index);
--- 793,803 ----
SharedDictionaryEntry* entry = shared_dictionary()->find_entry_for(klass);
assert(entry != NULL, "call this only for shared classes");
entry->check_verification_constraints(klass, THREAD);
}
! SharedDictionaryEntry* SharedDictionary::find_entry_for(InstanceKlass* klass) {
Symbol* class_name = klass->name();
unsigned int hash = compute_hash(class_name);
int index = hash_to_index(hash);
for (SharedDictionaryEntry* entry = bucket(index);
*** 968,978 ****
for (SharedDictionaryEntry* entry = bucket(index);
entry != NULL;
entry = entry->next()) {
if (entry->hash() == hash) {
! Klass* klass = (Klass*)entry->literal();
if (klass->name() == class_name && klass->class_loader_data() == loader_data) {
// There is already a class defined with the same name
return false;
}
}
--- 967,977 ----
for (SharedDictionaryEntry* entry = bucket(index);
entry != NULL;
entry = entry->next()) {
if (entry->hash() == hash) {
! InstanceKlass* klass = entry->instance_klass();
if (klass->name() == class_name && klass->class_loader_data() == loader_data) {
// There is already a class defined with the same name
return false;
}
}
*** 991,1016 ****
//-----------------
// SharedDictionary
//-----------------
! Klass* SharedDictionary::find_class_for_builtin_loader(const Symbol* name) const {
SharedDictionaryEntry* entry = get_entry_for_builtin_loader(name);
! return entry != NULL ? entry->instance_klass() : (Klass*)NULL;
}
! Klass* SharedDictionary::find_class_for_unregistered_loader(const Symbol* name,
int clsfile_size,
int clsfile_crc32) const {
const SharedDictionaryEntry* entry = get_entry_for_unregistered_loader(name,
clsfile_size,
clsfile_crc32);
! return entry != NULL ? entry->instance_klass() : (Klass*)NULL;
}
! void SharedDictionary::update_entry(Klass* klass, int id) {
assert(DumpSharedSpaces, "supported only when dumping");
Symbol* class_name = klass->name();
unsigned int hash = compute_hash(class_name);
int index = hash_to_index(hash);
--- 990,1015 ----
//-----------------
// SharedDictionary
//-----------------
! InstanceKlass* SharedDictionary::find_class_for_builtin_loader(const Symbol* name) const {
SharedDictionaryEntry* entry = get_entry_for_builtin_loader(name);
! return entry != NULL ? entry->instance_klass() : (InstanceKlass*)NULL;
}
! InstanceKlass* SharedDictionary::find_class_for_unregistered_loader(const Symbol* name,
int clsfile_size,
int clsfile_crc32) const {
const SharedDictionaryEntry* entry = get_entry_for_unregistered_loader(name,
clsfile_size,
clsfile_crc32);
! return entry != NULL ? entry->instance_klass() : NULL;
}
! void SharedDictionary::update_entry(InstanceKlass* klass, int id) {
assert(DumpSharedSpaces, "supported only when dumping");
Symbol* class_name = klass->name();
unsigned int hash = compute_hash(class_name);
int index = hash_to_index(hash);
< prev index next >