# HG changeset patch # User Doug Simon # Date 1322137180 -3600 # Node ID 4a76e44544d9a3ed64a6791b2bb1df326b9ddce3 # Parent b054dd61bfe1e87fe1a58dc9024c647f198decf0 Made the safeadd and vectorlib examples runnable from the gl script: gl safeadd gl vectorlib Consolidated individual DaCapo commands into one 'dacapo' command. diff -r b054dd61bfe1 -r 4a76e44544d9 pytools/commands.py --- a/pytools/commands.py Wed Nov 23 18:11:28 2011 +0100 +++ b/pytools/commands.py Thu Nov 24 13:19:40 2011 +0100 @@ -38,39 +38,55 @@ 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 _example(env, args, project, mainClass): + cp = env.mx().pdb().classpath(project) + sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass] -def avrora(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'avrora']) + res = [] + print "=== Server VM ===" + res.append(env.run_vm(['-cp', cp,] + sharedArgs, vm="-server")) + print "=== Graal VM ===" + res.append(env.run_vm(['-cp', cp, '-G:+PrintCompilation', '-G:-Extend', '-G:-Inline'] + sharedArgs)) + print "=== Graal VM with extensions ===" + res.append(env.run_vm(['-cp', cp, '-G:+PrintCompilation', '-G:+Extend', '-G:-Inline'] + sharedArgs)) + + if len([x for x in res if x != 0]) != 0: + return 1 + return 0 -def batik(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'batik']) +def safeadd(env, args): + """run the SafeAdd example""" + return _example(env, args, 'com.oracle.max.graal.examples.safeadd', 'com.oracle.max.graal.examples.safeadd.Main') -def eclipse(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'eclipse']) - -def fop(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '100', 'fop']) +def vectorlib(env, args): + """run the VectorLib example""" + return _example(env, args, 'com.oracle.max.graal.examples.vectorlib', 'com.oracle.max.graal.examples.vectorlib.Main') -def h2(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '10', 'h2']) - -def jython(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '10', 'jython']) - -def lusearch(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '5', 'lusearch']) - -def pmd(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '10', 'pmd']) - -def tradebeans(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'tradebeans']) - -def xalan(env, args): - return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'xalan']) - +def dacapo(env, args): + """run a DaCapo benchmark""" + + benchmarks = { + 'avrora': ['--preserve', '-n', '20'], + 'batik': ['-n', '20'], + 'eclipse': ['-n', '20'], + 'fop': ['-n', '100'], + 'h2': ['-n', '10'], + 'jython': ['-n', '10'], + 'lusearch': ['-n', '5'], + 'pmd': ['-n', '10'], + 'tradebeans': ['-n', '20'], + 'xalan': ['-n', '20'], + } + + if len(args) == 0: + env.abort('which benchmark?\nselect one of: ' + str(benchmarks.keys())) + bm = args[0] + config = benchmarks.get(bm) + if (config is None): + env.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(benchmarks.keys())) + args = args[1:] + return env.run_dacapo(args + ['Harness'] + config + [bm]) + def tests(env, args): """run a selection of the Maxine JTT tests in Graal""" @@ -168,20 +184,13 @@ # used in the call to str.format(). # Extensions should update this table directly table = { - 'avrora': [avrora, ''], - 'safeadd': [safeadd, ''], - 'batik': [batik, ''], + 'dacapo': [dacapo, 'benchmark [VM options]'], 'bootstrap': [bootstrap, ''], 'clean': [clean, ''], - 'fop': [fop, ''], - 'h2': [h2, ''], - 'jython': [jython, ''], - 'lusearch': [lusearch, ''], - 'pmd': [pmd, ''], - 'tradebeans': [tradebeans, ''], - 'tests': [tests, ''], 'help': [help_, '[command]'], 'make': [make, ''], - 'xalan': [xalan, ''], + 'safeadd': [safeadd, ''], + 'tests': [tests, ''], + 'vectorlib': [vectorlib, ''], 'vm': [vm, ''], } diff -r b054dd61bfe1 -r 4a76e44544d9 pytools/gl.py --- a/pytools/gl.py Wed Nov 23 18:11:28 2011 +0100 +++ b/pytools/gl.py Thu Nov 24 13:19:40 2011 +0100 @@ -110,11 +110,13 @@ return name def run_dacapo(self, args): + if self.dacapo is None: + self.abort('Need to specify DaCapo jar with --dacapo option or DACAPO environment variable') if not isfile(self.dacapo) or not self.dacapo.endswith('.jar'): self.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + self.dacapo) return self.run_vm(['-Xms1g', '-Xmx2g', '-esa', '-XX:-GraalBailoutIsFatal', '-G:-QuietBailout', '-cp', self.dacapo] + args) - def run_vm(self, args): + def run_vm(self, args, vm='-graal'): if self.maxine is None: configFile = join(dirname(sys.argv[0]), 'glrc') self.abort('Path to Maxine code base must be specified with -M option or MAXINE environment variable (in ' + configFile + ')') @@ -123,7 +125,7 @@ os.environ['MAXINE'] = self.maxine exe = join(self.jdk7, 'bin', self.exe('java')) - return self.run([exe, '-graal'] + args) + return self.run([exe, vm] + args) def run(self, args, nonZeroIsFatal=True, out=None, err=None, cwd=None): """