changeset 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 6e3ebc6fd5a4
children ae629e3671a0
files mx/commands.py src/share/vm/classfile/classLoader.cpp src/share/vm/graal/graalGlobals.hpp src/share/vm/runtime/arguments.cpp src/share/vm/runtime/arguments.hpp
diffstat 5 files changed, 14 insertions(+), 171 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Wed Mar 06 20:25:57 2013 +0100
+++ b/mx/commands.py	Wed Mar 06 20:48:32 2013 +0100
@@ -500,25 +500,6 @@
             if not 'Xusage.txt' in line:
                 sys.stderr.write(line + os.linesep)
 
-        # Check that the declaration of graal_projects in arguments.cpp is up to date
-        argumentsCpp = join(_graal_home, 'src', 'share', 'vm', 'runtime', 'arguments.cpp')
-        assert exists(argumentsCpp), 'File does not exist: ' + argumentsCpp
-        with open(argumentsCpp) as fp:
-            source = fp.read();
-            decl = 'const char* graal_projects[] = {'
-            start = source.find(decl)
-            assert start != -1, 'Could not find "' + decl + '" in ' + fp.name
-            end = source.find('};', start)
-            assert end != -1, 'Could not find "' + decl + '" ... "};" in ' + fp.name
-            actual = frozenset(re.findall(r'"([^"]+)"', source[start + len(decl):end]))
-            expected = frozenset([p.name for p in mx.project('com.oracle.graal.hotspot.' + _arch()).all_deps([], False)])
-            missing = expected - actual
-            extra = actual - expected
-            if len(missing) != 0:
-                mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': add missing project(s) to declaration:\n    ' + '\n    '.join(missing))
-            if len(extra) != 0:
-                mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove project(s) from declaration:\n    ' + '\n    '.join(extra))
-
         # Check if a build really needs to be done
         timestampFile = join(vmDir, '.build-timestamp')
         if opts2.force or not exists(timestampFile):
@@ -669,9 +650,6 @@
     if '-d64' not in args:
         args = ['-d64'] + args
 
-    graalJar = join(_graal_home, 'graal.jar')
-    if exists(graalJar):
-        args = ['-XX:GraalClassPath=' + graalJar] + args
     exe = join(jdk, 'bin', mx.exe_suffix('java'))
     dbg = _native_dbg.split() if _native_dbg is not None else []
     return mx.run(dbg + [exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
--- a/src/share/vm/classfile/classLoader.cpp	Wed Mar 06 20:25:57 2013 +0100
+++ b/src/share/vm/classfile/classLoader.cpp	Wed Mar 06 20:48:32 2013 +0100
@@ -442,20 +442,11 @@
 void ClassLoader::setup_bootstrap_search_path() {
   assert(_first_entry == NULL, "should not setup bootstrap class search path twice");
   char* sys_class_path = os::strdup(Arguments::get_sysclasspath());
-#ifdef GRAAL
-  char* compiler_class_path = os::strdup(Arguments::get_compilerclasspath());
-#endif
   if (TraceClassLoading && Verbose) {
     tty->print_cr("[Bootstrap loader class path=%s]", sys_class_path);
-#ifdef GRAAL
-    tty->print_cr("[Compiler loader class path=%s]", compiler_class_path);
-#endif
   }
 
   setup_bootstrap_search_path(sys_class_path);
-#ifdef GRAAL
-  setup_bootstrap_search_path(compiler_class_path);
-#endif
 }
 
 void ClassLoader::setup_bootstrap_search_path(char* sys_class_path) {
--- a/src/share/vm/graal/graalGlobals.hpp	Wed Mar 06 20:25:57 2013 +0100
+++ b/src/share/vm/graal/graalGlobals.hpp	Wed Mar 06 20:48:32 2013 +0100
@@ -52,9 +52,6 @@
   product(bool, BootstrapGraal, GRAALVM_ONLY(true) NOT_GRAALVM(false),      \
           "Bootstrap Graal before running Java main method")                \
                                                                             \
-  product(ccstr, GraalClassPath, NULL,                                      \
-          "Use this path, zip, or jar, to locate Graal-specific classes")   \
-                                                                            \
   product(intx, TraceGraal, 0,                                              \
           "Trace level for Graal")                                          \
                                                                             \
--- 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) {
--- a/src/share/vm/runtime/arguments.hpp	Wed Mar 06 20:25:57 2013 +0100
+++ b/src/share/vm/runtime/arguments.hpp	Wed Mar 06 20:48:32 2013 +0100
@@ -247,9 +247,6 @@
   static SystemProperty *_java_home;
   static SystemProperty *_java_class_path;
   static SystemProperty *_sun_boot_class_path;
-#ifdef GRAAL
-  static SystemProperty *_compiler_class_path;
-#endif
 
   // Meta-index for knowing what packages are in the boot class path
   static char* _meta_index_path;
@@ -537,9 +534,6 @@
   static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
   static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
   static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
-#ifdef GRAAL
-  static void set_compilerclasspath(char *value) { _compiler_class_path->set_value(value); }
-#endif
   static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
   static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
     _meta_index_path = meta_index_path;
@@ -550,9 +544,6 @@
   static char *get_dll_dir() { return _sun_boot_library_path->value(); }
   static char *get_endorsed_dir() { return _java_endorsed_dirs->value(); }
   static char *get_sysclasspath() { return _sun_boot_class_path->value(); }
-#ifdef GRAAL
-  static char *get_compilerclasspath() { return _compiler_class_path->value(); }
-#endif
   static char* get_meta_index_path() { return _meta_index_path; }
   static char* get_meta_index_dir()  { return _meta_index_dir;  }