hotspot/src/share/vm/classfile/systemDictionary.cpp
changeset 35492 c8c0273e6b91
parent 35475 c5e6cb508475
child 35606 d873b64009cc
child 35917 463d67f86eaa
equal deleted inserted replaced
35491:663c609dfeee 35492:c8c0273e6b91
   473     MutexLocker mu(SystemDictionary_lock, THREAD);
   473     MutexLocker mu(SystemDictionary_lock, THREAD);
   474     {
   474     {
   475       // Note that we have an entry, and entries can be deleted only during GC,
   475       // Note that we have an entry, and entries can be deleted only during GC,
   476       // so we cannot allow GC to occur while we're holding this entry.
   476       // so we cannot allow GC to occur while we're holding this entry.
   477 
   477 
   478       // We're using a No_Safepoint_Verifier to catch any place where we
   478       // We're using a NoSafepointVerifier to catch any place where we
   479       // might potentially do a GC at all.
   479       // might potentially do a GC at all.
   480       // Dictionary::do_unloading() asserts that classes in SD are only
   480       // Dictionary::do_unloading() asserts that classes in SD are only
   481       // unloaded at a safepoint. Anonymous classes are not in SD.
   481       // unloaded at a safepoint. Anonymous classes are not in SD.
   482       No_Safepoint_Verifier nosafepoint;
   482       NoSafepointVerifier nosafepoint;
   483       dictionary()->add_protection_domain(d_index, d_hash, klass, loader_data,
   483       dictionary()->add_protection_domain(d_index, d_hash, klass, loader_data,
   484                                           protection_domain, THREAD);
   484                                           protection_domain, THREAD);
   485     }
   485     }
   486   }
   486   }
   487 }
   487 }
   906   // Check the protection domain has the right access
   906   // Check the protection domain has the right access
   907   {
   907   {
   908     MutexLocker mu(SystemDictionary_lock, THREAD);
   908     MutexLocker mu(SystemDictionary_lock, THREAD);
   909     // Note that we have an entry, and entries can be deleted only during GC,
   909     // Note that we have an entry, and entries can be deleted only during GC,
   910     // so we cannot allow GC to occur while we're holding this entry.
   910     // so we cannot allow GC to occur while we're holding this entry.
   911     // We're using a No_Safepoint_Verifier to catch any place where we
   911     // We're using a NoSafepointVerifier to catch any place where we
   912     // might potentially do a GC at all.
   912     // might potentially do a GC at all.
   913     // Dictionary::do_unloading() asserts that classes in SD are only
   913     // Dictionary::do_unloading() asserts that classes in SD are only
   914     // unloaded at a safepoint. Anonymous classes are not in SD.
   914     // unloaded at a safepoint. Anonymous classes are not in SD.
   915     No_Safepoint_Verifier nosafepoint;
   915     NoSafepointVerifier nosafepoint;
   916     if (dictionary()->is_valid_protection_domain(d_index, d_hash, name,
   916     if (dictionary()->is_valid_protection_domain(d_index, d_hash, name,
   917                                                  loader_data,
   917                                                  loader_data,
   918                                                  protection_domain)) {
   918                                                  protection_domain)) {
   919       return k();
   919       return k();
   920     }
   920     }
   959   int d_index = dictionary()->hash_to_index(d_hash);
   959   int d_index = dictionary()->hash_to_index(d_hash);
   960 
   960 
   961   {
   961   {
   962     // Note that we have an entry, and entries can be deleted only during GC,
   962     // Note that we have an entry, and entries can be deleted only during GC,
   963     // so we cannot allow GC to occur while we're holding this entry.
   963     // so we cannot allow GC to occur while we're holding this entry.
   964     // We're using a No_Safepoint_Verifier to catch any place where we
   964     // We're using a NoSafepointVerifier to catch any place where we
   965     // might potentially do a GC at all.
   965     // might potentially do a GC at all.
   966     // Dictionary::do_unloading() asserts that classes in SD are only
   966     // Dictionary::do_unloading() asserts that classes in SD are only
   967     // unloaded at a safepoint. Anonymous classes are not in SD.
   967     // unloaded at a safepoint. Anonymous classes are not in SD.
   968     No_Safepoint_Verifier nosafepoint;
   968     NoSafepointVerifier nosafepoint;
   969     return dictionary()->find(d_index, d_hash, class_name, loader_data,
   969     return dictionary()->find(d_index, d_hash, class_name, loader_data,
   970                               protection_domain, THREAD);
   970                               protection_domain, THREAD);
   971   }
   971   }
   972 }
   972 }
   973 
   973 
  2208   int d_index2 = dictionary()->hash_to_index(d_hash2);
  2208   int d_index2 = dictionary()->hash_to_index(d_hash2);
  2209   {
  2209   {
  2210   MutexLocker mu_s(SystemDictionary_lock, THREAD);
  2210   MutexLocker mu_s(SystemDictionary_lock, THREAD);
  2211 
  2211 
  2212   // Better never do a GC while we're holding these oops
  2212   // Better never do a GC while we're holding these oops
  2213   No_Safepoint_Verifier nosafepoint;
  2213   NoSafepointVerifier nosafepoint;
  2214 
  2214 
  2215   Klass* klass1 = find_class(d_index1, d_hash1, constraint_name, loader_data1);
  2215   Klass* klass1 = find_class(d_index1, d_hash1, constraint_name, loader_data1);
  2216   Klass* klass2 = find_class(d_index2, d_hash2, constraint_name, loader_data2);
  2216   Klass* klass2 = find_class(d_index2, d_hash2, constraint_name, loader_data2);
  2217   return constraints()->add_entry(constraint_name, klass1, class_loader1,
  2217   return constraints()->add_entry(constraint_name, klass1, class_loader1,
  2218                                   klass2, class_loader2);
  2218                                   klass2, class_loader2);