< prev index next >

src/hotspot/share/classfile/dictionary.cpp

roman_version

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

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