--- a/src/hotspot/share/oops/weakHandle.cpp Wed Apr 18 10:30:57 2018 -0700
+++ b/src/hotspot/share/oops/weakHandle.cpp Wed Apr 18 18:43:04 2018 -0400
@@ -51,8 +51,8 @@
void WeakHandle<T>::release() const {
// Only release if the pointer to the object has been created.
if (_obj != NULL) {
- // Clear the WeakHandle. For class loader data race, the handle may not have
- // been previously cleared by GC.
+ // Clear the WeakHandle. For race in creating ClassLoaderData, we can release this
+ // WeakHandle before it is cleared by GC.
RootAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, (oop)NULL);
get_storage()->release(_obj);
}