changeset 1045:5a9116284061 jigsaw-b01

Merge
author mr
date Fri, 06 Nov 2009 13:19:40 -0800
parents bc1144adedfb (current diff) d64033bba495 (diff)
children b41595900031
files .hgtags .jcheck/conf src/share/vm/runtime/arguments.cpp src/share/vm/runtime/globals.hpp
diffstat 11 files changed, 74 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Oct 30 10:54:34 2009 -0700
+++ b/.hgtags	Fri Nov 06 13:19:40 2009 -0800
@@ -24,6 +24,7 @@
 fcb923bad68e2b10380a030ea83a723f4dc3d4d6 jdk7-b47
 bcb33806d186561c781992e5f4d8a90bb033f9f0 jdk7-b48
 8b22ccb5aba2c6c11bddf6488a7bb7ef5b4bf2be jdk7-b49
+dcfe9cb00de5a5cc491e8bef72174ef7d43f5d3e j1-2009-demo
 dae503d9f04c1a11e182dbf7f770509c28dc0609 jdk7-b50
 2581d90c6c9b2012da930eb4742add94a03069a0 jdk7-b51
 1b1e8f1a4fe8cebc01c022484f78148e17b62a0d jdk7-b52
--- a/.jcheck/conf	Fri Oct 30 10:54:34 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-project=jdk7
--- a/make/linux/makefiles/mapfile-vers-debug	Fri Oct 30 10:54:34 2009 -0700
+++ b/make/linux/makefiles/mapfile-vers-debug	Fri Nov 06 13:19:40 2009 -0800
@@ -87,6 +87,7 @@
                 JVM_DumpThreads;
                 JVM_EnableCompiler;
                 JVM_Exit;
+                JVM_ExtendBootClassPath;
                 JVM_FillInStackTrace;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
--- a/make/linux/makefiles/mapfile-vers-product	Fri Oct 30 10:54:34 2009 -0700
+++ b/make/linux/makefiles/mapfile-vers-product	Fri Nov 06 13:19:40 2009 -0800
@@ -87,6 +87,7 @@
                 JVM_DumpThreads;
                 JVM_EnableCompiler;
                 JVM_Exit;
+                JVM_ExtendBootClassPath;
                 JVM_FillInStackTrace;
                 JVM_FindClassFromClass;
                 JVM_FindClassFromClassLoader;
--- a/src/share/vm/classfile/classLoader.cpp	Fri Oct 30 10:54:34 2009 -0700
+++ b/src/share/vm/classfile/classLoader.cpp	Fri Nov 06 13:19:40 2009 -0800
@@ -296,7 +296,10 @@
   const char* known_version = "% VERSION 2";
   char* meta_index_path = Arguments::get_meta_index_path();
   char* meta_index_dir  = Arguments::get_meta_index_dir();
-  FILE* file = fopen(meta_index_path, "r");
+  FILE* file = NULL;
+  if (meta_index_path != NULL) { // Will be null if we booted from a module
+    file = fopen(meta_index_path, "r");
+  }
   int line_no = 0;
   if (file != NULL) {
     ResourceMark rm;
@@ -532,12 +535,15 @@
     // File or directory found
     ClassPathEntry* new_entry = NULL;
     create_class_path_entry((char *)path, st, &new_entry, LazyBootClassLoader);
-    // The kernel VM adds dynamically to the end of the classloader path and
-    // doesn't reorder the bootclasspath which would break java.lang.Package
-    // (see PackageInfo).
-    // Add new entry to linked list
+    // The kernel VM, and Jigsaw, add dynamically to the end of the classloader
+    // path and don't reorder the bootclasspath, which would break
+    // java.lang.Package (see PackageInfo).
     if (!check_for_duplicates || !contains_entry(new_entry)) {
+      // Add new entry to linked list
       add_to_list(new_entry);
+      if (TraceClassLoading) {
+        print_bootclasspath();
+      }
     }
   }
 }
--- a/src/share/vm/classfile/classLoader.hpp	Fri Oct 30 10:54:34 2009 -0700
+++ b/src/share/vm/classfile/classLoader.hpp	Fri Nov 06 13:19:40 2009 -0800
@@ -207,7 +207,7 @@
   // to avoid confusing the zip library
   static bool get_canonical_path(char* orig, char* out, int len);
  public:
-  // Used by the kernel jvm.
+  // Used by the kernel jvm, and by Jigsaw via JVM_ExtendBootClassPath
   static void update_class_path_entry_list(const char *path,
                                            bool check_for_duplicates);
   static void print_bootclasspath();
