Skip to content

Commit

Permalink
8264997: Remove SystemDictionary::cache_get
Browse files Browse the repository at this point in the history
Reviewed-by: hseigel
  • Loading branch information
coleenp committed Apr 9, 2021
1 parent 9ebc497 commit f26cd2a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
15 changes: 11 additions & 4 deletions src/hotspot/share/classfile/dictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/dictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/classfile/systemDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/classfile/systemDictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ class SystemDictionary : AllStatic {
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void main(String... args) throws Exception {
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",
Expand All @@ -53,7 +53,7 @@ public static void main(String... args) throws Exception {
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",
Expand Down

1 comment on commit f26cd2a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.