Mercurial > hg > truffle
comparison pytools/commands.py @ 3692:4a76e44544d9
Made the safeadd and vectorlib examples runnable from the gl script:
gl safeadd
gl vectorlib
Consolidated individual DaCapo commands into one 'dacapo' command.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 24 Nov 2011 13:19:40 +0100 |
parents | b054dd61bfe1 |
children | 60d31b1fada5 |
comparison
equal
deleted
inserted
replaced
3691:b054dd61bfe1 | 3692:4a76e44544d9 |
---|---|
36 env.run([env.gmake_cmd(), 'clean'], cwd=join(env.graal_home, 'make')) | 36 env.run([env.gmake_cmd(), 'clean'], cwd=join(env.graal_home, 'make')) |
37 | 37 |
38 def bootstrap(env, args): | 38 def bootstrap(env, args): |
39 return env.run_vm(args + ['-version']) | 39 return env.run_vm(args + ['-version']) |
40 | 40 |
41 def _example(env, args, project, mainClass): | |
42 cp = env.mx().pdb().classpath(project) | |
43 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass] | |
44 | |
45 res = [] | |
46 print "=== Server VM ===" | |
47 res.append(env.run_vm(['-cp', cp,] + sharedArgs, vm="-server")) | |
48 print "=== Graal VM ===" | |
49 res.append(env.run_vm(['-cp', cp, '-G:+PrintCompilation', '-G:-Extend', '-G:-Inline'] + sharedArgs)) | |
50 print "=== Graal VM with extensions ===" | |
51 res.append(env.run_vm(['-cp', cp, '-G:+PrintCompilation', '-G:+Extend', '-G:-Inline'] + sharedArgs)) | |
52 | |
53 if len([x for x in res if x != 0]) != 0: | |
54 return 1 | |
55 return 0 | |
56 | |
41 def safeadd(env, args): | 57 def safeadd(env, args): |
42 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']) | 58 """run the SafeAdd example""" |
59 return _example(env, args, 'com.oracle.max.graal.examples.safeadd', 'com.oracle.max.graal.examples.safeadd.Main') | |
60 | |
61 def vectorlib(env, args): | |
62 """run the VectorLib example""" | |
63 return _example(env, args, 'com.oracle.max.graal.examples.vectorlib', 'com.oracle.max.graal.examples.vectorlib.Main') | |
64 | |
65 def dacapo(env, args): | |
66 """run a DaCapo benchmark""" | |
43 | 67 |
44 def avrora(env, args): | 68 benchmarks = { |
45 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'avrora']) | 69 'avrora': ['--preserve', '-n', '20'], |
46 | 70 'batik': ['-n', '20'], |
47 def batik(env, args): | 71 'eclipse': ['-n', '20'], |
48 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'batik']) | 72 'fop': ['-n', '100'], |
49 | 73 'h2': ['-n', '10'], |
50 def eclipse(env, args): | 74 'jython': ['-n', '10'], |
51 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'eclipse']) | 75 'lusearch': ['-n', '5'], |
52 | 76 'pmd': ['-n', '10'], |
53 def fop(env, args): | 77 'tradebeans': ['-n', '20'], |
54 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '100', 'fop']) | 78 'xalan': ['-n', '20'], |
55 | 79 } |
56 def h2(env, args): | 80 |
57 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '10', 'h2']) | 81 if len(args) == 0: |
58 | 82 env.abort('which benchmark?\nselect one of: ' + str(benchmarks.keys())) |
59 def jython(env, args): | 83 bm = args[0] |
60 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '10', 'jython']) | 84 config = benchmarks.get(bm) |
61 | 85 if (config is None): |
62 def lusearch(env, args): | 86 env.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(benchmarks.keys())) |
63 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '5', 'lusearch']) | 87 args = args[1:] |
64 | 88 return env.run_dacapo(args + ['Harness'] + config + [bm]) |
65 def pmd(env, args): | 89 |
66 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '10', 'pmd']) | |
67 | |
68 def tradebeans(env, args): | |
69 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'tradebeans']) | |
70 | |
71 def xalan(env, args): | |
72 return env.run_dacapo(args + ['Harness', '--preserve', '-n', '20', 'xalan']) | |
73 | |
74 def tests(env, args): | 90 def tests(env, args): |
75 """run a selection of the Maxine JTT tests in Graal""" | 91 """run a selection of the Maxine JTT tests in Graal""" |
76 | 92 |
77 def jtt(name): | 93 def jtt(name): |
78 return join(env.maxine, 'com.oracle.max.vm', 'test', 'jtt', name) | 94 return join(env.maxine, 'com.oracle.max.vm', 'test', 'jtt', name) |
166 # Keys are command names, value are lists: [<function>, <usage msg>, <format args to doc string of function>...] | 182 # Keys are command names, value are lists: [<function>, <usage msg>, <format args to doc string of function>...] |
167 # If any of the format args are instances of Callable, then they are called with an 'env' are before being | 183 # If any of the format args are instances of Callable, then they are called with an 'env' are before being |
168 # used in the call to str.format(). | 184 # used in the call to str.format(). |
169 # Extensions should update this table directly | 185 # Extensions should update this table directly |
170 table = { | 186 table = { |
171 'avrora': [avrora, ''], | 187 'dacapo': [dacapo, 'benchmark [VM options]'], |
172 'safeadd': [safeadd, ''], | |
173 'batik': [batik, ''], | |
174 'bootstrap': [bootstrap, ''], | 188 'bootstrap': [bootstrap, ''], |
175 'clean': [clean, ''], | 189 'clean': [clean, ''], |
176 'fop': [fop, ''], | |
177 'h2': [h2, ''], | |
178 'jython': [jython, ''], | |
179 'lusearch': [lusearch, ''], | |
180 'pmd': [pmd, ''], | |
181 'tradebeans': [tradebeans, ''], | |
182 'tests': [tests, ''], | |
183 'help': [help_, '[command]'], | 190 'help': [help_, '[command]'], |
184 'make': [make, ''], | 191 'make': [make, ''], |
185 'xalan': [xalan, ''], | 192 'safeadd': [safeadd, ''], |
193 'tests': [tests, ''], | |
194 'vectorlib': [vectorlib, ''], | |
186 'vm': [vm, ''], | 195 'vm': [vm, ''], |
187 } | 196 } |