--- old/src/share/vm/classfile/moduleEntry.cpp 2017-08-11 17:45:45.380779139 -0400 +++ new/src/share/vm/classfile/moduleEntry.cpp 2017-08-11 17:45:45.116000818 -0400 @@ -80,8 +80,8 @@ } // Returns the shared ProtectionDomain -Handle ModuleEntry::shared_protection_domain() { - return Handle(Thread::current(), JNIHandles::resolve(_pd)); +oop ModuleEntry::shared_protection_domain() { + return _pd.resolve(); } // Set the shared ProtectionDomain atomically @@ -89,8 +89,8 @@ Handle pd_h) { // Create a handle for the shared ProtectionDomain and save it atomically. // If someone beats us setting the _pd cache, the created handle is destroyed. - jobject obj = loader_data->add_handle(pd_h); - if (Atomic::cmpxchg_ptr(obj, &_pd, NULL) != NULL) { + OopHandle obj = loader_data->add_handle(pd_h); + if (!_pd.set_atomic(obj)) { loader_data->remove_handle_unsafe(obj); } }