< prev index next >

src/share/vm/classfile/dictionary.cpp

Print this page




  74   if (DumpSharedSpaces) {
  75     SystemDictionaryShared::init_shared_dictionary_entry(klass, entry);
  76   }
  77   return entry;
  78 }
  79 
  80 
  81 void Dictionary::free_entry(DictionaryEntry* entry) {
  82   // avoid recursion when deleting linked list
  83   while (entry->pd_set() != NULL) {
  84     ProtectionDomainEntry* to_delete = entry->pd_set();
  85     entry->set_pd_set(to_delete->next());
  86     delete to_delete;
  87   }
  88   Hashtable<Klass*, mtClass>::free_entry(entry);
  89 }
  90 
  91 
  92 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
  93 #ifdef ASSERT
  94   if (protection_domain == InstanceKlass::cast(klass())->protection_domain()) {
  95     // Ensure this doesn't show up in the pd_set (invariant)
  96     bool in_pd_set = false;
  97     for (ProtectionDomainEntry* current = _pd_set;
  98                                 current != NULL;
  99                                 current = current->next()) {
 100       if (current->protection_domain() == protection_domain) {
 101         in_pd_set = true;
 102         break;
 103       }
 104     }
 105     if (in_pd_set) {
 106       assert(false, "A klass's protection domain should not show up "
 107                     "in its sys. dict. PD set");
 108     }
 109   }
 110 #endif /* ASSERT */
 111 
 112   if (protection_domain == InstanceKlass::cast(klass())->protection_domain()) {
 113     // Succeeds trivially
 114     return true;
 115   }
 116 
 117   for (ProtectionDomainEntry* current = _pd_set;
 118                               current != NULL;
 119                               current = current->next()) {
 120     if (current->protection_domain() == protection_domain) return true;
 121   }
 122   return false;
 123 }
 124 
 125 
 126 void DictionaryEntry::add_protection_domain(Dictionary* dict, oop protection_domain) {
 127   assert_locked_or_safepoint(SystemDictionary_lock);
 128   if (!contains_protection_domain(protection_domain)) {
 129     ProtectionDomainCacheEntry* entry = dict->cache_get(protection_domain);
 130     ProtectionDomainEntry* new_head =
 131                 new ProtectionDomainEntry(entry, _pd_set);
 132     // Warning: Preserve store ordering.  The SystemDictionary is read


 747       ClassLoaderData* loader_data = probe->loader_data();
 748       guarantee(e->oop_is_instance(),
 749                               "Verify of system dictionary failed");
 750       // class loader must be present;  a null class loader is the
 751       // boostrap loader
 752       guarantee(loader_data != NULL || DumpSharedSpaces ||
 753                 loader_data->class_loader() == NULL ||
 754                 loader_data->class_loader()->is_instance(),
 755                 "checking type of class_loader");
 756       e->verify();
 757       probe->verify_protection_domain_set();
 758       element_count++;
 759     }
 760   }
 761   guarantee(number_of_entries() == element_count,
 762             "Verify of system dictionary failed");
 763   debug_only(verify_lookup_length((double)number_of_entries() / table_size()));
 764 
 765   _pd_cache_table->verify();
 766 }
 767 


  74   if (DumpSharedSpaces) {
  75     SystemDictionaryShared::init_shared_dictionary_entry(klass, entry);
  76   }
  77   return entry;
  78 }
  79 
  80 
  81 void Dictionary::free_entry(DictionaryEntry* entry) {
  82   // avoid recursion when deleting linked list
  83   while (entry->pd_set() != NULL) {
  84     ProtectionDomainEntry* to_delete = entry->pd_set();
  85     entry->set_pd_set(to_delete->next());
  86     delete to_delete;
  87   }
  88   Hashtable<Klass*, mtClass>::free_entry(entry);
  89 }
  90 
  91 
  92 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
  93 #ifdef ASSERT
  94   if (protection_domain == klass()->protection_domain()) {
  95     // Ensure this doesn't show up in the pd_set (invariant)
  96     bool in_pd_set = false;
  97     for (ProtectionDomainEntry* current = _pd_set;
  98                                 current != NULL;
  99                                 current = current->next()) {
 100       if (current->protection_domain() == protection_domain) {
 101         in_pd_set = true;
 102         break;
 103       }
 104     }
 105     if (in_pd_set) {
 106       assert(false, "A klass's protection domain should not show up "
 107                     "in its sys. dict. PD set");
 108     }
 109   }
 110 #endif /* ASSERT */
 111 
 112   if (protection_domain == klass()->protection_domain()) {
 113     // Succeeds trivially
 114     return true;
 115   }
 116 
 117   for (ProtectionDomainEntry* current = _pd_set;
 118                               current != NULL;
 119                               current = current->next()) {
 120     if (current->protection_domain() == protection_domain) return true;
 121   }
 122   return false;
 123 }
 124 
 125 
 126 void DictionaryEntry::add_protection_domain(Dictionary* dict, oop protection_domain) {
 127   assert_locked_or_safepoint(SystemDictionary_lock);
 128   if (!contains_protection_domain(protection_domain)) {
 129     ProtectionDomainCacheEntry* entry = dict->cache_get(protection_domain);
 130     ProtectionDomainEntry* new_head =
 131                 new ProtectionDomainEntry(entry, _pd_set);
 132     // Warning: Preserve store ordering.  The SystemDictionary is read


 747       ClassLoaderData* loader_data = probe->loader_data();
 748       guarantee(e->oop_is_instance(),
 749                               "Verify of system dictionary failed");
 750       // class loader must be present;  a null class loader is the
 751       // boostrap loader
 752       guarantee(loader_data != NULL || DumpSharedSpaces ||
 753                 loader_data->class_loader() == NULL ||
 754                 loader_data->class_loader()->is_instance(),
 755                 "checking type of class_loader");
 756       e->verify();
 757       probe->verify_protection_domain_set();
 758       element_count++;
 759     }
 760   }
 761   guarantee(number_of_entries() == element_count,
 762             "Verify of system dictionary failed");
 763   debug_only(verify_lookup_length((double)number_of_entries() / table_size()));
 764 
 765   _pd_cache_table->verify();
 766 }

< prev index next >