115 return _pd_cache->object_no_keepalive();
116 }
117
118 void ProtectionDomainCacheEntry::verify() {
119 guarantee(oopDesc::is_oop(object_no_keepalive()), "must be an oop");
120 }
121
122 ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_domain) {
123 unsigned int hash = compute_hash(protection_domain);
124 int index = hash_to_index(hash);
125
126 ProtectionDomainCacheEntry* entry = find_entry(index, protection_domain);
127 if (entry == NULL) {
128 entry = add_entry(index, hash, protection_domain);
129 }
130 return entry;
131 }
132
133 ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, Handle protection_domain) {
134 for (ProtectionDomainCacheEntry* e = bucket(index); e != NULL; e = e->next()) {
135 if (e->object_no_keepalive() == protection_domain()) {
136 return e;
137 }
138 }
139
140 return NULL;
141 }
142
143 ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, unsigned int hash, Handle protection_domain) {
144 assert_locked_or_safepoint(SystemDictionary_lock);
145 assert(index == index_for(protection_domain), "incorrect index?");
146 assert(find_entry(index, protection_domain) == NULL, "no double entry");
147
148 ProtectionDomainCacheEntry* p = new_entry(hash, protection_domain);
149 Hashtable<oop, mtClass>::add_entry(index, p);
150 return p;
151 }
|
115 return _pd_cache->object_no_keepalive();
116 }
117
118 void ProtectionDomainCacheEntry::verify() {
119 guarantee(oopDesc::is_oop(object_no_keepalive()), "must be an oop");
120 }
121
122 ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_domain) {
123 unsigned int hash = compute_hash(protection_domain);
124 int index = hash_to_index(hash);
125
126 ProtectionDomainCacheEntry* entry = find_entry(index, protection_domain);
127 if (entry == NULL) {
128 entry = add_entry(index, hash, protection_domain);
129 }
130 return entry;
131 }
132
133 ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, Handle protection_domain) {
134 for (ProtectionDomainCacheEntry* e = bucket(index); e != NULL; e = e->next()) {
135 if (oopDesc::equals(e->object_no_keepalive(), protection_domain())) {
136 return e;
137 }
138 }
139
140 return NULL;
141 }
142
143 ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, unsigned int hash, Handle protection_domain) {
144 assert_locked_or_safepoint(SystemDictionary_lock);
145 assert(index == index_for(protection_domain), "incorrect index?");
146 assert(find_entry(index, protection_domain) == NULL, "no double entry");
147
148 ProtectionDomainCacheEntry* p = new_entry(hash, protection_domain);
149 Hashtable<oop, mtClass>::add_entry(index, p);
150 return p;
151 }
|