comparison mx/mx_graal.py @ 21938:0a6e10379b9b

Keeping only Truffle-related modules in this repository
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Fri, 12 Jun 2015 17:02:36 +0200
parents cf7b06489764
children e24237684856
comparison
equal deleted inserted replaced
21937:e701664f4168 21938:0a6e10379b9b
40 40
41 # This works because when mx loads this file, it makes sure __file__ gets an absolute path 41 # This works because when mx loads this file, it makes sure __file__ gets an absolute path
42 _graal_home = dirname(dirname(__file__)) 42 _graal_home = dirname(dirname(__file__))
43 43
44 """ Used to distinguish an exported GraalVM (see 'mx export'). """ 44 """ Used to distinguish an exported GraalVM (see 'mx export'). """
45 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) 45 _vmSourcesAvailable = True
46 46
47 """ The VMs that can be built and run along with an optional description. Only VMs with a 47 """ The VMs that can be built and run along with an optional description. Only VMs with a
48 description are listed in the dialogue for setting the default VM (see _get_vm()). """ 48 description are listed in the dialogue for setting the default VM (see _get_vm()). """
49 _vmChoices = { 49 _vmChoices = {
50 'jvmci' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.', 50 'jvmci' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.',
96 self.usesJVMCIClassLoader = usesJVMCIClassLoader 96 self.usesJVMCIClassLoader = usesJVMCIClassLoader
97 self.partOfHotSpot = partOfHotSpot # true when this distribution is delivered with HotSpot 97 self.partOfHotSpot = partOfHotSpot # true when this distribution is delivered with HotSpot
98 98
99 _jdkDeployedDists = [ 99 _jdkDeployedDists = [
100 JDKDeployedDist('TRUFFLE'), 100 JDKDeployedDist('TRUFFLE'),
101 JDKDeployedDist('JVMCI_SERVICE', partOfHotSpot=True),
102 JDKDeployedDist('JVMCI_API', usesJVMCIClassLoader=True, partOfHotSpot=True),
103 JDKDeployedDist('JVMCI_HOTSPOT', usesJVMCIClassLoader=True, partOfHotSpot=True),
104 JDKDeployedDist('GRAAL', usesJVMCIClassLoader=True),
105 JDKDeployedDist('GRAAL_TRUFFLE', usesJVMCIClassLoader=True)
106 ] 101 ]
107 102
108 JDK_UNIX_PERMISSIONS_DIR = 0755 103 JDK_UNIX_PERMISSIONS_DIR = 0755
109 JDK_UNIX_PERMISSIONS_FILE = 0644 104 JDK_UNIX_PERMISSIONS_FILE = 0644
110 JDK_UNIX_PERMISSIONS_EXEC = 0755 105 JDK_UNIX_PERMISSIONS_EXEC = 0755
121 """ 116 """
122 global _vm 117 global _vm
123 if _vm: 118 if _vm:
124 return _vm 119 return _vm
125 vm = mx.get_env('DEFAULT_VM') 120 vm = mx.get_env('DEFAULT_VM')
121 if vm is None:
122 extras = mx.get_env('EXTRA_JAVA_HOMES')
123 if not extras is None:
124 for e in extras.split(':'):
125 vm = e
126 break
126 envPath = join(_graal_home, 'mx', 'env') 127 envPath = join(_graal_home, 'mx', 'env')
127 if vm and 'graal' in vm: 128 if vm and 'graal' in vm:
128 if exists(envPath): 129 if exists(envPath):
129 with open(envPath) as fp: 130 with open(envPath) as fp:
130 if 'DEFAULT_VM=' + vm in fp.read(): 131 if 'DEFAULT_VM=' + vm in fp.read():
197 elif os.path.isfile(name): 198 elif os.path.isfile(name):
198 os.unlink(name) 199 os.unlink(name)
199 200
200 rmIfExists(join(_graal_home, 'build')) 201 rmIfExists(join(_graal_home, 'build'))
201 rmIfExists(join(_graal_home, 'build-nojvmci')) 202 rmIfExists(join(_graal_home, 'build-nojvmci'))
202 rmIfExists(_jdksDir()) 203 # rmIfExists(_jdksDir())
203 204
204 def export(args): 205 def export(args):
205 """create archives of builds split by vmbuild and vm""" 206 """create archives of builds split by vmbuild and vm"""
206 207
207 parser = ArgumentParser(prog='mx export') 208 parser = ArgumentParser(prog='mx export')
495 if installJars: 496 if installJars:
496 for jdkDist in _jdkDeployedDists: 497 for jdkDist in _jdkDeployedDists:
497 dist = mx.distribution(jdkDist.name) 498 dist = mx.distribution(jdkDist.name)
498 if exists(dist.path) and jdkDist.partOfHotSpot: 499 if exists(dist.path) and jdkDist.partOfHotSpot:
499 _installDistInJdks(jdkDist) 500 _installDistInJdks(jdkDist)
500
501 if vmToCheck is not None:
502 jvmCfg = _vmCfgInJdk(jdk)
503 found = False
504 with open(jvmCfg) as f:
505 for line in f:
506 if line.strip() == '-' + vmToCheck + ' KNOWN':
507 found = True
508 break
509 if not found:
510 _handle_missing_VM(build, vmToCheck)
511 501
512 return jdk 502 return jdk
513 503
514 def _updateInstalledJVMCIOptionsFile(jdk): 504 def _updateInstalledJVMCIOptionsFile(jdk):
515 jvmciOptions = join(_graal_home, 'jvmci.options') 505 jvmciOptions = join(_graal_home, 'jvmci.options')
668 658
669 def _installDistInJdks(deployableDist): 659 def _installDistInJdks(deployableDist):
670 """ 660 """
671 Installs the jar(s) for a given Distribution into all existing JVMCI JDKs 661 Installs the jar(s) for a given Distribution into all existing JVMCI JDKs
672 """ 662 """
663 if True:
664 return
673 dist = mx.distribution(deployableDist.name) 665 dist = mx.distribution(deployableDist.name)
674 if dist.name == 'GRAAL': 666 if dist.name == 'GRAAL':
675 _patchGraalVersionConstant(dist) 667 _patchGraalVersionConstant(dist)
676 668
677 jdks = _jdksDir() 669 jdks = _jdksDir()
902 if vm == 'original': 894 if vm == 'original':
903 if build != 'product': 895 if build != 'product':
904 mx.log('only product build of original VM exists') 896 mx.log('only product build of original VM exists')
905 continue 897 continue
906 898
907 if not isVMSupported(vm): 899 if True:
908 mx.log('The ' + vm + ' VM is not supported on this platform - skipping') 900 mx.log('Skipping the VM')
909 continue 901 continue
910 902
911 vmDir = join(_vmLibDirInJdk(jdk), vm) 903 vmDir = join(_vmLibDirInJdk(jdk), vm)
912 if not exists(vmDir): 904 if not exists(vmDir):
913 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS_DIR) 905 chmodRecursive(jdk, JDK_UNIX_PERMISSIONS_DIR)
1148 args = mx.java().processArgs(args) 1140 args = mx.java().processArgs(args)
1149 return (pfx, exe, vm, args, cwd) 1141 return (pfx, exe, vm, args, cwd)
1150 1142
1151 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): 1143 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
1152 (pfx_, exe_, vm_, args_, cwd) = _parseVmArgs(args, vm, cwd, vmbuild) 1144 (pfx_, exe_, vm_, args_, cwd) = _parseVmArgs(args, vm, cwd, vmbuild)
1145 vm_ = 'jvmci'
1153 return mx.run(pfx_ + [exe_, '-' + vm_] + args_, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) 1146 return mx.run(pfx_ + [exe_, '-' + vm_] + args_, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
1154 1147
1155 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False): 1148 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False):
1156 """ 1149 """
1157 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation' 1150 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation'
1267 testfile = os.environ.get('MX_TESTFILE', None) 1260 testfile = os.environ.get('MX_TESTFILE', None)
1268 if testfile is None: 1261 if testfile is None:
1269 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") 1262 (_, testfile) = tempfile.mkstemp(".testclasses", "graal")
1270 os.close(_) 1263 os.close(_)
1271 1264
1272 coreCp = mx.classpath(['com.oracle.graal.test', 'HCFDIS']) 1265 coreCp = mx.classpath(['com.oracle.truffle.tck', 'HCFDIS'])
1273 1266
1274 coreArgs = [] 1267 coreArgs = []
1275 if verbose: 1268 if verbose:
1276 coreArgs.append('-JUnitVerbose') 1269 coreArgs.append('-JUnitVerbose')
1277 if fail_fast: 1270 if fail_fast:
1312 vmArgs = ['-Djava.awt.headless=true'] + vmArgs 1305 vmArgs = ['-Djava.awt.headless=true'] + vmArgs
1313 1306
1314 if len(testclasses) == 1: 1307 if len(testclasses) == 1:
1315 # Execute Junit directly when one test is being run. This simplifies 1308 # Execute Junit directly when one test is being run. This simplifies
1316 # replaying the VM execution in a native debugger (e.g., gdb). 1309 # replaying the VM execution in a native debugger (e.g., gdb).
1317 vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + testclasses) 1310 vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.truffle.tck.TruffleJUnitCore'] + coreArgs + testclasses)
1318 else: 1311 else:
1319 vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + ['@' + mx._cygpathU2W(testfile)]) 1312 vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.truffle.tck.TruffleJUnitCore'] + coreArgs + ['@' + mx._cygpathU2W(testfile)])
1320 1313
1321 try: 1314 try:
1322 _run_tests(args, harness, annotations, testfile, blacklist, whitelist, regex) 1315 _run_tests(args, harness, annotations, testfile, blacklist, whitelist, regex)
1323 finally: 1316 finally:
1324 if os.environ.get('MX_TESTFILE') is None: 1317 if os.environ.get('MX_TESTFILE') is None:
1587 vmargs = ['-Djava.awt.headless=true'] + vmargs 1580 vmargs = ['-Djava.awt.headless=true'] + vmargs
1588 1581
1589 vm(vmargs) 1582 vm(vmargs)
1590 1583
1591 def _basic_gate_body(args, tasks): 1584 def _basic_gate_body(args, tasks):
1592 # Build server-hosted-jvmci now so we can run the unit tests
1593 with Task('BuildHotSpotJVMCIHosted: product', tasks) as t:
1594 if t: buildvms(['--vms', 'server', '--builds', 'product', '--check-distributions'])
1595
1596 # Run unit tests on server-hosted-jvmci 1585 # Run unit tests on server-hosted-jvmci
1597 with VM('server', 'product'): 1586 with VM('server', 'product'):
1598 with Task('UnitTests:hosted-product', tasks) as t: 1587 with Task('UnitTests:hosted-product', tasks) as t:
1599 if t: unittest(['--enable-timing', '--verbose', '--fail-fast']) 1588 if t: unittest(['--enable-timing', '--verbose', '--fail-fast'])
1600
1601 # Run ctw against rt.jar on server-hosted-jvmci
1602 with VM('server', 'product'):
1603 with Task('CTW:hosted-product', tasks) as t:
1604 if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-CompileTheWorldVerbose'])
1605
1606 # Build the other VM flavors
1607 with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks) as t:
1608 if t: buildvms(['--vms', 'jvmci,server', '--builds', 'fastdebug,product', '--check-distributions'])
1609
1610 with VM('jvmci', 'fastdebug'):
1611 with Task('BootstrapWithSystemAssertions:fastdebug', tasks) as t:
1612 if t: vm(['-esa', '-XX:-TieredCompilation', '-version'])
1613
1614 with VM('jvmci', 'fastdebug'):
1615 with Task('BootstrapEconomyWithSystemAssertions:fastdebug', tasks) as t:
1616 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:CompilerConfiguration=economy', '-version'])
1617
1618 with VM('jvmci', 'fastdebug'):
1619 with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks) as t:
1620 if t: vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version'])
1621
1622 with VM('jvmci', 'fastdebug'):
1623 with Task('BootstrapWithExceptionEdges:fastdebug', tasks) as t:
1624 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:+StressInvokeWithExceptionNode', '-version'])
1625
1626 with VM('jvmci', 'product'):
1627 with Task('BootstrapWithGCVerification:product', tasks) as t:
1628 if t:
1629 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write
1630 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out)
1631
1632 with VM('jvmci', 'product'):
1633 with Task('BootstrapWithG1GCVerification:product', tasks) as t:
1634 if t:
1635 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write
1636 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out)
1637
1638 with VM('jvmci', 'product'):
1639 with Task('BootstrapWithRegisterPressure:product', tasks) as t:
1640 if t:
1641 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14'
1642 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=' + registers, '-esa', '-version'])
1643
1644 with VM('jvmci', 'product'):
1645 with Task('BootstrapSSAWithRegisterPressure:product', tasks) as t:
1646 if t:
1647 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14'
1648 vm(['-XX:-TieredCompilation', '-G:+SSA_LIR', '-G:RegisterPressure=' + registers, '-esa', '-version'])
1649
1650 with VM('jvmci', 'product'):
1651 with Task('BootstrapWithImmutableCode:product', tasks) as t:
1652 if t: vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version'])
1653
1654 for vmbuild in ['fastdebug', 'product']:
1655 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild):
1656 with Task(str(test) + ':' + vmbuild, tasks) as t:
1657 if t and not test.test('jvmci'):
1658 t.abort(test.name + ' Failed')
1659
1660 # ensure -Xbatch still works
1661 with VM('jvmci', 'product'):
1662 with Task('DaCapo_pmd:BatchMode:product', tasks) as t:
1663 if t: dacapo(['-Xbatch', 'pmd'])
1664
1665 # ensure -Xcomp still works
1666 with VM('jvmci', 'product'):
1667 with Task('XCompMode:product', tasks) as t:
1668 if t: vm(['-Xcomp', '-version'])
1669
1670 if args.jacocout is not None:
1671 jacocoreport([args.jacocout])
1672
1673 global _jacoco
1674 _jacoco = 'off'
1675
1676 with Task('CleanAndBuildIdealGraphVisualizer', tasks) as t:
1677 if t and platform.processor() != 'sparc':
1678 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'))
1679 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
1680
1681 # Prevent JVMCI modifications from breaking the standard builds
1682 if args.buildNonJVMCI:
1683 with Task('BuildHotSpotVarieties', tasks) as t:
1684 if t:
1685 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product'])
1686 if mx.get_os() not in ['windows', 'cygwin']:
1687 buildvms(['--vms', 'server-nojvmci', '--builds', 'product,optimized'])
1688
1689 for vmbuild in ['product', 'fastdebug']:
1690 for theVm in ['client', 'server']:
1691 if not isVMSupported(theVm):
1692 mx.log('The ' + theVm + ' VM is not supported on this platform')
1693 continue
1694 with VM(theVm, vmbuild):
1695 with Task('DaCapo_pmd:' + theVm + ':' + vmbuild, tasks) as t:
1696 if t: dacapo(['pmd'])
1697
1698 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t:
1699 if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api', 'java.test'])
1700 1589
1701 1590
1702 def gate(args, gate_body=_basic_gate_body): 1591 def gate(args, gate_body=_basic_gate_body):
1703 """run the tests used to validate a push 1592 """run the tests used to validate a push
1704 1593
1888 if mx.run(['ant', '-f', mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False): 1777 if mx.run(['ant', '-f', mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False):
1889 mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.") 1778 mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.")
1890 1779
1891 def maven_install_truffle(args): 1780 def maven_install_truffle(args):
1892 """install Truffle into your local Maven repository""" 1781 """install Truffle into your local Maven repository"""
1893 for name in ['TRUFFLE', 'TRUFFLE-DSL-PROCESSOR']: 1782 for name in ['TRUFFLE', 'TRUFFLE-TCK', 'TRUFFLE-DSL-PROCESSOR']:
1894 mx.archive(["@" + name]) 1783 mx.archive(["@" + name])
1895 path = mx._dists[name].path 1784 path = mx._dists[name].path
1896 mx.run(['mvn', 'install:install-file', '-DgroupId=com.oracle', '-DartifactId=' + name.lower(), '-Dversion=' + graal_version('SNAPSHOT'), '-Dpackaging=jar', '-Dfile=' + path]) 1785 mx.run(['mvn', 'install:install-file', '-DgroupId=com.oracle', '-DartifactId=' + name.lower(), '-Dversion=' + graal_version('SNAPSHOT'), '-Dpackaging=jar', '-Dfile=' + path])
1897 1786
1898 def c1visualizer(args): 1787 def c1visualizer(args):