changeset 5155:51fb8bc5ecf6

Merge
author Christian Haeubl <christian.haeubl@oracle.com>
date Fri, 23 Mar 2012 12:13:04 -0700
parents ae72dd38eeb1 57546200db29
children 482265e41a1a 6e385457d6fc
files
diffstat 2 files changed, 43 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Fri Mar 23 12:12:35 2012 -0700
+++ b/mx/commands.py	Fri Mar 23 12:13:04 2012 -0700
@@ -437,6 +437,25 @@
             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([a.strip().strip('"') for a in source[start + len(decl):end].split(',')])
+            expected = frozenset([p.name for p in mx.project('com.oracle.graal.hotspot').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 projects to declaration:\n    ' + '\n    '.join(missing))
+            if len(extra) != 0:
+                mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove projects from declaration:\n    ' + '\n    '.join(extra))
+                
         if platform.system() == 'Windows':
             compilelogfile = _graal_home + '/graalCompile.log'
             mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin')
--- a/src/share/vm/runtime/arguments.cpp	Fri Mar 23 12:12:35 2012 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Fri Mar 23 12:13:04 2012 -0700
@@ -2127,21 +2127,33 @@
     }
     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[] = {
+        "com.oracle.max.criutils",
+        "com.oracle.graal.hotspot",
+        "com.oracle.max.asm",
+        "com.oracle.graal.alloc",
+        "com.oracle.graal.snippets",
+        "com.oracle.graal.compiler",
+        "com.oracle.graal.nodes",
+        "com.oracle.graal.printer",
+        "com.oracle.max.cri",
+        "com.oracle.graal.debug",
+        "com.oracle.graal.graph",
+        "com.oracle.graal.lir",
+        "com.oracle.graal.lir.amd64",
+        "com.oracle.graal.java"
+    };
+
     SysClassPath scp_compiler("");
-    struct dirent* dentry;
-    char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(graal_dir));
-    errno = 0;
-    DIR* graal_dir_handle = os::opendir(graal_dir);
-    while ((dentry = os::readdir(graal_dir_handle, (struct dirent *)tdbuf)) != NULL) {
-      if (strcmp(dentry->d_name, ".") != 0 && strcmp(dentry->d_name, "..") != 0 && strcmp(dentry->d_name, "com.oracle.graal.tests") != 0 && strcmp(dentry->d_name, "com.oracle.graal.jtt") != 0) {
-        prepend_to_graal_classpath(scp_compiler, graal_dir, dentry->d_name);
-        if (PrintVMOptions) {
-          tty->print_cr("Adding project directory %s to bootclasspath", dentry->d_name);
-        }
+    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]);
     }
-    os::closedir(graal_dir_handle);
-    FREE_C_HEAP_ARRAY(char, tdbuf);
     scp_compiler.expand_endorsed();
 
     Arguments::set_compilerclasspath(scp_compiler.combined_path());