Mercurial > hg > truffle
comparison mx/commands.py @ 5064:8a88c903e381
Updated mx commands.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 08 Mar 2012 19:35:42 +0100 |
parents | 6bc165b0fdcd |
children | 206e68bb66c6 |
comparison
equal
deleted
inserted
replaced
5063:055c137f73ed | 5064:8a88c903e381 |
---|---|
47 This can be set via the global '--fastdebug' and '--debug' options. """ | 47 This can be set via the global '--fastdebug' and '--debug' options. """ |
48 _vmbuild = 'product' | 48 _vmbuild = 'product' |
49 | 49 |
50 _jacoco = 'off' | 50 _jacoco = 'off' |
51 | 51 |
52 _jacocoExcludes = ['com.oracle.max.graal.hotspot.snippets.ArrayCopySnippets', | 52 _jacocoExcludes = ['com.oracle.graal.hotspot.snippets.ArrayCopySnippets', |
53 'com.oracle.max.graal.snippets.DoubleSnippets', | 53 'com.oracle.graal.snippets.DoubleSnippets', |
54 'com.oracle.max.graal.snippets.FloatSnippets', | 54 'com.oracle.graal.snippets.FloatSnippets', |
55 'com.oracle.max.graal.snippets.MathSnippetsX86', | 55 'com.oracle.graal.snippets.MathSnippetsX86', |
56 'com.oracle.max.graal.snippets.NodeClassSnippets', | 56 'com.oracle.graal.snippets.NodeClassSnippets', |
57 'com.oracle.max.graal.hotspot.snippets.SystemSnippets', | 57 'com.oracle.graal.hotspot.snippets.SystemSnippets', |
58 'com.oracle.max.graal.hotspot.snippets.UnsafeSnippets', | 58 'com.oracle.graal.hotspot.snippets.UnsafeSnippets', |
59 'com.oracle.max.graal.compiler.tests.*'] | 59 'com.oracle.graal.compiler.tests.*'] |
60 | 60 |
61 _copyrightTemplate = """/* | 61 _copyrightTemplate = """/* |
62 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved. | 62 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved. |
63 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 63 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
64 * | 64 * |
88 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) | 88 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) |
89 if opts.native: | 89 if opts.native: |
90 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') | 90 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') |
91 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) | 91 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) |
92 | 92 |
93 def copyrightcheck(args): | |
94 """run copyright check on the Mercurial controlled source files""" | |
95 res = mx.run_java(['-cp', mx.classpath('com.oracle.max.base', resolve=False), 'com.sun.max.tools.CheckCopyright', '-cfp=' + join(mx.project('com.oracle.max.base').dir, '.copyright.regex')] + args) | |
96 mx.log("copyright check result = " + str(res)) | |
97 return res | |
98 | |
99 def export(args): | 93 def export(args): |
100 """create a GraalVM zip file for distribution""" | 94 """create a GraalVM zip file for distribution""" |
101 | 95 |
102 parser = ArgumentParser(prog='mx export'); | 96 parser = ArgumentParser(prog='mx export'); |
103 parser.add_argument('--omit-vm-build', action='store_false', dest='vmbuild', help='omit VM build step') | 97 parser.add_argument('--omit-vm-build', action='store_false', dest='vmbuild', help='omit VM build step') |
141 mx.log('Created distribution in ' + zfName) | 135 mx.log('Created distribution in ' + zfName) |
142 | 136 |
143 def example(args): | 137 def example(args): |
144 """run some or all Graal examples""" | 138 """run some or all Graal examples""" |
145 examples = { | 139 examples = { |
146 'safeadd': ['com.oracle.max.graal.examples.safeadd', 'com.oracle.max.graal.examples.safeadd.Main'], | 140 'safeadd': ['com.oracle.graal.examples.safeadd', 'com.oracle.graal.examples.safeadd.Main'], |
147 'vectorlib': ['com.oracle.max.graal.examples.vectorlib', 'com.oracle.max.graal.examples.vectorlib.Main'], | 141 'vectorlib': ['com.oracle.graal.examples.vectorlib', 'com.oracle.graal.examples.vectorlib.Main'], |
148 } | 142 } |
149 | 143 |
150 def run_example(verbose, project, mainClass): | 144 def run_example(verbose, project, mainClass): |
151 cp = mx.classpath(project) | 145 cp = mx.classpath(project) |
152 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass] | 146 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass] |
239 | 233 |
240 # Give visualizer time to start | 234 # Give visualizer time to start |
241 mx.log('Waiting 5 seconds for visualizer to start') | 235 mx.log('Waiting 5 seconds for visualizer to start') |
242 time.sleep(5) | 236 time.sleep(5) |
243 | 237 |
244 vm(['-G:Dump=HelloWorld', '-G:MethodFilter=main', '-Xcomp', '-XX:CompileOnly=HelloWorld::main', '-cp', mx.classpath('com.oracle.max.graal.examples')] + args + ['examples.HelloWorld']) | 238 vm(['-G:Dump=HelloWorld', '-G:MethodFilter=main', '-Xcomp', '-XX:CompileOnly=HelloWorld::main', '-cp', mx.classpath('com.oracle.graal.examples')] + args + ['examples.HelloWorld']) |
245 | 239 |
246 def scaladacapo(args): | 240 def scaladacapo(args): |
247 """run one or all Scala DaCapo benchmarks | 241 """run one or all Scala DaCapo benchmarks |
248 | 242 |
249 Scala DaCapo options are distinguished from VM options by a '@' prefix. | 243 Scala DaCapo options are distinguished from VM options by a '@' prefix. |
501 if _jacoco == 'on' or _jacoco == 'append': | 495 if _jacoco == 'on' or _jacoco == 'append': |
502 jacocoagent = mx.library("JACOCOAGENT", True) | 496 jacocoagent = mx.library("JACOCOAGENT", True) |
503 agentOptions = { | 497 agentOptions = { |
504 'append' : 'true' if _jacoco == 'append' else 'false', | 498 'append' : 'true' if _jacoco == 'append' else 'false', |
505 'bootclasspath' : 'true', | 499 'bootclasspath' : 'true', |
506 'includes' : 'com.oracle.max.*', | 500 'includes' : 'com.oracle.*', |
507 'excludes' : ':'.join(_jacocoExcludes) | 501 'excludes' : ':'.join(_jacocoExcludes) |
508 } | 502 } |
509 args = ['-javaagent:' + jacocoagent.get_path(True) + '=' + ','.join([k + '=' + v for k, v in agentOptions.items()])] + args | 503 args = ['-javaagent:' + jacocoagent.get_path(True) + '=' + ','.join([k + '=' + v for k, v in agentOptions.items()])] + args |
510 exe = join(_jdk(build), 'bin', mx.exe_suffix('java')) | 504 exe = join(_jdk(build), 'bin', mx.exe_suffix('java')) |
511 return mx.run([exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) | 505 return mx.run([exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) |
515 # Keys are project names, values are package name lists. | 509 # Keys are project names, values are package name lists. |
516 # All source files in the given (project,package) pairs are scanned for lines | 510 # All source files in the given (project,package) pairs are scanned for lines |
517 # containing '@Test'. These are then determined to be the classes defining | 511 # containing '@Test'. These are then determined to be the classes defining |
518 # unit tests. | 512 # unit tests. |
519 _unittests = { | 513 _unittests = { |
520 'com.oracle.max.graal.tests': ['com.oracle.max.graal.compiler.tests'], | 514 'com.oracle.graal.tests': ['com.oracle.graal.compiler.tests'], |
521 } | 515 } |
522 _jtttests = { | 516 _jtttests = { |
523 'com.oracle.max.graal.jtt': ['com.oracle.max.graal.jtt'], | 517 'com.oracle.graal.jtt': ['com.oracle.graal.jtt'], |
524 } | 518 } |
525 | 519 |
526 def _add_test_classes(testClassList, searchDir, pkgRoot): | 520 def _add_test_classes(testClassList, searchDir, pkgRoot): |
527 pkgDecl = re.compile(r"^package\s+([a-zA-Z_][\w\.]*)\s*;$") | 521 pkgDecl = re.compile(r"^package\s+([a-zA-Z_][\w\.]*)\s*;$") |
528 for root, _, files in os.walk(searchDir): | 522 for root, _, files in os.walk(searchDir): |
879 _vmbuild = 'product' | 873 _vmbuild = 'product' |
880 commands = { | 874 commands = { |
881 'build': [build, '[-options]'], | 875 'build': [build, '[-options]'], |
882 'buildvms': [buildvms, '[-options]'], | 876 'buildvms': [buildvms, '[-options]'], |
883 'clean': [clean, ''], | 877 'clean': [clean, ''], |
884 'copyrightcheck': [copyrightcheck, ''], | |
885 'hsdis': [hsdis, '[att]'], | 878 'hsdis': [hsdis, '[att]'], |
886 'intro': [intro, ''], | 879 'intro': [intro, ''], |
887 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'], | 880 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'], |
888 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'], | 881 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'], |
889 'specjvm2008': [specjvm2008, '[VM options|@specjvm2008 options]'], | 882 'specjvm2008': [specjvm2008, '[VM options|@specjvm2008 options]'], |
895 'jtt' : [jtt, '[filters...]'], | 888 'jtt' : [jtt, '[filters...]'], |
896 'jacocoreport' : [jacocoreport, '[output directory]'], | 889 'jacocoreport' : [jacocoreport, '[output directory]'], |
897 'vm': [vm, '[-options] class [args...]'] | 890 'vm': [vm, '[-options] class [args...]'] |
898 } | 891 } |
899 | 892 |
900 mx.add_argument('--jacoco', help='instruments com.oracle.max.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) | 893 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) |
901 | 894 |
902 if (_vmSourcesAvailable): | 895 if (_vmSourcesAvailable): |
903 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') | 896 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') |
904 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM') | 897 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM') |
905 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM') | 898 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM') |