Mercurial > hg > truffle
comparison mx/commands.py @ 4145:9aee7df31417
Removed 'tests' command.
Folded 'make' command into 'build' command.
Renamed 'eclipseprojects' command to 'ideinit'
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 19 Dec 2011 20:56:59 +0100 |
parents | 34527a24bcf8 |
children | 4eb5b2469b6f |
comparison
equal
deleted
inserted
replaced
4144:34527a24bcf8 | 4145:9aee7df31417 |
---|---|
120 vmOpts += args | 120 vmOpts += args |
121 for bm in runs: | 121 for bm in runs: |
122 config = benchmarks.get(bm) | 122 config = benchmarks.get(bm) |
123 vm(vmOpts + ['Harness'] + config + [bm]) | 123 vm(vmOpts + ['Harness'] + config + [bm]) |
124 | 124 |
125 def tests(args): | |
126 """run a selection of the Maxine JTT tests in Graal""" | |
127 | |
128 maxine = mx.check_get_env('MAXINE_HOME') | |
129 def jtt(name): | |
130 return join(maxine, 'com.oracle.max.vm', 'test', 'jtt', name) | |
131 | |
132 return vm(['-ea', '-esa', '-Xcomp', '-XX:+PrintCompilation', '-XX:CompileOnly=jtt'] + args + | |
133 ['-Xbootclasspath/p:' + join(maxine, 'com.oracle.max.vm', 'bin'), | |
134 '-Xbootclasspath/p:' + join(maxine, 'com.oracle.max.base', 'bin'), | |
135 'test.com.sun.max.vm.compiler.JavaTester', | |
136 '-verbose=1', '-gen-run-scheme=false', '-run-scheme-package=all', | |
137 jtt('bytecode'), | |
138 jtt('except'), | |
139 jtt('jdk'), | |
140 jtt('hotpath'), | |
141 jtt('jdk'), | |
142 jtt('lang'), | |
143 jtt('loop'), | |
144 jtt('micro'), | |
145 jtt('optimize'), | |
146 jtt('reflect'), | |
147 jtt('threads'), | |
148 jtt('hotspot')]) | |
149 | |
150 | |
151 def _download_and_extract_targz_jdk7(url, dst): | 125 def _download_and_extract_targz_jdk7(url, dst): |
152 assert url.endswith('.tar.gz') | 126 assert url.endswith('.tar.gz') |
153 dl = join(_graal_home, 'jdk7.tar.gz') | 127 dl = join(_graal_home, 'jdk7.tar.gz') |
154 try: | 128 try: |
155 if not exists(dl): | 129 if not exists(dl): |
130 mx.log('Downloading ' + url) | |
156 mx.download(dl, [url]) | 131 mx.download(dl, [url]) |
157 tmp = join(_graal_home, 'tmp') | 132 tmp = join(_graal_home, 'tmp') |
158 if not exists(tmp): | 133 if not exists(tmp): |
159 os.mkdir(tmp) | 134 os.mkdir(tmp) |
160 with tarfile.open(dl, mode='r:gz') as f: | 135 with tarfile.open(dl, mode='r:gz') as f: |
170 | 145 |
171 | 146 |
172 def _jdk7(build='product', create=False): | 147 def _jdk7(build='product', create=False): |
173 jdk7 = os.environ.get('JDK7') | 148 jdk7 = os.environ.get('JDK7') |
174 if jdk7 is None: | 149 if jdk7 is None: |
175 jdk7 = join(_graal_home, 'jdk7') | 150 jdk7 = join(_graal_home, 'jdk1.7.0') |
176 if not exists(jdk7): | 151 if not exists(jdk7): |
177 # Try to download it | 152 # Try to download it |
178 if mx.get_os() == 'linux': | 153 if mx.get_os() == 'linux': |
179 _download_and_extract_targz_jdk7('http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-x64.tar.gz', jdk7) | 154 _download_and_extract_targz_jdk7('http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-x64.tar.gz', jdk7) |
180 else: | 155 else: |
198 shutil.copytree(join(jdk7, d), join(res, d)) | 173 shutil.copytree(join(jdk7, d), join(res, d)) |
199 return res | 174 return res |
200 else: | 175 else: |
201 mx.abort('Unknown build type: ' + build) | 176 mx.abort('Unknown build type: ' + build) |
202 | 177 |
203 def make(args): | 178 def build(args): |
204 """builds the GraalVM binary | 179 """builds the GraalVM binary and compiles the Graal classes |
205 | 180 |
206 The optional argument specifies what type of VM to build.""" | 181 The optional argument specifies what type of VM to build.""" |
182 | |
183 mx.build([]) | |
207 | 184 |
208 def fix_jvm_cfg(jdk): | 185 def fix_jvm_cfg(jdk): |
209 jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') | 186 jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') |
210 found = False | 187 found = False |
211 if not exists(jvmCfg): | 188 if not exists(jvmCfg): |
241 mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage) | 218 mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage) |
242 | 219 |
243 def vm(args, vm='-graal'): | 220 def vm(args, vm='-graal'): |
244 """run the GraalVM""" | 221 """run the GraalVM""" |
245 | 222 |
246 build = mx.vmbuild | 223 build = _vmbuild |
247 if mx.java_dbg: | 224 if mx.java().debug: |
248 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args | 225 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args |
249 os.environ['GRAAL'] = join(mx.check_get_env('GRAAL_HOME'), 'graal') | 226 os.environ['GRAAL'] = join(_graal_home, 'graal') |
250 exe = join(_jdk7(build), 'bin', mx.exe_suffix('java')) | 227 exe = join(_jdk7(build), 'bin', mx.exe_suffix('java')) |
251 return mx.run([exe, vm] + args) | 228 return mx.run([exe, vm] + args) |
252 | 229 |
253 def eclipseprojects(args): | 230 def ideinit(args): |
254 """(re)generate Eclipse project configurations | 231 """(re)generate Eclipse project configurations |
255 | 232 |
256 The exit code of this command reflects how many files were updated.""" | 233 The exit code of this command reflects how many files were updated.""" |
257 | 234 |
258 | 235 |
405 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product VM') | 382 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product VM') |
406 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug VM') | 383 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug VM') |
407 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug VM') | 384 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug VM') |
408 mx.add_argument('--optimized', action='store_const', dest='vmbuild', const='optimized', help='select the optimized VM') | 385 mx.add_argument('--optimized', action='store_const', dest='vmbuild', const='optimized', help='select the optimized VM') |
409 commands = { | 386 commands = { |
387 'build': [build, '[product|debug|fastdebug|optimized]'], | |
410 'dacapo': [dacapo, '[benchmark] [VM options]'], | 388 'dacapo': [dacapo, '[benchmark] [VM options]'], |
411 'example': [example, '[-v] example names...'], | 389 'example': [example, '[-v] example names...'], |
412 'clean': [clean, ''], | 390 'clean': [clean, ''], |
413 'make': [make, '[product|debug|fastdebug|optimized]'], | |
414 'tests': [tests, ''], | |
415 'vm': [vm, '[-options] class [args...]'], | 391 'vm': [vm, '[-options] class [args...]'], |
416 'eclipseprojects': [eclipseprojects, ''], | 392 'ideinit': [ideinit, ''], |
417 } | 393 } |
418 mx.commands.update(commands) | 394 mx.commands.update(commands) |
419 | 395 |
420 def mx_post_parse_cmd_line(opts): | 396 def mx_post_parse_cmd_line(opts): |
421 global _vmbuild | 397 global _vmbuild |