hotspot/src/share/vm/classfile/systemDictionary.cpp
changeset 42650 1f304d0c888b
parent 42639 762117d57d05
child 42876 ff8ff9dcccec
equal deleted inserted replaced
42649:28238583a459 42650:1f304d0c888b
    21  * questions.
    21  * questions.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
       
    26 #include "aot/aotLoader.hpp"
    26 #include "classfile/classFileParser.hpp"
    27 #include "classfile/classFileParser.hpp"
    27 #include "classfile/classFileStream.hpp"
    28 #include "classfile/classFileStream.hpp"
    28 #include "classfile/classLoader.hpp"
    29 #include "classfile/classLoader.hpp"
    29 #include "classfile/classLoaderData.inline.hpp"
    30 #include "classfile/classLoaderData.inline.hpp"
    30 #include "classfile/classLoaderExt.hpp"
    31 #include "classfile/classLoaderExt.hpp"
  1149 
  1150 
  1150   assert(k.not_null(), "no klass created");
  1151   assert(k.not_null(), "no klass created");
  1151   Symbol* h_name = k->name();
  1152   Symbol* h_name = k->name();
  1152   assert(class_name == NULL || class_name == h_name, "name mismatch");
  1153   assert(class_name == NULL || class_name == h_name, "name mismatch");
  1153 
  1154 
       
  1155   bool define_succeeded = false;
  1154   // Add class just loaded
  1156   // Add class just loaded
  1155   // If a class loader supports parallel classloading handle parallel define requests
  1157   // If a class loader supports parallel classloading handle parallel define requests
  1156   // find_or_define_instance_class may return a different InstanceKlass
  1158   // find_or_define_instance_class may return a different InstanceKlass
  1157   if (is_parallelCapable(class_loader)) {
  1159   if (is_parallelCapable(class_loader)) {
  1158     k = find_or_define_instance_class(h_name, class_loader, k, CHECK_NULL);
  1160     instanceKlassHandle defined_k = find_or_define_instance_class(h_name, class_loader, k, CHECK_NULL);
       
  1161     if (k() == defined_k()) {
       
  1162       // we have won over other concurrent threads (if any) that are
       
  1163       // competing to define the same class.
       
  1164       define_succeeded = true;
       
  1165     }
       
  1166     k = defined_k;
  1159   } else {
  1167   } else {
  1160     define_instance_class(k, CHECK_NULL);
  1168     define_instance_class(k, CHECK_NULL);
       
  1169     define_succeeded = true;
  1161   }
  1170   }
  1162 
  1171 
  1163   // Make sure we have an entry in the SystemDictionary on success
  1172   // Make sure we have an entry in the SystemDictionary on success
  1164   debug_only( {
  1173   debug_only( {
  1165     MutexLocker mu(SystemDictionary_lock, THREAD);
  1174     MutexLocker mu(SystemDictionary_lock, THREAD);
  1398       }
  1407       }
  1399     }
  1408     }
  1400 
  1409 
  1401     // notify a class loaded from shared object
  1410     // notify a class loaded from shared object
  1402     ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
  1411     ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
       
  1412   }
       
  1413 
       
  1414   ik->set_has_passed_fingerprint_check(false);
       
  1415   if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
       
  1416     uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik());
       
  1417     uint64_t cds_fp = ik->get_stored_fingerprint();
       
  1418     if (aot_fp != 0 && aot_fp == cds_fp) {
       
  1419       // This class matches with a class saved in an AOT library
       
  1420       ik->set_has_passed_fingerprint_check(true);
       
  1421     } else {
       
  1422       ResourceMark rm;
       
  1423       log_info(class, fingerprint)("%s :  expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
       
  1424     }
  1403   }
  1425   }
  1404   return ik;
  1426   return ik;
  1405 }
  1427 }
  1406 #endif // INCLUDE_CDS
  1428 #endif // INCLUDE_CDS
  1407 
  1429 
  1485       k = ClassLoader::load_class(class_name, search_only_bootloader_append, CHECK_(nh));
  1507       k = ClassLoader::load_class(class_name, search_only_bootloader_append, CHECK_(nh));
  1486     }
  1508     }
  1487 
  1509 
  1488     // find_or_define_instance_class may return a different InstanceKlass
  1510     // find_or_define_instance_class may return a different InstanceKlass
  1489     if (!k.is_null()) {
  1511     if (!k.is_null()) {
  1490       k = find_or_define_instance_class(class_name, class_loader, k, CHECK_(nh));
  1512       instanceKlassHandle defined_k =
       
  1513         find_or_define_instance_class(class_name, class_loader, k, CHECK_(nh));
       
  1514       k = defined_k;
  1491     }
  1515     }
  1492     return k;
  1516     return k;
  1493   } else {
  1517   } else {
  1494     // Use user specified class loader to load class. Call loadClass operation on class_loader.
  1518     // Use user specified class loader to load class. Call loadClass operation on class_loader.
  1495     ResourceMark rm(THREAD);
  1519     ResourceMark rm(THREAD);