< prev index next >

src/share/vm/classfile/systemDictionary.cpp

Print this page

        

@@ -340,17 +340,17 @@
     }
   }
 #endif // INCLUDE_CDS
 
   // Double-check, if child class is already loaded, just return super-class,interface
-  // Don't add a placedholder if already loaded, i.e. already in system dictionary
+  // Don't add a placedholder if already loaded, i.e. already in appropriate class loader
+  // dictionary.
   // Make sure there's a placeholder for the *child* before resolving.
   // Used as a claim that this thread is currently loading superclass/classloader
   // Used here for ClassCircularity checks and also for heap verification
-  // (every InstanceKlass in the heap needs to be in the system dictionary
-  // or have a placeholder).
-  // Must check ClassCircularity before checking if super class is already loaded
+  // (every InstanceKlass needs to be in its class loader dictionary or have a placeholder).
+  // Must check ClassCircularity before checking if super class is already loaded.
   //
   // We might not already have a placeholder if this child_name was
   // first seen via resolve_from_stream (jni_DefineClass or JVM_DefineClass);
   // the name of the class might not be known until the stream is actually
   // parsed.

@@ -443,10 +443,11 @@
     log->cr();
   }
 
   // This handle and the class_loader handle passed in keeps this class from
   // being unloaded through several GC points.
+  // The class_loader handle passed in is the initiating loader.
   Handle mirror(THREAD, klass->java_mirror());
 
   InstanceKlass* system_loader = SystemDictionary::ClassLoader_klass();
   JavaCalls::call_special(&result,
                          class_loader,

@@ -477,11 +478,10 @@
 
     MutexLocker mu(SystemDictionary_lock, THREAD);
     dictionary->add_protection_domain(d_index, d_hash, klass,
                                       protection_domain, THREAD);
   }
-}
 
 // We only get here if this thread finds that another thread
 // has already claimed the placeholder token for the current operation,
 // but that other thread either never owned or gave up the
 // object lock

@@ -950,16 +950,11 @@
     // If the ClassLoaderData has not been setup,
     // then the class loader has no entries in the dictionary.
     return NULL;
   }
 
-  Dictionary* dictionary = loader_data->dictionary_or_null();
-  // If ClassLoaderData has no dictionary, the class won't be found in it
-  if (dictionary == NULL) {
-    return NULL;
-  }
-
+  Dictionary* dictionary = loader_data->dictionary();
   unsigned int d_hash = dictionary->compute_hash(class_name);
   int d_index = dictionary->hash_to_index(d_hash);
   return dictionary->find(d_index, d_hash, class_name,
                           protection_domain);
 }

@@ -1043,11 +1038,11 @@
 
       // Add to class hierarchy, initialize vtables, and do possible
       // deoptimizations.
       add_to_hierarchy(k, CHECK_NULL); // No exception, but can block
 
-      // But, do not add to system dictionary.
+      // But, do not add to dictionary.
 
       // compiled code dependencies need to be validated anyway
       notice_modification();
     }
 

@@ -1816,14 +1811,11 @@
             VerifyBeforeExit    ||
             VerifyDuringStartup ||
             VerifyAfterGC, "too expensive");
   #endif
 
-  Dictionary* dictionary = loader_data->dictionary_or_null();
-  if (dictionary == NULL) {
-    return NULL;
-  }
+  Dictionary* dictionary = loader_data->dictionary();
   unsigned int d_hash = dictionary->compute_hash(class_name);
   int d_index = dictionary->hash_to_index(d_hash);
   return find_class(d_index, d_hash, class_name, dictionary);
 }
 

@@ -1849,18 +1841,10 @@
 }
 
 // ----------------------------------------------------------------------------
 // GC support
 
-// Following roots during mark-sweep is separated in two phases.
-//
-// The first phase follows preloaded classes and all other system
-// classes, since these will never get unloaded anyway.
-//
-// The second phase removes (unloads) unreachable classes from the
-// system dictionary and follows the remaining classes' contents.
-
 void SystemDictionary::always_strong_oops_do(OopClosure* blk) {
   roots_oops_do(blk, NULL);
 }
 
 

@@ -1869,11 +1853,11 @@
 private:
   BoolObjectClosure* _is_alive;
 
   template <class T> void do_oop_work(T* p) {
     oop obj = oopDesc::load_decode_heap_oop(p);
-    guarantee(_is_alive->do_object_b(obj), "Oop in system dictionary must be live");
+    guarantee(_is_alive->do_object_b(obj), "Oop in protection domain cache table must be live");
   }
 
 public:
   VerifySDReachableAndLiveClosure(BoolObjectClosure* is_alive) : OopClosure(), _is_alive(is_alive) { }
 

