changeset 13053:880eee977f5f

Merge
author sspitsyn
date Mon, 19 Dec 2016 05:00:24 +0000
parents a8b0da531b64 3e47c23e9093
children 73aa17ad605c
files
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/moduleEntry.cpp	Sun Dec 18 20:54:26 2016 -0800
+++ b/src/share/vm/classfile/moduleEntry.cpp	Mon Dec 19 05:00:24 2016 +0000
@@ -108,6 +108,18 @@
   }
 
   MutexLocker m1(Module_lock);
+  // This is a guard against possible race between agent threads that redefine
+  // or retransform classes in this module. Only one of them is adding the
+  // default read edges to the unnamed modules of the boot and app class loaders
+  // with an upcall to jdk.internal.module.Modules.transformedByAgent.
+  // At the same time, another thread can instrument the module classes by
+  // injecting dependencies that require the default read edges for resolution.
+  if (this->has_default_read_edges() && !m->is_named()) {
+    ClassLoaderData* cld = m->loader_data();
+    if (cld->is_the_null_class_loader_data() || cld->is_system_class_loader_data()) {
+      return true; // default read edge
+    }
+  }
   if (!has_reads()) {
     return false;
   } else {