mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8175104: Unhandled oop in ProtectionDomainCacheTable::compute_hash
Pass Handle for protection_domain as it is mostly a Handle up the call stack Reviewed-by: hseigel, jiangli, dcubed
This commit is contained in:
parent
bf9a4cd8fb
commit
fcc9699132
2 changed files with 22 additions and 21 deletions
|
@ -61,7 +61,7 @@ Dictionary::Dictionary(int table_size, HashtableBucket<mtClass>* t,
|
|||
_pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
|
||||
};
|
||||
|
||||
ProtectionDomainCacheEntry* Dictionary::cache_get(oop protection_domain) {
|
||||
ProtectionDomainCacheEntry* Dictionary::cache_get(Handle protection_domain) {
|
||||
return _pd_cache_table->get(protection_domain);
|
||||
}
|
||||
|
||||
|
@ -123,9 +123,9 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
|
|||
}
|
||||
|
||||
|
||||
void DictionaryEntry::add_protection_domain(Dictionary* dict, oop protection_domain) {
|
||||
void DictionaryEntry::add_protection_domain(Dictionary* dict, Handle protection_domain) {
|
||||
assert_locked_or_safepoint(SystemDictionary_lock);
|
||||
if (!contains_protection_domain(protection_domain)) {
|
||||
if (!contains_protection_domain(protection_domain())) {
|
||||
ProtectionDomainCacheEntry* entry = dict->cache_get(protection_domain);
|
||||
ProtectionDomainEntry* new_head =
|
||||
new ProtectionDomainEntry(entry, _pd_set);
|
||||
|
@ -454,7 +454,7 @@ void Dictionary::add_protection_domain(int index, unsigned int hash,
|
|||
assert(protection_domain() != NULL,
|
||||
"real protection domain should be present");
|
||||
|
||||
entry->add_protection_domain(this, protection_domain());
|
||||
entry->add_protection_domain(this, protection_domain);
|
||||
|
||||
assert(entry->contains_protection_domain(protection_domain()),
|
||||
"now protection domain should be present");
|
||||
|
@ -505,11 +505,12 @@ void Dictionary::reorder_dictionary() {
|
|||
}
|
||||
|
||||
|
||||
unsigned int ProtectionDomainCacheTable::compute_hash(oop protection_domain) {
|
||||
unsigned int ProtectionDomainCacheTable::compute_hash(Handle protection_domain) {
|
||||
// Identity hash can safepoint, so keep protection domain in a Handle.
|
||||
return (unsigned int)(protection_domain->identity_hash());
|
||||
}
|
||||
|
||||
int ProtectionDomainCacheTable::index_for(oop protection_domain) {
|
||||
int ProtectionDomainCacheTable::index_for(Handle protection_domain) {
|
||||
return hash_to_index(compute_hash(protection_domain));
|
||||
}
|
||||
|
||||
|
@ -619,7 +620,7 @@ void ProtectionDomainCacheTable::always_strong_oops_do(OopClosure* f) {
|
|||
}
|
||||
}
|
||||
|
||||
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(oop protection_domain) {
|
||||
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_domain) {
|
||||
unsigned int hash = compute_hash(protection_domain);
|
||||
int index = hash_to_index(hash);
|
||||
|
||||
|
@ -630,9 +631,9 @@ ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(oop protection_domai
|
|||
return entry;
|
||||
}
|
||||
|
||||
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, oop protection_domain) {
|
||||
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, Handle protection_domain) {
|
||||
for (ProtectionDomainCacheEntry* e = bucket(index); e != NULL; e = e->next()) {
|
||||
if (e->protection_domain() == protection_domain) {
|
||||
if (e->protection_domain() == protection_domain()) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
@ -640,7 +641,7 @@ ProtectionDomainCacheEntry* ProtectionDomainCacheTable::find_entry(int index, oo
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, unsigned int hash, oop protection_domain) {
|
||||
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, unsigned int hash, Handle protection_domain) {
|
||||
assert_locked_or_safepoint(SystemDictionary_lock);
|
||||
assert(index == index_for(protection_domain), "incorrect index?");
|
||||
assert(find_entry(index, protection_domain) == NULL, "no double entry");
|
||||
|
@ -651,7 +652,7 @@ ProtectionDomainCacheEntry* ProtectionDomainCacheTable::add_entry(int index, uns
|
|||
}
|
||||
|
||||
void ProtectionDomainCacheTable::free(ProtectionDomainCacheEntry* to_delete) {
|
||||
unsigned int hash = compute_hash(to_delete->protection_domain());
|
||||
unsigned int hash = compute_hash(Handle(Thread::current(), to_delete->protection_domain()));
|
||||
int index = hash_to_index(hash);
|
||||
|
||||
ProtectionDomainCacheEntry** p = bucket_addr(index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue