changeset 4179:816a4408a853

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 02 Jan 2012 21:55:47 +0100
parents d1b26c17910a (diff) a428df0139f3 (current diff)
children 383c1272cd1f
files
diffstat 6 files changed, 99 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/create64.cmd	Mon Jan 02 18:40:00 2012 +0100
+++ b/create64.cmd	Mon Jan 02 21:55:47 2012 +0100
@@ -1,11 +1,2 @@
-set HotSpotMksHome=C:\cygwin\bin
-set JAVA_HOME=%cd%\java64
-set ORIG_PATH=%PATH%
-set path=%JAVA_HOME%\bin;%path%;C:\cygwin\bin
+set HotSpotMksHome=C:\cygwin\bin& set JAVA_HOME=%cd%\jdk1.7.0& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd make\windows& call create.bat %cd%
 
-set OrigPath=%cd%
-cd make\windows
-call create.bat %OrigPath%
-
-set PATH=%ORIG_PATH%
-cd %OrigPath%
--- a/make/windows/makefiles/vm.make	Mon Jan 02 18:40:00 2012 +0100
+++ b/make/windows/makefiles/vm.make	Mon Jan 02 21:55:47 2012 +0100
@@ -153,7 +153,7 @@
 VM_PATH=$(VM_PATH);../generated/adfiles
 VM_PATH=$(VM_PATH);../generated/jvmtifiles
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/c1
-VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/c1x
+VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/graal
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/compiler
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/code
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/interpreter
--- a/mx/commands.py	Mon Jan 02 18:40:00 2012 +0100
+++ b/mx/commands.py	Mon Jan 02 21:55:47 2012 +0100
@@ -26,7 +26,7 @@
 #
 # ----------------------------------------------------------------------------------------------------
 
-import os, sys, shutil, StringIO, zipfile, tempfile, re, time, datetime
+import os, sys, shutil, StringIO, zipfile, tempfile, re, time, datetime, platform, subprocess
 from os.path import join, exists, dirname, isdir, isfile, isabs, basename
 from argparse import ArgumentParser, REMAINDER
 import mx
@@ -34,6 +34,8 @@
 _graal_home = dirname(dirname(__file__))
 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) 
 _vmbuild = 'product'
+_winSDK = 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\'
+_mksHome = 'C:\\cygwin\\bin'
 
 def clean(args):
     """cleans the GraalVM source tree"""
@@ -150,10 +152,13 @@
         'xalan'
     ]
     
-    dacapo = mx.check_get_env('DACAPO_CP')
+    dacapo = mx.get_env('DACAPO_CP')
+    if dacapo is None:
+        dacapo = _graal_home + r'/lib/dacapo-9.12-bach.jar'
+    
     if not isfile(dacapo) or not dacapo.endswith('.jar'):
         mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)
-            
+        
     vmOpts = ['-Xms1g', '-Xmx2g', '-cp', dacapo]
 
     selected = []
@@ -233,6 +238,41 @@
         return res
     else:
         mx.abort('Unknown build type: ' + build)
