8264997: Remove SystemDictionary::cache_get

Reviewed-by: hseigel
This commit is contained in:
Coleen Phillimore 2021-04-09 20:47:06 +00:00
parent 9ebc497b53
commit f26cd2ac1c
5 changed files with 14 additions and 14 deletions

View File

@ -188,17 +188,24 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
return false;
}
void DictionaryEntry::add_protection_domain(Dictionary* dict, Handle protection_domain) {
assert_locked_or_safepoint(SystemDictionary_lock);
void DictionaryEntry::add_protection_domain(ClassLoaderData* loader_data, Handle protection_domain) {
assert_lock_strong(SystemDictionary_lock);
if (!contains_protection_domain(protection_domain())) {
ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain);
ProtectionDomainCacheEntry* entry = SystemDictionary::pd_cache_table()->get(protection_domain);
// Additions and deletions hold the SystemDictionary_lock, readers are lock-free
ProtectionDomainEntry* new_head = new ProtectionDomainEntry(entry, _pd_set);
release_set_pd_set(new_head);
}
LogTarget(Trace, protectiondomain) lt;
if (lt.is_enabled()) {
ResourceMark rm;
LogStream ls(lt);
ls.print("adding protection domain for class %s", instance_klass()->name()->as_C_string());
ls.print(" class loader: ");
loader_data->class_loader()->print_value_on(&ls);
ls.print(" protection domain: ");
protection_domain->print_value_on(&ls);
ls.print(" ");
print_count(&ls);
}
}
@ -335,7 +342,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(loader_data(), protection_domain);
#ifdef ASSERT
assert(loader_data() != ClassLoaderData::the_null_class_loader_data(), "doesn't make sense");

View File

@ -128,7 +128,7 @@ class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> {
// Tells whether a protection is in the approved set.
bool contains_protection_domain(oop protection_domain) const;
// Adds a protection domain to the approved set.
void add_protection_domain(Dictionary* dict, Handle protection_domain);
void add_protection_domain(ClassLoaderData* loader_data, Handle protection_domain);
InstanceKlass* instance_klass() const { return literal(); }
InstanceKlass** klass_addr() { return (InstanceKlass**)literal_addr(); }

View File

@ -2428,11 +2428,6 @@ void SystemDictionary::invoke_bootstrap_method(BootstrapInfo& bootstrap_specifie
bootstrap_specifier.resolved_method().not_null()), "bootstrap method call failed");
}
// Protection domain cache table handling
ProtectionDomainCacheEntry* SystemDictionary::cache_get(Handle protection_domain) {
return _pd_cache_table->get(protection_domain);
}
ClassLoaderData* SystemDictionary::class_loader_data(Handle class_loader) {
return ClassLoaderData::class_loader_data(class_loader());

View File

@ -293,8 +293,6 @@ public:
const char* message);
static const char* find_nest_host_error(const constantPoolHandle& pool, int which);
static ProtectionDomainCacheEntry* cache_get(Handle protection_domain);
private:
// Static tables owned by the SystemDictionary

View File

@ -44,7 +44,7 @@ public class ProtectionDomainVerificationTest {
new OutputAnalyzer(pb.start())
.shouldHaveExitValue(0)
.shouldContain("[protectiondomain] Checking package access")
.shouldContain("[protectiondomain] pd set count = #");
.shouldContain("[protectiondomain] adding protection domain for class");
// -Xlog:protectiondomain=debug
pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug",
@ -53,7 +53,7 @@ public class ProtectionDomainVerificationTest {
new OutputAnalyzer(pb.start())
.shouldHaveExitValue(0)
.shouldContain("[protectiondomain] Checking package access")
.shouldNotContain("pd set count = #");
.shouldNotContain("[protectiondomain] adding protection domain for class");
// -Xlog:protectiondomain=debug
pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace",