comparison mx/mx_graal.py @ 13967:4cd7c6629841

mx_graal: fix pylint 1.1.0 warnings
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 17 Feb 2014 23:09:19 +0100
parents b076b5c13c3f
children fad977c86a88
comparison
equal deleted inserted replaced
13966:be0d961e3a88 13967:4cd7c6629841
609 609
610 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm) 610 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm)
611 project_config = variant + '_' + build 611 project_config = variant + '_' + build
612 _runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', _graal_home) 612 _runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', _graal_home)
613 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set OUT_DIR=' + jdk + r'& set JAVA_HOME=' + jdk + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' + _graal_home + r'\make\windows"& call create.bat ' + _graal_home 613 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set OUT_DIR=' + jdk + r'& set JAVA_HOME=' + jdk + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' + _graal_home + r'\make\windows"& call create.bat ' + _graal_home
614 print(winCompileCmd) 614 print winCompileCmd
615 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") 615 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:")
616 if not _runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess): 616 if not _runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess):
617 mx.log('Error executing create command') 617 mx.log('Error executing create command')
618 return 618 return
619 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64' 619 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64'
638 638
639 # extract latest release tag for graal 639 # extract latest release tag for graal
640 tags = [x.split(' ')[0] for x in subprocess.check_output(['hg', 'tags']).split('\n') if x.startswith("graal-")] 640 tags = [x.split(' ')[0] for x in subprocess.check_output(['hg', 'tags']).split('\n') if x.startswith("graal-")]
641 if tags: 641 if tags:
642 # extract the most recent tag 642 # extract the most recent tag
643 tag = sorted(tags, key = lambda e : [int(x) for x in e[len("graal-"):].split('.')], reverse = True)[0] 643 tag = sorted(tags, key=lambda e: [int(x) for x in e[len("graal-"):].split('.')], reverse=True)[0]
644 env.setdefault('USER_RELEASE_SUFFIX', tag) 644 env.setdefault('USER_RELEASE_SUFFIX', tag)
645 if not mx._opts.verbose: 645 if not mx._opts.verbose:
646 runCmd.append('MAKE_VERBOSE=') 646 runCmd.append('MAKE_VERBOSE=')
647 env['JAVA_HOME'] = jdk 647 env['JAVA_HOME'] = jdk
648 if vm.endswith('nograal'): 648 if vm.endswith('nograal'):
649 env['INCLUDE_GRAAL'] = 'false' 649 env['INCLUDE_GRAAL'] = 'false'
650 env.setdefault('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os())) 650 env.setdefault('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()))
651 else: 651 else:
652 env['INCLUDE_GRAAL'] = 'true' 652 env['INCLUDE_GRAAL'] = 'true'
653 env.setdefault('INSTALL', 'y') 653 env.setdefault('INSTALL', 'y')
654 if mx.get_os() == 'solaris' : 654 if mx.get_os() == 'solaris':
655 # If using sparcWorks, setup flags to avoid make complaining about CC version 655 # If using sparcWorks, setup flags to avoid make complaining about CC version
656 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0] 656 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0]
657 if cCompilerVersion.startswith('CC: Sun C++') : 657 if cCompilerVersion.startswith('CC: Sun C++'):
658 compilerRev = cCompilerVersion.split(' ')[3] 658 compilerRev = cCompilerVersion.split(' ')[3]
659 env.setdefault('ENFORCE_COMPILER_REV', compilerRev) 659 env.setdefault('ENFORCE_COMPILER_REV', compilerRev)
660 env.setdefault('ENFORCE_CC_COMPILER_REV', compilerRev) 660 env.setdefault('ENFORCE_CC_COMPILER_REV', compilerRev)
661 if build == 'jvmg': 661 if build == 'jvmg':
662 # I want ALL the symbols when I'm debugging on Solaris 662 # I want ALL the symbols when I'm debugging on Solaris
766 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation' 766 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation'
767 (ignoring preceding whitespace) and return the fully qualified class name for each Java 767 (ignoring preceding whitespace) and return the fully qualified class name for each Java
768 source file matched in a list. 768 source file matched in a list.
769 """ 769 """
770 770
771 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 771 matches = lambda line: len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0
772 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) 772 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses)
773 773
774 def _extract_VM_args(args, allowClasspath=False, useDoubleDash=False): 774 def _extract_VM_args(args, allowClasspath=False, useDoubleDash=False):
775 """ 775 """
776 Partitions a command line into a leading sequence of HotSpot VM options and the rest. 776 Partitions a command line into a leading sequence of HotSpot VM options and the rest.
1205 return [a[len(prefix):] for a in args if a.startswith(prefix)] 1205 return [a[len(prefix):] for a in args if a.startswith(prefix)]
1206 1206
1207 results = {} 1207 results = {}
1208 benchmarks = [] 1208 benchmarks = []
1209 # DaCapo 1209 # DaCapo
1210 if ('dacapo' in args or 'all' in args): 1210 if 'dacapo' in args or 'all' in args:
1211 benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) 1211 benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
1212 else: 1212 else:
1213 dacapos = benchmarks_in_group('dacapo') 1213 dacapos = benchmarks_in_group('dacapo')
1214 for dacapo in dacapos: 1214 for dacapo in dacapos:
1215 if dacapo not in sanitycheck.dacapoSanityWarmup.keys(): 1215 if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
1216 mx.abort('Unknown DaCapo : ' + dacapo) 1216 mx.abort('Unknown DaCapo : ' + dacapo)
1217 iterations = sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark] 1217 iterations = sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark]
1218 if (iterations > 0): 1218 if iterations > 0:
1219 benchmarks += [sanitycheck.getDacapo(dacapo, iterations)] 1219 benchmarks += [sanitycheck.getDacapo(dacapo, iterations)]
1220 1220
1221 if ('scaladacapo' in args or 'all' in args): 1221 if 'scaladacapo' in args or 'all' in args:
1222 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) 1222 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
1223 else: 1223 else:
1224 scaladacapos = benchmarks_in_group('scaladacapo') 1224 scaladacapos = benchmarks_in_group('scaladacapo')
1225 for scaladacapo in scaladacapos: 1225 for scaladacapo in scaladacapos:
1226 if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys(): 1226 if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
1227 mx.abort('Unknown Scala DaCapo : ' + scaladacapo) 1227 mx.abort('Unknown Scala DaCapo : ' + scaladacapo)
1228 iterations = sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark] 1228 iterations = sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark]
1229 if (iterations > 0): 1229 if iterations > 0:
1230 benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, ['-n', str(iterations)])] 1230 benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, ['-n', str(iterations)])]
1231 1231
1232 # Bootstrap 1232 # Bootstrap
1233 if ('bootstrap' in args or 'all' in args): 1233 if 'bootstrap' in args or 'all' in args:
1234 benchmarks += sanitycheck.getBootstraps() 1234 benchmarks += sanitycheck.getBootstraps()
1235 # SPECjvm2008 1235 # SPECjvm2008
1236 if ('specjvm2008' in args or 'all' in args): 1236 if 'specjvm2008' in args or 'all' in args:
1237 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120'])] 1237 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120'])]
1238 else: 1238 else:
1239 specjvms = benchmarks_in_group('specjvm2008') 1239 specjvms = benchmarks_in_group('specjvm2008')
1240 for specjvm in specjvms: 1240 for specjvm in specjvms:
1241 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120', specjvm])] 1241 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120', specjvm])]
1242 1242
1243 if ('specjbb2005' in args or 'all' in args): 1243 if 'specjbb2005' in args or 'all' in args:
1244 benchmarks += [sanitycheck.getSPECjbb2005()] 1244 benchmarks += [sanitycheck.getSPECjbb2005()]
1245 1245
1246 if ('specjbb2013' in args): # or 'all' in args //currently not in default set 1246 if 'specjbb2013' in args: # or 'all' in args //currently not in default set
1247 benchmarks += [sanitycheck.getSPECjbb2013()] 1247 benchmarks += [sanitycheck.getSPECjbb2013()]
1248 1248
1249 if ('ctw-full' in args): 1249 if 'ctw-full' in args:
1250 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full)) 1250 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full))
1251 if ('ctw-noinline' in args): 1251 if 'ctw-noinline' in args:
1252 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline)) 1252 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline))
1253 if ('ctw-nocomplex' in args): 1253 if 'ctw-nocomplex' in args:
1254 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoComplex)) 1254 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoComplex))
1255 1255
1256 for test in benchmarks: 1256 for test in benchmarks:
1257 for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items(): 1257 for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items():
1258 group = results.setdefault(groupName, {}) 1258 group = results.setdefault(groupName, {})
1274 mx.abort("$JMH_BENCHMARKS not properly definied") 1274 mx.abort("$JMH_BENCHMARKS not properly definied")
1275 1275
1276 def _blackhole(x): 1276 def _blackhole(x):
1277 mx.logv(x[:-1]) 1277 mx.logv(x[:-1])
1278 mx.log("Building benchmarks...") 1278 mx.log("Building benchmarks...")
1279 mx.run(['mvn', 'package'], cwd = jmhPath, out = _blackhole) 1279 mx.run(['mvn', 'package'], cwd=jmhPath, out=_blackhole)
1280 1280
1281 matchedSuites = set() 1281 matchedSuites = set()
1282 numBench = [0] 1282 numBench = [0]
1283 for micros in os.listdir(jmhPath): 1283 for micros in os.listdir(jmhPath):
1284 absoluteMicro = os.path.join(jmhPath, micros) 1284 absoluteMicro = os.path.join(jmhPath, micros)
1302 1302
1303 if match: 1303 if match:
1304 numBench[0] += 1 1304 numBench[0] += 1
1305 matchedSuites.add(micros) 1305 matchedSuites.add(micros)
1306 1306
1307 mx.run_java(['-jar', microJar, "-l"], cwd = jmhPath, out = _addBenchmark, addDefaultArgs = False) 1307 mx.run_java(['-jar', microJar, "-l"], cwd=jmhPath, out=_addBenchmark, addDefaultArgs=False)
1308 else: 1308 else:
1309 matchedSuites.add(micros) 1309 matchedSuites.add(micros)
1310 1310
1311 mx.logv("matchedSuites: " + str(matchedSuites)) 1311 mx.logv("matchedSuites: " + str(matchedSuites))
1312 plural = 's' if not benchmarks or numBench[0] > 1 else '' 1312 plural = 's' if not benchmarks or numBench[0] > 1 else ''
1326 ['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), 1326 ['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"),
1327 "-f", "1", 1327 "-f", "1",
1328 "-i", "10", "-wi", "10", 1328 "-i", "10", "-wi", "10",
1329 "--jvm", exe, 1329 "--jvm", exe,
1330 "--jvmArgs", " ".join(["-" + vm] + forkedVmArgs)] + regex, 1330 "--jvmArgs", " ".join(["-" + vm] + forkedVmArgs)] + regex,
1331 addDefaultArgs = False, 1331 addDefaultArgs=False,
1332 cwd = jmhPath) 1332 cwd=jmhPath)
1333 1333
1334 1334
1335 def specjvm2008(args): 1335 def specjvm2008(args):
1336 """run one or more SPECjvm2008 benchmarks""" 1336 """run one or more SPECjvm2008 benchmarks"""
1337 1337
1643 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>') 1643 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>')
1644 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' + 1644 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' +
1645 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' + 1645 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' +
1646 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>') 1646 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>')
1647 1647
1648 if (_vmSourcesAvailable): 1648 if _vmSourcesAvailable:
1649 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys(), help='the VM type to build/run') 1649 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys(), help='the VM type to build/run')
1650 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')') 1650 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')')
1651 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse') 1651 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse')
1652 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>') 1652 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>')
1653 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"') 1653 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"')
1658 1658
1659 mx.update_commands(suite, commands) 1659 mx.update_commands(suite, commands)
1660 1660
1661 def mx_post_parse_cmd_line(opts): # 1661 def mx_post_parse_cmd_line(opts): #
1662 # TODO _minVersion check could probably be part of a Suite in mx? 1662 # TODO _minVersion check could probably be part of a Suite in mx?
1663 if (mx.java().version < _minVersion) : 1663 if mx.java().version < _minVersion:
1664 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater, got version ' + str(mx.java().version)) 1664 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater, got version ' + str(mx.java().version))
1665 1665
1666 if (_vmSourcesAvailable): 1666 if _vmSourcesAvailable:
1667 if hasattr(opts, 'vm') and opts.vm is not None: 1667 if hasattr(opts, 'vm') and opts.vm is not None:
1668 global _vm 1668 global _vm
1669 _vm = opts.vm 1669 _vm = opts.vm
1670 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: 1670 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None:
1671 global _vmbuild 1671 global _vmbuild