src/hotspot/share/classfile/classLoader.hpp
changeset 49340 4e82736053ae
parent 49037 dc68aeea4840
child 49612 f40a666a75bc
--- a/src/hotspot/share/classfile/classLoader.hpp	Mon Mar 05 13:15:10 2018 +0100
+++ b/src/hotspot/share/classfile/classLoader.hpp	Mon Mar 05 10:29:23 2018 -0500
@@ -27,7 +27,6 @@
 
 #include "jimage.hpp"
 #include "runtime/handles.hpp"
-#include "runtime/orderAccess.hpp"
 #include "runtime/perfData.hpp"
 #include "utilities/exceptions.hpp"
 #include "utilities/macros.hpp"
@@ -49,13 +48,9 @@
 private:
   ClassPathEntry* volatile _next;
 public:
-  // Next entry in class path
-  ClassPathEntry* next() const { return OrderAccess::load_acquire(&_next); }
+  ClassPathEntry* next() const;
   virtual ~ClassPathEntry() {}
-  void set_next(ClassPathEntry* next) {
-    // may have unlocked readers, so ensure visibility.
-    OrderAccess::release_store(&_next, next);
-  }
+  void set_next(ClassPathEntry* next);
   virtual bool is_modules_image() const = 0;
   virtual bool is_jar_file() const = 0;
   virtual const char* name() const = 0;
@@ -396,25 +391,7 @@
 
   static int compute_Object_vtable();
 
-  static ClassPathEntry* classpath_entry(int n) {
-    assert(n >= 0, "sanity");
-    if (n == 0) {
-      assert(has_jrt_entry(), "No class path entry at 0 for exploded module builds");
-      return ClassLoader::_jrt_entry;
-    } else {
-      // The java runtime image is always the first entry
-      // in the FileMapInfo::_classpath_entry_table. Even though
-      // the _jrt_entry is not included in the _first_append_entry
-      // linked list, it must be accounted for when comparing the
-      // class path vs. the shared archive class path.
-      ClassPathEntry* e = ClassLoader::_first_append_entry;
-      while (--n >= 1) {
-        assert(e != NULL, "Not that many classpath entries.");
-        e = e->next();
-      }
-      return e;
-    }
-  }
+  static ClassPathEntry* classpath_entry(int n);
 
   static bool is_in_patch_mod_entries(Symbol* module_name);
 
@@ -423,38 +400,13 @@
 
   // Helper function used by CDS code to get the number of boot classpath
   // entries during shared classpath setup time.
-  static int num_boot_classpath_entries() {
-    assert(DumpSharedSpaces, "Should only be called at CDS dump time");
-    assert(has_jrt_entry(), "must have a java runtime image");
-    int num_entries = 1; // count the runtime image
-    ClassPathEntry* e = ClassLoader::_first_append_entry;
-    while (e != NULL) {
-      num_entries ++;
-      e = e->next();
-    }
-    return num_entries;
-  }
+  static int num_boot_classpath_entries();
 
-  static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e) {
-    if (e == ClassLoader::_jrt_entry) {
-      return ClassLoader::_first_append_entry;
-    } else {
-      return e->next();
-    }
-  }
+  static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e);
 
   // Helper function used by CDS code to get the number of app classpath
   // entries during shared classpath setup time.
-  static int num_app_classpath_entries() {
-    assert(DumpSharedSpaces, "Should only be called at CDS dump time");
-    int num_entries = 0;
-    ClassPathEntry* e= ClassLoader::_app_classpath_entries;
-    while (e != NULL) {
-      num_entries ++;
-      e = e->next();
-    }
-    return num_entries;
-  }
+  static int num_app_classpath_entries();
 
   static void  check_shared_classpath(const char *path);
   static void  finalize_shared_paths_misc_info();