< prev index next >

src/hotspot/share/classfile/dictionary.cpp

Print this page
rev 49250 : [mq]: JDK-8199781.patch


 144       desired_size = _resize_max_size;
 145       // We have reached the limit, turn resizing off
 146       _resizable = false;
 147     }
 148     if ((desired_size != 0) && (desired_size != table_size())) {
 149       if (!resize(desired_size)) {
 150         // Something went wrong, turn resizing off
 151         _resizable = false;
 152       }
 153     }
 154   }
 155 
 156   _needs_resizing = false;
 157   Dictionary::_some_dictionary_needs_resizing = false;
 158 
 159   return (desired_size != 0);
 160 }
 161 
 162 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
 163 #ifdef ASSERT
 164   if (protection_domain == instance_klass()->protection_domain()) {
 165     // Ensure this doesn't show up in the pd_set (invariant)
 166     bool in_pd_set = false;
 167     for (ProtectionDomainEntry* current = pd_set_acquire();
 168                                 current != NULL;
 169                                 current = current->next()) {
 170       if (current->object_no_keepalive() == protection_domain) {
 171         in_pd_set = true;
 172         break;
 173       }
 174     }
 175     if (in_pd_set) {
 176       assert(false, "A klass's protection domain should not show up "
 177                     "in its sys. dict. PD set");
 178     }
 179   }
 180 #endif /* ASSERT */
 181 
 182   if (protection_domain == instance_klass()->protection_domain()) {
 183     // Succeeds trivially
 184     return true;
 185   }
 186 
 187   for (ProtectionDomainEntry* current = pd_set_acquire();
 188                               current != NULL;
 189                               current = current->next()) {
 190     if (current->object_no_keepalive() == protection_domain) return true;
 191   }
 192   return false;
 193 }
 194 
 195 
 196 void DictionaryEntry::add_protection_domain(Dictionary* dict, Handle protection_domain) {
 197   assert_locked_or_safepoint(SystemDictionary_lock);
 198   if (!contains_protection_domain(protection_domain())) {
 199     ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain);
 200     ProtectionDomainEntry* new_head =
 201                 new ProtectionDomainEntry(entry, pd_set());
 202     // Warning: Preserve store ordering.  The SystemDictionary is read
 203     //          without locks.  The new ProtectionDomainEntry must be
 204     //          complete before other threads can be allowed to see it
 205     //          via a store to _pd_set.
 206     release_set_pd_set(new_head);
 207   }
 208   LogTarget(Trace, protectiondomain) lt;
 209   if (lt.is_enabled()) {
 210     LogStream ls(lt);




 144       desired_size = _resize_max_size;
 145       // We have reached the limit, turn resizing off
 146       _resizable = false;
 147     }
 148     if ((desired_size != 0) && (desired_size != table_size())) {
 149       if (!resize(desired_size)) {
 150         // Something went wrong, turn resizing off
 151         _resizable = false;
 152       }
 153     }
 154   }
 155 
 156   _needs_resizing = false;
 157   Dictionary::_some_dictionary_needs_resizing = false;
 158 
 159   return (desired_size != 0);
 160 }
 161 
 162 bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
 163 #ifdef ASSERT
 164   if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) {
 165     // Ensure this doesn't show up in the pd_set (invariant)
 166     bool in_pd_set = false;
 167     for (ProtectionDomainEntry* current = pd_set_acquire();
 168                                 current != NULL;
 169                                 current = current->next()) {
 170       if (oopDesc::equals(current->object_no_keepalive(), protection_domain)) {
 171         in_pd_set = true;
 172         break;
 173       }
 174     }
 175     if (in_pd_set) {
 176       assert(false, "A klass's protection domain should not show up "
 177                     "in its sys. dict. PD set");
 178     }
 179   }
 180 #endif /* ASSERT */
 181 
 182   if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) {
 183     // Succeeds trivially
 184     return true;
 185   }
 186 
 187   for (ProtectionDomainEntry* current = pd_set_acquire();
 188                               current != NULL;
 189                               current = current->next()) {
 190     if (oopDesc::equals(current->object_no_keepalive(), protection_domain)) return true;
 191   }
 192   return false;
 193 }
 194 
 195 
 196 void DictionaryEntry::add_protection_domain(Dictionary* dict, Handle protection_domain) {
 197   assert_locked_or_safepoint(SystemDictionary_lock);
 198   if (!contains_protection_domain(protection_domain())) {
 199     ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain);
 200     ProtectionDomainEntry* new_head =
 201                 new ProtectionDomainEntry(entry, pd_set());
 202     // Warning: Preserve store ordering.  The SystemDictionary is read
 203     //          without locks.  The new ProtectionDomainEntry must be
 204     //          complete before other threads can be allowed to see it
 205     //          via a store to _pd_set.
 206     release_set_pd_set(new_head);
 207   }
 208   LogTarget(Trace, protectiondomain) lt;
 209   if (lt.is_enabled()) {
 210     LogStream ls(lt);


< prev index next >