From 05322fdd98f014b024485f08dd6b24d105280a25 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 23 Aug 2019 23:27:19 +0000 Subject: [PATCH] 8230116: Test workaround to Klass::_class_loader_data sometimes NULL problem This is a low frequency problem that we are seeing internally, this patch is mostly to rule out one theory. Reviewed-by: dcubed --- src/hotspot/share/oops/klass.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hotspot/share/oops/klass.cpp b/src/hotspot/share/oops/klass.cpp index 1b07e066514..42e61e34d21 100644 --- a/src/hotspot/share/oops/klass.cpp +++ b/src/hotspot/share/oops/klass.cpp @@ -568,6 +568,12 @@ void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protec // 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);