--- old/src/share/vm/classfile/dictionary.cpp 2017-08-24 14:17:54.630406745 -0400 +++ new/src/share/vm/classfile/dictionary.cpp 2017-08-24 14:17:54.127692602 -0400 @@ -136,11 +136,7 @@ ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain); ProtectionDomainEntry* new_head = new ProtectionDomainEntry(entry, _pd_set); - // Warning: Preserve store ordering. The SystemDictionary is read - // without locks. The new ProtectionDomainEntry must be - // complete before other threads can be allowed to see it - // via a store to _pd_set. - OrderAccess::release_store_ptr(&_pd_set, new_head); + set_pd_set(new_head); } LogTarget(Trace, protectiondomain) lt; if (lt.is_enabled()) { --- old/src/share/vm/classfile/dictionary.hpp 2017-08-24 14:18:03.302873712 -0400 +++ new/src/share/vm/classfile/dictionary.hpp 2017-08-24 14:18:03.036341029 -0400 @@ -29,6 +29,7 @@ #include "classfile/systemDictionary.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.hpp" +#include "runtime/orderAccess.hpp" #include "utilities/hashtable.hpp" #include "utilities/ostream.hpp" @@ -134,7 +135,7 @@ // It is essentially a cache to avoid repeated Java up-calls to // ClassLoader.checkPackageAccess(). // - ProtectionDomainEntry* _pd_set; + ProtectionDomainEntry* volatile _pd_set; public: // Tells whether a protection is in the approved set. @@ -153,8 +154,14 @@ return (DictionaryEntry**)HashtableEntry::next_addr(); } - ProtectionDomainEntry* pd_set() const { return _pd_set; } - void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; } + ProtectionDomainEntry* pd_set() const { return (ProtectionDomainEntry*)OrderAccess::load_ptr_acquire(&_pd_set); } + void set_pd_set(ProtectionDomainEntry* new_head) { + // Warning: Preserve store ordering. The SystemDictionary is read + // without locks. The new ProtectionDomainEntry must be + // complete before other threads can be allowed to see it + // via a store to _pd_set. + OrderAccess::release_store_ptr(&_pd_set, new_head); + } // Tells whether the initiating class' protection domain can access the klass in this entry bool is_valid_protection_domain(Handle protection_domain) { --- old/src/share/vm/classfile/systemDictionary.cpp 2017-08-24 14:18:12.378045424 -0400 +++ new/src/share/vm/classfile/systemDictionary.cpp 2017-08-24 14:18:11.932443440 -0400 @@ -914,12 +914,9 @@ if (protection_domain() == NULL) return k; // Check the protection domain has the right access - { - MutexLocker mu(SystemDictionary_lock, THREAD); - if (dictionary->is_valid_protection_domain(d_index, d_hash, name, - protection_domain)) { - return k; - } + if (dictionary->is_valid_protection_domain(d_index, d_hash, name, + protection_domain)) { + return k; } // Verify protection domain. If it fails an exception is thrown