changeset 3691:b054dd61bfe1

Made gl script able to import and use the mx script.
author Doug Simon <doug.simon@oracle.com>
date Wed, 23 Nov 2011 18:11:28 +0100
parents f8d7ab42c479
children 4a76e44544d9
files pytools/commands.py pytools/gl.py
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pytools/commands.py	Wed Nov 23 14:52:52 2011 +0100
+++ b/pytools/commands.py	Wed Nov 23 18:11:28 2011 +0100
@@ -38,6 +38,9 @@
 def bootstrap(env, args):
     return env.run_vm(args + ['-version'])
 
+def safeadd(env, args):
+    return env.run_vm(args + ['-cp', env.mx().pdb().classpath('com.oracle.max.graal.examples.safeadd'), '-Xcomp', '-G:+PrintCompilation', '-G:+Extend', '-G:-Inline', '-XX:CompileOnly=Main', 'com.oracle.max.graal.examples.safeadd.Main'])
+    
 def avrora(env, args):
     return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'avrora'])
 
@@ -166,6 +169,7 @@
 # Extensions should update this table directly
 table = {
     'avrora': [avrora, ''],
+    'safeadd': [safeadd, ''],
     'batik': [batik, ''],
     'bootstrap': [bootstrap, ''],
     'clean': [clean, ''],
--- a/pytools/gl.py	Wed Nov 23 14:52:52 2011 +0100
+++ b/pytools/gl.py	Wed Nov 23 18:11:28 2011 +0100
@@ -56,6 +56,7 @@
         self.dacapo = os.getenv('DACAPO')
         self.jdk7 = os.getenv('JDK7')
         self.maxine = os.getenv('MAXINE')
+        self._mx = None
         
         ArgumentParser.__init__(self, prog='gl')
     
@@ -195,6 +196,16 @@
         """ raises a SystemExit exception with the provided exit code """
         raise SystemExit(code)
 
+    def mx(self):
+        if (self._mx is None):
+            p = join(self.maxine, 'com.oracle.max.shell')
+            sys.path.insert(0, p)
+            import mx
+            self._mx = mx.Env()
+            self._mx.maxine_home = self.maxine
+            self._mx.parse_cmd_line([])
+        return self._mx
+
 def main(env):
     configFile = join(dirname(sys.argv[0]), 'glrc')
     env.load_config_file(configFile)