57 ~Dictionary(); |
57 ~Dictionary(); |
58 |
58 |
59 static bool does_any_dictionary_needs_resizing(); |
59 static bool does_any_dictionary_needs_resizing(); |
60 bool resize_if_needed(); |
60 bool resize_if_needed(); |
61 |
61 |
62 DictionaryEntry* new_entry(unsigned int hash, InstanceKlass* klass); |
|
63 |
|
64 void add_klass(unsigned int hash, Symbol* class_name, InstanceKlass* obj); |
62 void add_klass(unsigned int hash, Symbol* class_name, InstanceKlass* obj); |
65 |
63 |
66 InstanceKlass* find_class(int index, unsigned int hash, Symbol* name); |
64 InstanceKlass* find_class(int index, unsigned int hash, Symbol* name); |
67 |
65 |
68 void classes_do(void f(InstanceKlass*)); |
66 void classes_do(void f(InstanceKlass*)); |
69 void classes_do(void f(InstanceKlass*, TRAPS), TRAPS); |
67 void classes_do(void f(InstanceKlass*, TRAPS), TRAPS); |
70 void all_entries_do(KlassClosure* closure); |
68 void all_entries_do(KlassClosure* closure); |
71 void classes_do(MetaspaceClosure* it); |
69 void classes_do(MetaspaceClosure* it); |
72 |
70 |
73 void unlink(); |
71 void clean_cached_protection_domains(); |
74 |
72 |
75 // Protection domains |
73 // Protection domains |
76 InstanceKlass* find(unsigned int hash, Symbol* name, Handle protection_domain); |
74 InstanceKlass* find(unsigned int hash, Symbol* name, Handle protection_domain); |
77 bool is_valid_protection_domain(unsigned int hash, |
75 bool is_valid_protection_domain(unsigned int hash, |
78 Symbol* name, |
76 Symbol* name, |
81 InstanceKlass* klass, |
79 InstanceKlass* klass, |
82 Handle protection_domain, TRAPS); |
80 Handle protection_domain, TRAPS); |
83 |
81 |
84 void print_on(outputStream* st) const; |
82 void print_on(outputStream* st) const; |
85 void verify(); |
83 void verify(); |
|
84 |
|
85 private: |
|
86 DictionaryEntry* new_entry(unsigned int hash, InstanceKlass* klass); |
|
87 |
86 DictionaryEntry* bucket(int i) const { |
88 DictionaryEntry* bucket(int i) const { |
87 return (DictionaryEntry*)Hashtable<InstanceKlass*, mtClass>::bucket(i); |
89 return (DictionaryEntry*)Hashtable<InstanceKlass*, mtClass>::bucket(i); |
88 } |
90 } |
89 |
91 |
90 // The following method is not MT-safe and must be done under lock. |
92 // The following method is not MT-safe and must be done under lock. |
149 } |
151 } |
150 |
152 |
151 ProtectionDomainEntry* pd_set() const { return _pd_set; } |
153 ProtectionDomainEntry* pd_set() const { return _pd_set; } |
152 void set_pd_set(ProtectionDomainEntry* new_head) { _pd_set = new_head; } |
154 void set_pd_set(ProtectionDomainEntry* new_head) { _pd_set = new_head; } |
153 |
155 |
154 ProtectionDomainEntry* pd_set_acquire() const; |
|
155 void release_set_pd_set(ProtectionDomainEntry* new_head); |
|
156 |
|
157 // Tells whether the initiating class' protection domain can access the klass in this entry |
156 // Tells whether the initiating class' protection domain can access the klass in this entry |
158 bool is_valid_protection_domain(Handle protection_domain) { |
157 bool is_valid_protection_domain(Handle protection_domain) { |
159 if (!ProtectionDomainVerification) return true; |
158 if (!ProtectionDomainVerification) return true; |
160 if (!SystemDictionary::has_checkPackageAccess()) return true; |
159 if (!SystemDictionary::has_checkPackageAccess()) return true; |
161 |
160 |
162 return protection_domain() == NULL |
161 return protection_domain() == NULL |
163 ? true |
162 ? true |
164 : contains_protection_domain(protection_domain()); |
163 : contains_protection_domain(protection_domain()); |
165 } |
164 } |
166 |
165 |
167 void verify_protection_domain_set() { |
166 void verify_protection_domain_set(); |
168 for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint |
|
169 current != NULL; |
|
170 current = current->_next) { |
|
171 guarantee(oopDesc::is_oop_or_null(current->_pd_cache->object_no_keepalive()), "Invalid oop"); |
|
172 } |
|
173 } |
|
174 |
167 |
175 bool equals(const Symbol* class_name) const { |
168 bool equals(const Symbol* class_name) const { |
176 InstanceKlass* klass = (InstanceKlass*)literal(); |
169 InstanceKlass* klass = (InstanceKlass*)literal(); |
177 return (klass->name() == class_name); |
170 return (klass->name() == class_name); |
178 } |
171 } |
179 |
172 |
180 void print_count(outputStream *st) { |
173 void print_count(outputStream *st); |
181 int count = 0; |
|
182 for (ProtectionDomainEntry* current = pd_set(); // accessed inside SD lock |
|
183 current != NULL; |
|
184 current = current->_next) { |
|
185 count++; |
|
186 } |
|
187 st->print_cr("pd set count = #%d", count); |
|
188 } |
|
189 |
|
190 void verify(); |
174 void verify(); |
191 }; |
175 }; |
192 |
176 |
193 // Entry in a SymbolPropertyTable, mapping a single Symbol* |
177 // Entry in a SymbolPropertyTable, mapping a single Symbol* |
194 // to a managed and an unmanaged pointer. |
178 // to a managed and an unmanaged pointer. |