Skip to content

Commit f26cd2a

Browse files
committedApr 9, 2021
8264997: Remove SystemDictionary::cache_get
Reviewed-by: hseigel
1 parent 9ebc497 commit f26cd2a

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed
 

‎src/hotspot/share/classfile/dictionary.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,24 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
188188
return false;
189189
}
190190

191-
void DictionaryEntry::add_protection_domain(Dictionary* dict, Handle protection_domain) {
192-
assert_locked_or_safepoint(SystemDictionary_lock);
191+
void DictionaryEntry::add_protection_domain(ClassLoaderData* loader_data, Handle protection_domain) {
192+
assert_lock_strong(SystemDictionary_lock);
193193
if (!contains_protection_domain(protection_domain())) {
194-
ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain);
194+
ProtectionDomainCacheEntry* entry = SystemDictionary::pd_cache_table()->get(protection_domain);
195195
// Additions and deletions hold the SystemDictionary_lock, readers are lock-free
196196
ProtectionDomainEntry* new_head = new ProtectionDomainEntry(entry, _pd_set);
197197
release_set_pd_set(new_head);
198198
}
199199
LogTarget(Trace, protectiondomain) lt;
200200
if (lt.is_enabled()) {
201+
ResourceMark rm;
201202
LogStream ls(lt);
203+
ls.print("adding protection domain for class %s", instance_klass()->name()->as_C_string());
204+
ls.print(" class loader: ");
205+
loader_data->class_loader()->print_value_on(&ls);
206+
ls.print(" protection domain: ");
207+
protection_domain->print_value_on(&ls);
208+
ls.print(" ");
202209
print_count(&ls);
203210
}
204211
}
@@ -335,7 +342,7 @@ void Dictionary::add_protection_domain(int index, unsigned int hash,
335342
assert(protection_domain() != NULL,
336343
"real protection domain should be present");
337344

338-
entry->add_protection_domain(this, protection_domain);
345+
entry->add_protection_domain(loader_data(), protection_domain);
339346

340347
#ifdef ASSERT
341348
assert(loader_data() != ClassLoaderData::the_null_class_loader_data(), "doesn't make sense");

‎src/hotspot/share/classfile/dictionary.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> {
128128
// Tells whether a protection is in the approved set.
129129
bool contains_protection_domain(oop protection_domain) const;
130130
// Adds a protection domain to the approved set.
131-
void add_protection_domain(Dictionary* dict, Handle protection_domain);
131+
void add_protection_domain(ClassLoaderData* loader_data, Handle protection_domain);
132132

133133
InstanceKlass* instance_klass() const { return literal(); }
134134
InstanceKlass** klass_addr() { return (InstanceKlass**)literal_addr(); }

‎src/hotspot/share/classfile/systemDictionary.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -2428,11 +2428,6 @@ void SystemDictionary::invoke_bootstrap_method(BootstrapInfo& bootstrap_specifie
24282428
bootstrap_specifier.resolved_method().not_null()), "bootstrap method call failed");
24292429
}
24302430

2431-
// Protection domain cache table handling
2432-
2433-
ProtectionDomainCacheEntry* SystemDictionary::cache_get(Handle protection_domain) {
2434-
return _pd_cache_table->get(protection_domain);
2435-
}
24362431

24372432
ClassLoaderData* SystemDictionary::class_loader_data(Handle class_loader) {
24382433
return ClassLoaderData::class_loader_data(class_loader());

‎src/hotspot/share/classfile/systemDictionary.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,6 @@ class SystemDictionary : AllStatic {
293293
const char* message);
294294
static const char* find_nest_host_error(const constantPoolHandle& pool, int which);
295295

296-
static ProtectionDomainCacheEntry* cache_get(Handle protection_domain);
297-
298296
private:
299297
// Static tables owned by the SystemDictionary
300298

‎test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static void main(String... args) throws Exception {
4444
new OutputAnalyzer(pb.start())
4545
.shouldHaveExitValue(0)
4646
.shouldContain("[protectiondomain] Checking package access")
47-
.shouldContain("[protectiondomain] pd set count = #");
47+
.shouldContain("[protectiondomain] adding protection domain for class");
4848

4949
// -Xlog:protectiondomain=debug
5050
pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug",
@@ -53,7 +53,7 @@ public static void main(String... args) throws Exception {
5353
new OutputAnalyzer(pb.start())
5454
.shouldHaveExitValue(0)
5555
.shouldContain("[protectiondomain] Checking package access")
56-
.shouldNotContain("pd set count = #");
56+
.shouldNotContain("[protectiondomain] adding protection domain for class");
5757

5858
// -Xlog:protectiondomain=debug
5959
pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace",

0 commit comments

Comments
 (0)
Please sign in to comment.