diff src/share/vm/runtime/arguments.cpp @ 8135:8d10fc6b4f6c

graal.jar is now the only way Graal is deployed in the VM (GRAAL-136)
author Doug Simon <doug.simon@oracle.com>
date Wed, 06 Mar 2013 20:48:32 +0100
parents 5fc51c1ecdeb
children b8f261ba79c6
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp	Wed Mar 06 20:25:57 2013 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Wed Mar 06 20:48:32 2013 +0100
@@ -105,9 +105,6 @@
 SystemProperty *Arguments::_java_home = NULL;
 SystemProperty *Arguments::_java_class_path = NULL;
 SystemProperty *Arguments::_sun_boot_class_path = NULL;
-#ifdef GRAAL
-SystemProperty *Arguments::_compiler_class_path = NULL;
-#endif
 
 char* Arguments::_meta_index_path = NULL;
 char* Arguments::_meta_index_dir = NULL;
@@ -169,9 +166,6 @@
   _java_library_path = new SystemProperty("java.library.path", NULL,  true);
   _java_home =  new SystemProperty("java.home", NULL,  true);
   _sun_boot_class_path = new SystemProperty("sun.boot.class.path", NULL,  true);
-#ifdef GRAAL
-  _compiler_class_path = new SystemProperty("compiler.class.path", NULL,  true);
-#endif
 
   _java_class_path = new SystemProperty("java.class.path", "",  true);
 
@@ -183,9 +177,6 @@
   PropertyList_add(&_system_properties, _java_home);
   PropertyList_add(&_system_properties, _java_class_path);
   PropertyList_add(&_system_properties, _sun_boot_class_path);
-#ifdef GRAAL
-  PropertyList_add(&_system_properties, _compiler_class_path);
-#endif
 
   // Set OS specific system properties values
   os::init_system_properties_values();
@@ -2189,59 +2180,6 @@
 }
 
 // Parse JavaVMInitArgs structure
-#ifdef GRAAL
-static void prepend_to_graal_classpath(SysClassPath &cp, const char* path) {
-  cp.add_prefix(path);
-}
-
-static void prepend_to_graal_classpath(SysClassPath &cp, const char* graal_dir, const char* project) {
-  const int BUFFER_SIZE = 1024;
-  char path[BUFFER_SIZE];
-
-  const char fileSep = *os::file_separator();
-  sprintf(path, "%s%c%s%cbin", graal_dir, fileSep, project, fileSep);
-  
-  DIR* dir = os::opendir(path);
-  if (dir == NULL) {
-    jio_fprintf(defaultStream::output_stream(), "Error while starting Graal VM: The Graal class directory %s could not be opened.\n", path);
-    vm_exit(1);
-  }
-  os::closedir(dir);
-  prepend_to_graal_classpath(cp, path);
-}
-
-// Walk up the directory hierarchy starting from JAVA_HOME looking
-// for a directory named "graal". If found, then the full path to
-// this directory is returned in graal_dir.
-static bool find_graal_dir(char* graal_dir) {
-  strcpy(graal_dir, Arguments::get_java_home());
-  char* end = graal_dir + strlen(graal_dir);
-  const char fileSep = *os::file_separator();
-  while (end != graal_dir) {
-    if (fileSep == '/') 
-      strcat(graal_dir, "/graal");
-    else {
-      assert(fileSep == '\\', "unexpected separator char");
-      strcat(graal_dir, "\\graal");
-    }
-    DIR* dir = os::opendir(graal_dir);
-    if (dir != NULL) {
-      os::closedir(dir);
-      return true;
-    }
-    *end = 0;
-    while (end != graal_dir) {
-      if (*end == fileSep) {
-        *end = 0;
-        break;
-      }
-      end--;
-    }
-  }
-  return false;
-}
-#endif
-
 jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) {
   // For components of the system classpath.
   SysClassPath scp(Arguments::get_sysclasspath());
@@ -2268,72 +2206,6 @@
     return result;
   }
 
-#ifdef GRAAL
-    if (PrintVMOptions) {
-      tty->print_cr("Running Graal VM... ");
-    }
-
-    SysClassPath scp_compiler("");
-
-    if (GraalClassPath != NULL) {
-      prepend_to_graal_classpath(scp_compiler, GraalClassPath);
-    } else {
-      const int BUFFER_SIZE = 1024;
-      char graal_dir[BUFFER_SIZE];
-      if (!os::getenv("GRAAL", graal_dir, sizeof(graal_dir))) {
-        if (find_graal_dir(graal_dir) == false) {
-          jio_fprintf(defaultStream::output_stream(), "Error while starting Graal VM: The GRAAL environment variable needs to point to the directory containing the Graal projects.\n");
-          vm_exit(0);
-        }
-      }
-      if (PrintVMOptions) tty->print_cr("GRAAL=%s", graal_dir);
-    
-      // this declaration is checked for correctness by 'mx build' - only
-      // modify its entries, not its name or shape
-      const char* graal_projects[] = {
-  #ifdef AMD64
-          "com.oracle.graal.amd64",
-          "com.oracle.graal.asm.amd64",
-          "com.oracle.graal.lir.amd64",
-          "com.oracle.graal.compiler.amd64",
-          "com.oracle.graal.hotspot.amd64",
-  #endif
-          "com.oracle.graal.api.runtime",
-          "com.oracle.graal.api.meta",
-          "com.oracle.graal.api.code",
-          "com.oracle.graal.hotspot",
-          "com.oracle.graal.asm",
-          "com.oracle.graal.alloc",
-          "com.oracle.graal.word",
-          "com.oracle.graal.snippets",
-          "com.oracle.graal.compiler",
-          "com.oracle.graal.loop",
-          "com.oracle.graal.phases",
-          "com.oracle.graal.phases.common",
-          "com.oracle.graal.virtual",
-          "com.oracle.graal.nodes",
-          "com.oracle.graal.printer",
-          "com.oracle.graal.debug",
-          "com.oracle.graal.graph",
-          "com.oracle.graal.lir",
-          "com.oracle.graal.bytecode",
-          "com.oracle.graal.java"
-      };
-            
-      const int len = sizeof(graal_projects) / sizeof(char*);
-      for (int i = 0; i < len; i++) {
-        if (PrintVMOptions) {
-          tty->print_cr("Adding project directory %s to bootclasspath", graal_projects[i]);
-        }
-        prepend_to_graal_classpath(scp_compiler, graal_dir, graal_projects[i]);
-      }
-    }
-
-    scp_compiler.expand_endorsed();
-    Arguments::set_compilerclasspath(scp_compiler.combined_path());
-
-#endif
-
   if (AggressiveOpts) {
     // Insert alt-rt.jar between user-specified bootclasspath
     // prefix and the default bootclasspath.  os::set_boot_path()
@@ -2349,6 +2221,20 @@
     FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal);
   }
 
+#ifdef GRAAL
+  {
+    // Append graal.jar to bootclasspath if enabled
+    const char* jar_file = "graal.jar";
+    const size_t path_len = strlen(get_meta_index_dir()) + 1 + strlen(jar_file);
+    char* path = NEW_C_HEAP_ARRAY(char, path_len, mtInternal);
+    strcpy(path, get_meta_index_dir());
+    strcat(path, jar_file);
+    scp.add_suffix(path);
+    scp_assembly_required = true;
+    FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  }
+#endif
+
   // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
   result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
   if (result != JNI_OK) {