src/share/vm/classfile/classLoaderData.hpp

Print this page
rev 4524 : 8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
Summary: Move initialization of dependencies to before allocation of CLD
Reviewed-by:

@@ -98,10 +98,13 @@
     void locked_add(objArrayHandle last,
                     objArrayHandle new_dependency,
                     Thread* THREAD);
    public:
     Dependencies() : _list_head(NULL) {}
+    Dependencies(TRAPS) : _list_head(NULL) {
+      init(CHECK);
+    }
     void add(Handle dependency, TRAPS);
     void init(TRAPS);
     void oops_do(OopClosure* f);
   };
 

@@ -148,11 +151,11 @@
   static Metaspace* _rw_metaspace;
 
   void set_next(ClassLoaderData* next) { _next = next; }
   ClassLoaderData* next() const        { return _next; }
 
-  ClassLoaderData(Handle h_class_loader, bool is_anonymous);
+  ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies);
   ~ClassLoaderData();
 
   void set_metaspace(Metaspace* m) { _metaspace = m; }
 
   JNIHandleBlock* handles() const;

@@ -188,11 +191,13 @@
   bool is_anonymous() const { return _is_anonymous; }
 
   static void init_null_class_loader_data() {
     assert(_the_null_class_loader_data == NULL, "cannot initialize twice");
     assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice");
-    _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false);
+
+    // We explicitly initialize the Dependencies object at a later phase in the initialization
+    _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false, Dependencies());
     ClassLoaderDataGraph::_head = _the_null_class_loader_data;
     assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be");
     if (DumpSharedSpaces) {
       _the_null_class_loader_data->initialize_shared_metaspaces();
     }