changeset 56078:2d2c2428bf52

8230116: Test workaround to Klass::_class_loader_data sometimes NULL problem Summary: This is a low frequency problem that we are seeing internally, this patch is mostly to rule out one theory. Reviewed-by: dcubed
author coleenp
date Fri, 23 Aug 2019 23:27:19 +0000
parents 7ae075afc72f
children 427b38332f20 170b727a240a
files src/hotspot/share/oops/klass.cpp
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/oops/klass.cpp	Fri Aug 23 15:24:26 2019 -0400
+++ b/src/hotspot/share/oops/klass.cpp	Fri Aug 23 23:27:19 2019 +0000
@@ -568,6 +568,12 @@
     // Restore class_loader_data to the null class loader data
     set_class_loader_data(loader_data);
 
+    // Workaround for suspected bug.  Make sure other threads see this assignment.
+    // This shouldn't be necessary but the compiler thread seems to be behind
+    // the times, even though this thread takes MethodCompileQueue_lock and the thread
+    // that doesn't see this value also takes that lock.
+    OrderAccess::fence();
+
     // Add to null class loader list first before creating the mirror
     // (same order as class file parsing)
     loader_data->add_class(this);