--- a/src/share/vm/prims/jvm.cpp	Fri Oct 30 10:54:34 2009 -0700
+++ b/src/share/vm/prims/jvm.cpp	Fri Nov 06 13:19:40 2009 -0800
@@ -878,6 +878,17 @@
             (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
 JVM_END
 
+JVM_ENTRY(void, JVM_ExtendBootClassPath(JNIEnv *env, const char *path))
+  JVMWrapper2("JVM_ExtendBootClassPath(%s)", path)
+  {
+    // cf. SystemDictionary::download_and_retry_class_load
+    HandleMark hm(THREAD);
+    ResourceMark rm(THREAD);
+    Handle loader_lock(THREAD, SystemDictionary::system_loader_lock());
+    ObjectLocker ol(loader_lock, THREAD);
+    ClassLoader::update_class_path_entry_list(path, true);
+  }
+JVM_END
 
 // Reflection support //////////////////////////////////////////////////////////////////////////////
 
--- a/src/share/vm/prims/jvm.h	Fri Oct 30 10:54:34 2009 -0700
+++ b/src/share/vm/prims/jvm.h	Fri Nov 06 13:19:40 2009 -0800
@@ -437,6 +437,12 @@
                       jobjectArray constants);
 
 /*
+ * Append a path to the boot class path
+ */
+JNIEXPORT void JNICALL
+JVM_ExtendBootClassPath(JNIEnv *env, const char *path);
+
+/*
  * Reflection support functions
  */
 
--- a/src/share/vm/runtime/arguments.cpp	Fri Oct 30 10:54:34 2009 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Fri Nov 06 13:19:40 2009 -0800
@@ -45,6 +45,7 @@
 const char*  Arguments::_java_vendor_url_bug    = DEFAULT_VENDOR_URL_BUG;
 const char*  Arguments::_sun_java_launcher      = DEFAULT_JAVA_LAUNCHER;
 int    Arguments::_sun_java_launcher_pid        = -1;
+const char*  Arguments::_sun_java_launcher_module_boot = NULL;
 
 // These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*)
 bool   Arguments::_AlwaysCompileLoopMethods     = AlwaysCompileLoopMethods;
@@ -112,6 +113,10 @@
       _sun_java_launcher_pid = atoi(tail);
       continue;
     }
+    if (match_option(option, "-Dsun.java.launcher.module.boot=", &tail)) {
+      _sun_java_launcher_module_boot = strdup(tail);
+      continue;
+    }
   }
 }
 
@@ -867,6 +872,12 @@
       FreeHeap(value);
     }
     return true;
+  } else if (strcmp(key, "sun.java.launcher.module.boot") == 0) {
+    // Another private property
+    FreeHeap(key);
+    if (eq != NULL) {
+      FreeHeap(value);
+    }
   } else if (strcmp(key, "java.vendor.url.bug") == 0) {
     // save it in _java_vendor_url_bug, so JVM fatal error handler can access
     // its value without going through the property list or making a Java call.
--- a/src/share/vm/runtime/arguments.hpp	Fri Oct 30 10:54:34 2009 -0700
+++ b/src/share/vm/runtime/arguments.hpp	Fri Nov 06 13:19:40 2009 -0800
@@ -247,6 +247,10 @@
   // java/gamma launcher
   static const char* _sun_java_launcher;
 
+  // sun.java.launcher.module.boot, private property identifying
+  // the path from which to boot when in modular mode
+  static const char* _sun_java_launcher_module_boot;
+
   // sun.java.launcher.pid, private property
   static int    _sun_java_launcher_pid;
 
@@ -426,6 +430,10 @@
   static bool created_by_java_launcher();
   // -Dsun.java.launcher.pid
   static int sun_java_launcher_pid()        { return _sun_java_launcher_pid; }
+  // -Dsun.java.launcher.module.boot
+  static const char* sun_java_launcher_module_boot() {
+    return _sun_java_launcher_module_boot;
+  }
 
   // -Xloggc:<file>, if not specified will be NULL
   static const char* gc_log_filename()      { return _gc_log_filename; }
--- a/src/share/vm/runtime/os.cpp	Fri Oct 30 10:54:34 2009 -0700
+++ b/src/share/vm/runtime/os.cpp	Fri Nov 06 13:19:40 2009 -0800
@@ -865,6 +865,21 @@
 bool os::set_boot_path(char fileSep, char pathSep) {
     const char* home = Arguments::get_java_home();
     int home_len = (int)strlen(home);
+    const char* sjlmb = Arguments::sun_java_launcher_module_boot();
+
+    if (sjlmb) {
+      // Booting from a module
+      char buf[JVM_MAXPATHLEN];
+      if (!jio_snprintf(buf, sizeof(buf), "%%/%s", sjlmb)) {
+        assert(false, "Failed jio_snprintf");
+      } else {
+        char *scp = format_boot_path(buf, home, home_len,fileSep, pathSep);
+        if (scp) {
+          Arguments::set_sysclasspath(scp);
+          return true;
+        }
+      }
+    }
 
     static const char* meta_index_dir_format = "%/lib/";
     static const char* meta_index_format = "%/lib/meta-index";
@@ -884,6 +899,14 @@
         "%/lib/jsse.jar:"
         "%/lib/jce.jar:"
         "%/lib/charsets.jar:"
+
+        // ## TEMPORARY hack to keep the legacy launcher working when
+        // ## only the boot module is installed (cf. j.l.ClassLoader)
+        "%/lib/modules/jdk.boot/7-ea/classes:"
+        "%/lib/modules/jdk.boot/7-ea/classes.jar:"
+        "%/lib/modules/jdk.boot/7-ea/resources:"
+        "%/lib/modules/jdk.boot/7-ea/resources.jar:"
+
         "%/classes";
     char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep);
     if (sysclasspath == NULL) return false;