8194736: Refactor weak oops in ProtectionDomain table to use the Access API
Reviewed-by: coleenp, pliden
This commit is contained in:
parent
ca1e762c1f
commit
af5670373e
src/hotspot/share/classfile
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -167,7 +167,7 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
|
||||
for (ProtectionDomainEntry* current = pd_set_acquire();
|
||||
current != NULL;
|
||||
current = current->next()) {
|
||||
if (current->protection_domain() == protection_domain) {
|
||||
if (current->object_no_keepalive() == protection_domain) {
|
||||
in_pd_set = true;
|
||||
break;
|
||||
}
|
||||
@ -187,7 +187,7 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
|
||||
for (ProtectionDomainEntry* current = pd_set_acquire();
|
||||
current != NULL;
|
||||
current = current->next()) {
|
||||
if (current->protection_domain() == protection_domain) return true;
|
||||
if (current->object_no_keepalive() == protection_domain) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -189,7 +189,7 @@ class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> {
|
||||
for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint
|
||||
current != NULL;
|
||||
current = current->_next) {
|
||||
current->_pd_cache->protection_domain()->verify();
|
||||
current->_pd_cache->object_no_keepalive()->verify();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,14 +52,14 @@ void ProtectionDomainCacheTable::unlink(BoolObjectClosure* is_alive) {
|
||||
ProtectionDomainCacheEntry** p = bucket_addr(i);
|
||||
ProtectionDomainCacheEntry* entry = bucket(i);
|
||||
while (entry != NULL) {
|
||||
if (is_alive->do_object_b(entry->literal())) {
|
||||
if (is_alive->do_object_b(entry->object_no_keepalive())) {
|
||||
p = entry->next_addr();
|
||||
} else {
|
||||
LogTarget(Debug, protectiondomain) lt;
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
ls.print("protection domain unlinked: ");
|
||||
entry->literal()->print_value_on(&ls);
|
||||
entry->object_no_keepalive()->print_value_on(&ls);
|
||||
ls.cr();
|
||||
}
|
||||
*p = entry->next();
|
||||
@ -87,7 +87,7 @@ void ProtectionDomainCacheTable::print_on(outputStream* st) const {
|
||||
for (ProtectionDomainCacheEntry* probe = bucket(index);
|
||||
probe != NULL;
|
||||
probe = probe->next()) {
|
||||
st->print_cr("%4d: protection_domain: " PTR_FORMAT, index, p2i(probe->literal()));
|
||||
st->print_cr("%4d: protection_domain: " PTR_FORMAT, index, p2i(probe->object_no_keepalive()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,8 +96,27 @@ void ProtectionDomainCacheTable::verify() {
|
||||
verify_table<ProtectionDomainCacheEntry>("Protection Domain Table");
|
||||
}
|
||||
|
||||
oop ProtectionDomainCacheEntry::object() {
|
||||
return RootAccess<ON_PHANTOM_OOP_REF>::oop_load(literal_addr());
|
||||
}
|
||||
|
||||
oop ProtectionDomainEntry::object() {
|
||||
return _pd_cache->object();
|
||||
}
|
||||
|
||||
// The object_no_keepalive() call peeks at the phantomly reachable oop without
|
||||
// keeping it alive. This is okay to do in the VM thread state if it is not
|
||||
// leaked out to become strongly reachable.
|
||||
oop ProtectionDomainCacheEntry::object_no_keepalive() {
|
||||
return RootAccess<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>::oop_load(literal_addr());
|
||||
}
|
||||
|
||||
oop ProtectionDomainEntry::object_no_keepalive() {
|
||||
return _pd_cache->object_no_keepalive();
|
||||
}
|
||||
|
||||
void ProtectionDomainCacheEntry::verify() {
|
||||
guarantee(oopDesc::is_oop(literal()), "must be an oop");
|
||||
guarantee(oopDesc::is_oop(object_no_keepalive()), "must be an oop");
|
||||
}
|
||||
|
||||
ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_domain) {
|
||||
@ -113,7 +132,7 @@ ProtectionDomainCacheEntry* ProtectionDomainCacheTable::get(Handle protection_do
|
||||
|
||||
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->object_no_keepalive() == protection_domain()) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,7 +37,8 @@
|
||||
class ProtectionDomainCacheEntry : public HashtableEntry<oop, mtClass> {
|
||||
friend class VMStructs;
|
||||
public:
|
||||
oop protection_domain() { return literal(); }
|
||||
oop object();
|
||||
oop object_no_keepalive();
|
||||
|
||||
ProtectionDomainCacheEntry* next() {
|
||||
return (ProtectionDomainCacheEntry*)HashtableEntry<oop, mtClass>::next();
|
||||
@ -112,6 +113,7 @@ class ProtectionDomainEntry :public CHeapObj<mtClass> {
|
||||
}
|
||||
|
||||
ProtectionDomainEntry* next() { return _next; }
|
||||
oop protection_domain() { return _pd_cache->protection_domain(); }
|
||||
oop object();
|
||||
oop object_no_keepalive();
|
||||
};
|
||||
#endif // SHARE_VM_CLASSFILE_PROTECTIONDOMAINCACHE_HPP
|
||||
|
Loading…
x
Reference in New Issue
Block a user