@@ -1904,11 +1888,11 @@
     resolution_errors()->purge_resolution_errors();
   }
 
   {
     GCTraceTime(Debug, gc, phases) t("ProtectionDomainCacheTable", gc_timer);
-    // Oops referenced by the system dictionary may get unreachable independently
+    // Oops referenced by the protection domain cache table may get unreachable independently
     // of the class loader (eg. cached protection domain oops). So we need to
     // explicitly unlink them here.
     _pd_cache_table->unlink(is_alive);
 
 #ifdef ASSERT

@@ -1928,11 +1912,10 @@
 void SystemDictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) {
   strong->do_oop(&_java_system_loader);
   strong->do_oop(&_system_loader_lock_obj);
   CDS_ONLY(SystemDictionaryShared::roots_oops_do(strong);)
 
-  // Adjust dictionary
   // Do strong roots marking if the closures are the same.
   if (strong == weak || !ClassUnloading) {
     // Only the protection domain oops contain references into the heap. Iterate
     // over all of them.
     _pd_cache_table->oops_do(strong);

@@ -2154,13 +2137,13 @@
 }
 
 // Constraints on class loaders. The details of the algorithm can be
 // found in the OOPSLA'98 paper "Dynamic Class Loading in the Java
 // Virtual Machine" by Sheng Liang and Gilad Bracha.  The basic idea is
-// that the system dictionary needs to maintain a set of contraints that
+// that the dictionary needs to maintain a set of contraints that
 // must be satisfied by all classes in the dictionary.
-// if defining is true, then LinkageError if already in systemDictionary
+// if defining is true, then LinkageError if already in dictionary
 // if initiating loader, then ok if InstanceKlass matches existing entry
 
 void SystemDictionary::check_constraints(int d_index, unsigned int d_hash,
                                          InstanceKlass* k,
                                          Handle class_loader, bool defining,

@@ -2176,11 +2159,11 @@
     InstanceKlass* check = find_class(d_index, d_hash, name, loader_data->dictionary());
     if (check != NULL) {
       // if different InstanceKlass - duplicate class definition,
       // else - ok, class loaded by a different thread in parallel,
       // we should only have found it if it was done loading and ok to use
-      // system dictionary only holds instance classes, placeholders
+      // dictionary only holds instance classes, placeholders
       // also holds array classes
 
       assert(check->is_instance_klass(), "noninstance in systemdictionary");
       if ((defining == true) || (k != check)) {
         linkage_error1 = "loader (instance of ";

@@ -2217,11 +2200,11 @@
     THROW_MSG(vmSymbols::java_lang_LinkageError(), buf);
   }
 }
 
 
-// Update system dictionary - done after check_constraint and add_to_hierachy
+// Update class loader data dictionary - done after check_constraint and add_to_hierachy
 // have been called.
 void SystemDictionary::update_dictionary(int d_index, unsigned int d_hash,
                                          int p_index, unsigned int p_hash,
                                          InstanceKlass* k,
                                          Handle class_loader,

@@ -2252,23 +2235,23 @@
       if (k->class_loader() == class_loader()) {
         k->set_prototype_header(markOopDesc::biased_locking_prototype());
       }
     }
 
-    // Make a new system dictionary entry.
+    // Make a new dictionary entry.
     Dictionary* dictionary = loader_data->dictionary();
     InstanceKlass* sd_check = find_class(d_index, d_hash, name, dictionary);
     if (sd_check == NULL) {
       dictionary->add_klass(d_index, d_hash, name, k);
       notice_modification();
     }
-  #ifdef ASSERT
+#ifdef ASSERT
     sd_check = find_class(d_index, d_hash, name, dictionary);
-    assert (sd_check != NULL, "should have entry in system dictionary");
+    assert (sd_check != NULL, "should have entry in dictionary");
     // Note: there may be a placeholder entry: for circularity testing
     // or for parallel defines
-  #endif
+#endif
     SystemDictionary_lock->notify_all();
   }
 }
 
 

@@ -2851,11 +2834,11 @@
 
 void SystemDictionary::verify() {
   guarantee(constraints() != NULL,
             "Verify of loader constraints failed");
   guarantee(placeholders()->number_of_entries() >= 0,
-            "Verify of system dictionary failed");
+            "Verify of placeholders failed");
 
   // Verify dictionary
   ClassLoaderDataGraph::verify_dictionary();
 
   GCMutexLocker mu(SystemDictionary_lock);
< prev index next >