src/hotspot/share/classfile/systemDictionary.cpp
changeset 49658 8237a91c1cca
parent 49641 2ad3212a7dd9
child 49738 a7bc87a63dd8
equal deleted inserted replaced
49657:45071514f87a 49658:8237a91c1cca
   180 bool SystemDictionary::is_system_class_loader(oop class_loader) {
   180 bool SystemDictionary::is_system_class_loader(oop class_loader) {
   181   if (class_loader == NULL) {
   181   if (class_loader == NULL) {
   182     return false;
   182     return false;
   183   }
   183   }
   184   return (class_loader->klass() == SystemDictionary::jdk_internal_loader_ClassLoaders_AppClassLoader_klass() ||
   184   return (class_loader->klass() == SystemDictionary::jdk_internal_loader_ClassLoaders_AppClassLoader_klass() ||
   185        class_loader == _java_system_loader);
   185          oopDesc::equals(class_loader, _java_system_loader));
   186 }
   186 }
   187 
   187 
   188 // Returns true if the passed class loader is the platform class loader.
   188 // Returns true if the passed class loader is the platform class loader.
   189 bool SystemDictionary::is_platform_class_loader(oop class_loader) {
   189 bool SystemDictionary::is_platform_class_loader(oop class_loader) {
   190   if (class_loader == NULL) {
   190   if (class_loader == NULL) {
   389     // see: nsk redefclass014 & java.lang.instrument Instrument032
   389     // see: nsk redefclass014 & java.lang.instrument Instrument032
   390     if ((childk != NULL ) && (is_superclass) &&
   390     if ((childk != NULL ) && (is_superclass) &&
   391        ((quicksuperk = childk->super()) != NULL) &&
   391        ((quicksuperk = childk->super()) != NULL) &&
   392 
   392 
   393          ((quicksuperk->name() == class_name) &&
   393          ((quicksuperk->name() == class_name) &&
   394             (quicksuperk->class_loader()  == class_loader()))) {
   394             (oopDesc::equals(quicksuperk->class_loader(), class_loader())))) {
   395            return quicksuperk;
   395            return quicksuperk;
   396     } else {
   396     } else {
   397       PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data);
   397       PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data);
   398       if (probe && probe->check_seen_thread(THREAD, PlaceholderTable::LOAD_SUPER)) {
   398       if (probe && probe->check_seen_thread(THREAD, PlaceholderTable::LOAD_SUPER)) {
   399           throw_circularity_error = true;
   399           throw_circularity_error = true;
   523   assert_lock_strong(SystemDictionary_lock);
   523   assert_lock_strong(SystemDictionary_lock);
   524 
   524 
   525   bool calledholdinglock
   525   bool calledholdinglock
   526       = ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, lockObject);
   526       = ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD, lockObject);
   527   assert(calledholdinglock,"must hold lock for notify");
   527   assert(calledholdinglock,"must hold lock for notify");
   528   assert((!(lockObject() == _system_loader_lock_obj) && !is_parallelCapable(lockObject)), "unexpected double_lock_wait");
   528   assert((!oopDesc::equals(lockObject(), _system_loader_lock_obj) && !is_parallelCapable(lockObject)), "unexpected double_lock_wait");
   529   ObjectSynchronizer::notifyall(lockObject, THREAD);
   529   ObjectSynchronizer::notifyall(lockObject, THREAD);
   530   intptr_t recursions =  ObjectSynchronizer::complete_exit(lockObject, THREAD);
   530   intptr_t recursions =  ObjectSynchronizer::complete_exit(lockObject, THREAD);
   531   SystemDictionary_lock->wait();
   531   SystemDictionary_lock->wait();
   532   SystemDictionary_lock->unlock();
   532   SystemDictionary_lock->unlock();
   533   ObjectSynchronizer::reenter(lockObject, recursions, THREAD);
   533   ObjectSynchronizer::reenter(lockObject, recursions, THREAD);
   841       k = load_instance_class(name, class_loader, THREAD);
   841       k = load_instance_class(name, class_loader, THREAD);
   842 
   842 
   843       // If everything was OK (no exceptions, no null return value), and
   843       // If everything was OK (no exceptions, no null return value), and
   844       // class_loader is NOT the defining loader, do a little more bookkeeping.
   844       // class_loader is NOT the defining loader, do a little more bookkeeping.
   845       if (!HAS_PENDING_EXCEPTION && k != NULL &&
   845       if (!HAS_PENDING_EXCEPTION && k != NULL &&
   846         k->class_loader() != class_loader()) {
   846         !oopDesc::equals(k->class_loader(), class_loader())) {
   847 
   847 
   848         check_constraints(d_hash, k, class_loader, false, THREAD);
   848         check_constraints(d_hash, k, class_loader, false, THREAD);
   849 
   849 
   850         // Need to check for a PENDING_EXCEPTION again; check_constraints
   850         // Need to check for a PENDING_EXCEPTION again; check_constraints
   851         // can throw and doesn't use the CHECK macro.
   851         // can throw and doesn't use the CHECK macro.
   987 
   987 
   988   ClassLoaderData* loader_data;
   988   ClassLoaderData* loader_data;
   989   if (host_klass != NULL) {
   989   if (host_klass != NULL) {
   990     // Create a new CLD for anonymous class, that uses the same class loader
   990     // Create a new CLD for anonymous class, that uses the same class loader
   991     // as the host_klass
   991     // as the host_klass
   992     guarantee(host_klass->class_loader() == class_loader(), "should be the same");
   992     guarantee(oopDesc::equals(host_klass->class_loader(), class_loader()), "should be the same");
   993     loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader);
   993     loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader);
   994   } else {
   994   } else {
   995     loader_data = ClassLoaderData::class_loader_data(class_loader());
   995     loader_data = ClassLoaderData::class_loader_data(class_loader());
   996   }
   996   }
   997 
   997 
  1745 
  1745 
  1746   if (ObjectSynchronizer::query_lock_ownership((JavaThread*)THREAD, loader_lock)
  1746   if (ObjectSynchronizer::query_lock_ownership((JavaThread*)THREAD, loader_lock)
  1747       == ObjectSynchronizer::owner_other) {
  1747       == ObjectSynchronizer::owner_other) {
  1748     // contention will likely happen, so increment the corresponding
  1748     // contention will likely happen, so increment the corresponding
  1749     // contention counter.
  1749     // contention counter.
  1750     if (loader_lock() == _system_loader_lock_obj) {
  1750     if (oopDesc::equals(loader_lock(), _system_loader_lock_obj)) {
  1751       ClassLoader::sync_systemLoaderLockContentionRate()->inc();
  1751       ClassLoader::sync_systemLoaderLockContentionRate()->inc();
  1752     } else {
  1752     } else {
  1753       ClassLoader::sync_nonSystemLoaderLockContentionRate()->inc();
  1753       ClassLoader::sync_nonSystemLoaderLockContentionRate()->inc();
  1754     }
  1754     }
  1755   }
  1755   }
  2227     if (UseBiasedLocking && BiasedLocking::enabled()) {
  2227     if (UseBiasedLocking && BiasedLocking::enabled()) {
  2228       // Set biased locking bit for all loaded classes; it will be
  2228       // Set biased locking bit for all loaded classes; it will be
  2229       // cleared if revocation occurs too often for this type
  2229       // cleared if revocation occurs too often for this type
  2230       // NOTE that we must only do this when the class is initally
  2230       // NOTE that we must only do this when the class is initally
  2231       // defined, not each time it is referenced from a new class loader
  2231       // defined, not each time it is referenced from a new class loader
  2232       if (k->class_loader() == class_loader()) {
  2232       if (oopDesc::equals(k->class_loader(), class_loader())) {
  2233         k->set_prototype_header(markOopDesc::biased_locking_prototype());
  2233         k->set_prototype_header(markOopDesc::biased_locking_prototype());
  2234       }
  2234       }
  2235     }
  2235     }
  2236 
  2236 
  2237     // Make a new dictionary entry.
  2237     // Make a new dictionary entry.
  2419 // Arrays are not added to the loader constraint table, their elements are.
  2419 // Arrays are not added to the loader constraint table, their elements are.
  2420 Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
  2420 Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
  2421                                                Handle loader1, Handle loader2,
  2421                                                Handle loader1, Handle loader2,
  2422                                                bool is_method, TRAPS)  {
  2422                                                bool is_method, TRAPS)  {
  2423   // Nothing to do if loaders are the same.
  2423   // Nothing to do if loaders are the same.
  2424   if (loader1() == loader2()) {
  2424   if (oopDesc::equals(loader1(), loader2())) {
  2425     return NULL;
  2425     return NULL;
  2426   }
  2426   }
  2427 
  2427 
  2428   SignatureStream sig_strm(signature, is_method);
  2428   SignatureStream sig_strm(signature, is_method);
  2429   while (!sig_strm.is_done()) {
  2429   while (!sig_strm.is_done()) {