< prev index next >

src/hotspot/share/classfile/systemDictionaryShared.cpp

Print this page

@@ -503,13 +503,13 @@
       check_loader_lock_contention(lockObject, THREAD);
       ObjectLocker ol(lockObject, THREAD, DoObjectLock);
 
       {
         MutexLocker mu(SystemDictionary_lock, THREAD);
-        Klass* check = find_class(d_hash, name, dictionary);
+        InstanceKlass* check = find_class(d_hash, name, dictionary);
         if (check != NULL) {
-          return InstanceKlass::cast(check);
+          return check;
         }
       }
 
       k = load_shared_class_for_builtin_loader(name, class_loader, THREAD);
       if (k != NULL) {

@@ -522,14 +522,13 @@
 
 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);
+  InstanceKlass* ik = shared_dictionary()->find_class_for_builtin_loader(class_name);
 
-  if (k != NULL) {
-    InstanceKlass* ik = InstanceKlass::cast(k);
+  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,11 +591,11 @@
     // Do nothing for the BUILTIN loaders.
     return NULL;
   }
 
   ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
-  Klass* k;
+  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,11 +610,11 @@
 
   if (k == NULL) { // not archived
     return NULL;
   }
 
-  return acquire_class_for_current_thread(InstanceKlass::cast(k), class_loader,
+  return acquire_class_for_current_thread(k, class_loader,
                                           protection_domain, THREAD);
 }
 
 InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread(
                    InstanceKlass *ik,

@@ -670,11 +669,11 @@
 // 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(
+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,18 +697,18 @@
     return NULL;
   }
 }
 
 struct SharedMiscInfo {
-  Klass* _klass;
+  InstanceKlass* _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) {
+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,11 +728,11 @@
   misc_info._clsfile_crc32 = clsfile_crc32;
 
   misc_info_array->append(misc_info);
 }
 
-void SystemDictionaryShared::init_shared_dictionary_entry(Klass* k, DictionaryEntry* ent) {
+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,11 +749,11 @@
       }
     }
   }
 }
 
-bool SystemDictionaryShared::add_verification_constraint(Klass* k, Symbol* name,
+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,11 +793,11 @@
   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) {
+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,11 +967,11 @@
 
   for (SharedDictionaryEntry* entry = bucket(index);
                               entry != NULL;
                               entry = entry->next()) {
     if (entry->hash() == hash) {
-      Klass* klass = (Klass*)entry->literal();
+      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,26 +990,26 @@
 //-----------------
 // SharedDictionary
 //-----------------
 
 
-Klass* SharedDictionary::find_class_for_builtin_loader(const Symbol* name) const {
+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() : (Klass*)NULL;
+  return entry != NULL ? entry->instance_klass() : (InstanceKlass*)NULL;
 }
 
-Klass* SharedDictionary::find_class_for_unregistered_loader(const Symbol* name,
+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() : (Klass*)NULL;
+  return entry != NULL ? entry->instance_klass() : (InstanceKlass*)NULL;
 }
 
-void SharedDictionary::update_entry(Klass* klass, int id) {
+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 >