+
+# run a command in the windows SDK Debug Shell
+def runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}):
+    newLine = os.linesep
+    STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE'
+    ENDTOKEN = 'RUNINDEBUGSHELL_ENDSEQUENCE'
+    p = subprocess.Popen('cmd.exe /E:ON /V:ON /K ""' + _winSDK + '/Bin/SetEnv.cmd" & echo ' + STARTTOKEN + '"', \
+            shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    output = p.stdout
+    input = p.stdin
+    if logFile:
+        log = open(logFile, 'w')
+    ret = False
+    while True:
+        line = output.readline().decode()
+        if logFile:
+            log.write(line)
+        line = line.strip()
+        mx.log(line)
+        if line == STARTTOKEN:
+            input.write('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + ENDTOKEN + newLine)
+        for regex in respondTo.keys():
+            match = regex.search(line)
+            if match:
+                input.write(respondTo[regex] + newLine)
+        if findInOutput:
+            match = findInOutput.search(line)
+            if match:
+                ret = True
+        if line == ENDTOKEN:
+            break
+    input.write('exit' + newLine)
+    if logFile:
+        log.close()
+    return ret
     
 def build(args):
     """builds the GraalVM binary and compiles the Graal classes
@@ -262,8 +302,23 @@
         if not 'Xusage.txt' in line:
             sys.stderr.write(line + os.linesep)
             
-    os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk, INSTALL='y')
-    mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage)
+    if platform.system() == 'Windows':
+        compilelogfile = _graal_home + '/graalCompile.log'
+        runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=compiler1_product /target:clean', _graal_home)
+        winCompileCmd = r'set HotSpotMksHome=' + _mksHome + r'& set OUT_DIR=' + jdk + r'& set JAVA_HOME=' + jdk + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' +_graal_home + r'\make\windows"& call create.bat ' + _graal_home + ''
+        print(winCompileCmd)
+        winCompileSuccess = re.compile(r"^Writing \.vcxproj file:")
+        if not runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess):
+            mx.log('Error executing create command')
+            return 
+        winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=compiler1_product /p:Platform=x64'
+        winBuildSuccess = re.compile('Build succeeded.')
+        if not runInDebugShell(winBuildCmd, _graal_home, compilelogfile, winBuildSuccess):
+            mx.log('Error building project')
+            return 
+    else:
+        os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk, INSTALL='y')
+        mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage)
     
 def vm(args, vm='-graal', nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None):
     """run the GraalVM"""
@@ -545,6 +600,6 @@
         mx.abort('Requires Java version 1.7 or greater, got version ' + version)
 
     if (_vmSourcesAvailable):
-        global _vmbuild
-        if not opts.vmbuild is None:
+        if hasattr(opts, 'vmbuild'):
+            global _vmbuild
             _vmbuild = opts.vmbuild
--- a/mx/projects	Mon Jan 02 18:40:00 2012 +0100
+++ b/mx/projects	Mon Jan 02 21:55:47 2012 +0100
@@ -27,6 +27,7 @@
 # Values can use environment variables with the syntax used in a Bash shell script.
 #
 
+
 library@JDK_TOOLS@path=${JAVA_HOME}/lib/tools.jar
 library@JDK_TOOLS@optional=true
 
@@ -37,6 +38,9 @@
 library@CHECKSTYLE@path=lib/checkstyle-5.5-all.jar
 library@CHECKSTYLE@urls=jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/5.5/checkstyle-5.5-bin.zip/download!/checkstyle-5.5/checkstyle-5.5-all.jar
 
+library@DACAPO@path=lib/dacapo-9.12-bach.jar
+library@DACAPO@urls=http://dfn.dl.sourceforge.net/project/dacapobench/9.12-bach/dacapo-9.12-bach.jar
+
 # graal.hotspot
 project@com.oracle.max.graal.hotspot@subDir=graal
 project@com.oracle.max.graal.hotspot@sourceDirs=src
--- a/mxtool/mx.py	Mon Jan 02 18:40:00 2012 +0100
+++ b/mxtool/mx.py	Mon Jan 02 21:55:47 2012 +0100
@@ -214,6 +214,7 @@
             path = join(self.suite.dir, path)
         if resolve and self.mustExist and not exists(path):
             assert not len(self.urls) == 0, 'cannot find required library  ' + self.name + " " + path;
+            print('Downloading ' + self.name + ' from ' + str(self.urls))
             download(path, self.urls)
         return path
         
@@ -290,6 +291,7 @@
             urls = pop_list(attrs, 'urls')
             l = Library(self, name, path, mustExist, urls)
             l.__dict__.update(attrs)
+            l.get_path(True)
             self.libs.append(l)
         
     def _load_commands(self, mxDir):
@@ -629,11 +631,18 @@
     """
     Gets an environment variable, aborting with a useful message if it is not set.
     """
-    value = os.environ.get(key)
+    value = get_env(key)
     if value is None:
         abort('Required environment variable ' + key + ' must be set')
     return value
 
+def get_env(key):
+    """
+    Gets an environment variable.
+    """
+    value = os.environ.get(key)
+    return value
+
 def log(msg=None):
     """
     Write a message to the console.
@@ -719,12 +728,12 @@
             
                 zf = zipfile.ZipFile(zipdata, 'r')
                 data = zf.read(entry)
-                with open(path, 'w') as f:
+                with open(path, 'wb') as f:
                     f.write(data)
             else:
                 with contextlib.closing(url_open(url)) as f:
                     data = f.read()
-                with open(path, 'w') as f:
+                with open(path, 'wb') as f:
                     f.write(data)
             return
         except IOError as e:
@@ -849,7 +858,7 @@
             built.add(p.name)
 
             argfileName = join(p.dir, 'javafilelist.txt')
-            argfile = open(argfileName, 'w')
+            argfile = open(argfileName, 'wb')
             argfile.write('\n'.join(javafilelist))
             argfile.close()
             
@@ -1139,8 +1148,6 @@
                 _loadSuite(path)
                 
     cwdMxDir = join(os.getcwd(), 'mx')
-    if exists(cwdMxDir) and isdir(cwdMxDir):
-        _loadSuite(os.getcwd(), True)
             
     opts, commandAndArgs = _argParser._parse_cmd_line()
     
@@ -1148,6 +1155,9 @@
     _opts = opts
     _java = JavaConfig(opts)
     
+    if exists(cwdMxDir) and isdir(cwdMxDir):
+        _loadSuite(os.getcwd(), True)
+    
     for s in suites():
         if s.commands is not None and hasattr(s.commands, 'mx_post_parse_cmd_line'):
             s.commands.mx_post_parse_cmd_line(opts)
--- a/src/share/tools/ProjectCreator/BuildConfig.java	Mon Jan 02 18:40:00 2012 +0100
+++ b/src/share/tools/ProjectCreator/BuildConfig.java	Mon Jan 02 21:55:47 2012 +0100
@@ -63,20 +63,21 @@
         // ones mentioned above were needed to expand format
         String buildBase = expandFormat(getFieldString(null, "BuildBase"));
         String sourceBase = getFieldString(null, "SourceBase");
-        String outDir = sourceBase + Util.sep + "java";
-	if (!platformName.equals("Win32")) {
-		outDir += "64";
-	}
-	if (!build.equals("product")) {
-		outDir += Util.sep + "fastdebug";
-	}
-	outDir += Util.sep + "jre" + Util.sep + "bin";
-	if (flavour.equals("compiler1")) {
-		outDir += Util.sep + "graal";
-	} else {
-		outDir += Util.sep + "server";
-	}
-	buildBase = outDir;
+        String outDir = buildBase;
+        String value = System.getenv("OUT_DIR");
+        if (value != null) {
+            outDir = value;
+        }
+        if (!build.equals("product")) {
+            outDir += Util.sep + "fastdebug";
+        }
+        outDir += Util.sep + "jre" + Util.sep + "bin";
+        if (flavour.equals("compiler1")) {
+            outDir += Util.sep + "graal";
+        } else {
+            outDir += Util.sep + "server";
+        }
+        buildBase = outDir;
 
         put("Id", flavourBuild);
         put("OutputDir", outDir);