Mercurial > hg > truffle
comparison mx/mx_graal.py @ 20053:eea134855f85
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 27 Mar 2015 17:02:53 +0100 |
parents | 4d119424b4ce |
children | 6e5df2d60fbd |
comparison
equal
deleted
inserted
replaced
20052:d22307a9a025 | 20053:eea134855f85 |
---|---|
1423 vm(vmargs, vm=v, vmbuild=vmbuild) | 1423 vm(vmargs, vm=v, vmbuild=vmbuild) |
1424 allDuration = datetime.timedelta(seconds=time.time() - allStart) | 1424 allDuration = datetime.timedelta(seconds=time.time() - allStart) |
1425 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') | 1425 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') |
1426 | 1426 |
1427 class Task: | 1427 class Task: |
1428 # None or a list of strings. If not None, only tasks whose title | |
1429 # matches at least one of the substrings in this list will return | |
1430 # a non-None value from __enter__. The body of a 'with Task(...) as t' | |
1431 # statement should check 't' and exit immediately if it is None. | |
1432 filters = None | |
1433 | |
1428 def __init__(self, title, tasks=None): | 1434 def __init__(self, title, tasks=None): |
1429 self.start = time.time() | 1435 self.tasks = tasks |
1430 self.title = title | 1436 self.title = title |
1431 self.end = None | 1437 self.skipped = tasks is not None and Task.filters is not None and not any([f in title for f in Task.filters]) |
1432 self.duration = None | 1438 if not self.skipped: |
1433 self.tasks = tasks | 1439 self.start = time.time() |
1434 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) | 1440 self.end = None |
1441 self.duration = None | |
1442 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) | |
1435 def __enter__(self): | 1443 def __enter__(self): |
1436 assert self.tasks is not None, "using Task with 'with' statement requires to pass the tasks list in the constructor" | 1444 assert self.tasks is not None, "using Task with 'with' statement requires to pass the tasks list in the constructor" |
1445 if self.skipped: | |
1446 return None | |
1437 return self | 1447 return self |
1438 def __exit__(self, exc_type, exc_value, traceback): | 1448 def __exit__(self, exc_type, exc_value, traceback): |
1439 self.tasks.append(self.stop()) | 1449 if not self.skipped: |
1450 self.tasks.append(self.stop()) | |
1440 def stop(self): | 1451 def stop(self): |
1441 self.end = time.time() | 1452 self.end = time.time() |
1442 self.duration = datetime.timedelta(seconds=self.end - self.start) | 1453 self.duration = datetime.timedelta(seconds=self.end - self.start) |
1443 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']') | 1454 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']') |
1444 return self | 1455 return self |
1475 if vm_ == 'graal': | 1486 if vm_ == 'graal': |
1476 vmargs += ['-XX:+BootstrapGraal'] | 1487 vmargs += ['-XX:+BootstrapGraal'] |
1477 vmargs += ['-G:CompileTheWorldClasspath=' + jar] | 1488 vmargs += ['-G:CompileTheWorldClasspath=' + jar] |
1478 else: | 1489 else: |
1479 vmargs += ['-Xbootclasspath/p:' + jar] | 1490 vmargs += ['-Xbootclasspath/p:' + jar] |
1491 | |
1492 # suppress menubar and dock when running on Mac | |
1493 vmargs = ['-Djava.awt.headless=true'] + vmargs | |
1494 | |
1480 vm(vmargs) | 1495 vm(vmargs) |
1481 | 1496 |
1482 def _basic_gate_body(args, tasks): | 1497 def _basic_gate_body(args, tasks): |
1483 # Build server-hosted-graal now so we can run the unit tests | 1498 # Build server-hosted-graal now so we can run the unit tests |
1484 with Task('BuildHotSpotGraalHosted: product', tasks): | 1499 with Task('BuildHotSpotGraalHosted: product', tasks) as t: |
1485 buildvms(['--vms', 'server', '--builds', 'product']) | 1500 if t: buildvms(['--vms', 'server', '--builds', 'product']) |
1486 | 1501 |
1487 # Run unit tests on server-hosted-graal | 1502 # Run unit tests on server-hosted-graal |
1488 with VM('server', 'product'): | 1503 with VM('server', 'product'): |
1489 with Task('UnitTests:hosted-product', tasks): | 1504 with Task('UnitTests:hosted-product', tasks) as t: |
1490 unittest(['--enable-timing', '--verbose', '--fail-fast']) | 1505 if t: unittest(['--enable-timing', '--verbose', '--fail-fast']) |
1506 | |
1507 # Run ctw against rt.jar on server-hosted-graal | |
1508 with VM('server', 'product'): | |
1509 with Task('CTW:hosted-product', tasks) as t: | |
1510 if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-CompileTheWorldVerbose']) | |
1491 | 1511 |
1492 # Build the other VM flavors | 1512 # Build the other VM flavors |
1493 with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks): | 1513 with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks) as t: |
1494 buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product']) | 1514 if t: buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product']) |
1495 | 1515 |
1496 with VM('graal', 'fastdebug'): | 1516 with VM('graal', 'fastdebug'): |
1497 with Task('BootstrapWithSystemAssertions:fastdebug', tasks): | 1517 with Task('BootstrapWithSystemAssertions:fastdebug', tasks) as t: |
1498 vm(['-esa', '-XX:-TieredCompilation', '-version']) | 1518 if t: vm(['-esa', '-XX:-TieredCompilation', '-version']) |
1499 | 1519 |
1500 with VM('graal', 'fastdebug'): | 1520 with VM('graal', 'fastdebug'): |
1501 with Task('BootstrapEconomyWithSystemAssertions:fastdebug', tasks): | 1521 with Task('BootstrapEconomyWithSystemAssertions:fastdebug', tasks) as t: |
1502 vm(['-esa', '-XX:-TieredCompilation', '-G:CompilerConfiguration=economy', '-version']) | 1522 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:CompilerConfiguration=economy', '-version']) |
1503 | 1523 |
1504 with VM('graal', 'fastdebug'): | 1524 with VM('graal', 'fastdebug'): |
1505 with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks): | 1525 with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks) as t: |
1506 vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version']) | 1526 if t: vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version']) |
1507 | 1527 |
1508 with VM('graal', 'product'): | 1528 with VM('graal', 'product'): |
1509 with Task('BootstrapWithGCVerification:product', tasks): | 1529 with Task('BootstrapWithGCVerification:product', tasks) as t: |
1510 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write | 1530 if t: |
1511 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | 1531 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
1532 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | |
1512 | 1533 |
1513 with VM('graal', 'product'): | 1534 with VM('graal', 'product'): |
1514 with Task('BootstrapWithG1GCVerification:product', tasks): | 1535 with Task('BootstrapWithG1GCVerification:product', tasks) as t: |
1515 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write | 1536 if t: |
1516 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | 1537 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
1538 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | |
1517 | 1539 |
1518 with VM('graal', 'product'): | 1540 with VM('graal', 'product'): |
1519 with Task('BootstrapWithRegisterPressure:product', tasks): | 1541 with Task('BootstrapWithRegisterPressure:product', tasks) as t: |
1520 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=rbx,r11,r10,r14,xmm3,xmm11,xmm14', '-esa', '-version']) | 1542 if t: vm(['-XX:-TieredCompilation', '-G:RegisterPressure=rbx,r11,r10,r14,xmm3,xmm11,xmm14', '-esa', '-version']) |
1521 | 1543 |
1522 with VM('graal', 'product'): | 1544 with VM('graal', 'product'): |
1523 with Task('BootstrapWithImmutableCode:product', tasks): | 1545 with Task('BootstrapWithImmutableCode:product', tasks) as t: |
1524 vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version']) | 1546 if t: vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version']) |
1525 | 1547 |
1526 for vmbuild in ['fastdebug', 'product']: | 1548 for vmbuild in ['fastdebug', 'product']: |
1527 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): | 1549 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
1528 with Task(str(test) + ':' + vmbuild, tasks) as t: | 1550 with Task(str(test) + ':' + vmbuild, tasks) as t: |
1529 if not test.test('graal'): | 1551 if t and not test.test('graal'): |
1530 t.abort(test.name + ' Failed') | 1552 t.abort(test.name + ' Failed') |
1531 | 1553 |
1532 # ensure -Xbatch still works | 1554 # ensure -Xbatch still works |
1533 with VM('graal', 'product'): | 1555 with VM('graal', 'product'): |
1534 with Task('DaCapo_pmd:BatchMode:product', tasks): | 1556 with Task('DaCapo_pmd:BatchMode:product', tasks) as t: |
1535 dacapo(['-Xbatch', 'pmd']) | 1557 if t: dacapo(['-Xbatch', 'pmd']) |
1536 | 1558 |
1537 # ensure -Xcomp still works | 1559 # ensure -Xcomp still works |
1538 with VM('graal', 'product'): | 1560 with VM('graal', 'product'): |
1539 with Task('XCompMode:product', tasks): | 1561 with Task('XCompMode:product', tasks) as t: |
1540 vm(['-Xcomp', '-version']) | 1562 if t: vm(['-Xcomp', '-version']) |
1541 | 1563 |
1542 if args.jacocout is not None: | 1564 if args.jacocout is not None: |
1543 jacocoreport([args.jacocout]) | 1565 jacocoreport([args.jacocout]) |
1544 | 1566 |
1545 global _jacoco | 1567 global _jacoco |
1546 _jacoco = 'off' | 1568 _jacoco = 'off' |
1547 | 1569 |
1548 with Task('CleanAndBuildIdealGraphVisualizer', tasks): | 1570 with Task('CleanAndBuildIdealGraphVisualizer', tasks) as t: |
1549 env = _igvFallbackJDK(os.environ) | 1571 if t: |
1550 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) | 1572 env = _igvFallbackJDK(os.environ) |
1551 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=env) | 1573 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) |
1574 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=env) | |
1552 | 1575 |
1553 # Prevent Graal modifications from breaking the standard builds | 1576 # Prevent Graal modifications from breaking the standard builds |
1554 if args.buildNonGraal: | 1577 if args.buildNonGraal: |
1555 with Task('BuildHotSpotVarieties', tasks): | 1578 with Task('BuildHotSpotVarieties', tasks) as t: |
1556 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) | 1579 if t: |
1557 if mx.get_os() not in ['windows', 'cygwin']: | 1580 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) |
1558 buildvms(['--vms', 'server-nograal', '--builds', 'product,optimized']) | 1581 if mx.get_os() not in ['windows', 'cygwin']: |
1582 buildvms(['--vms', 'server-nograal', '--builds', 'product,optimized']) | |
1559 | 1583 |
1560 for vmbuild in ['product', 'fastdebug']: | 1584 for vmbuild in ['product', 'fastdebug']: |
1561 for theVm in ['client', 'server']: | 1585 for theVm in ['client', 'server']: |
1562 if not isVMSupported(theVm): | 1586 if not isVMSupported(theVm): |
1563 mx.log('The' + theVm + ' VM is not supported on this platform') | 1587 mx.log('The' + theVm + ' VM is not supported on this platform') |
1564 continue | 1588 continue |
1565 with VM(theVm, vmbuild): | 1589 with VM(theVm, vmbuild): |
1566 with Task('DaCapo_pmd:' + theVm + ':' + vmbuild, tasks): | 1590 with Task('DaCapo_pmd:' + theVm + ':' + vmbuild, tasks) as t: |
1567 dacapo(['pmd']) | 1591 if t: dacapo(['pmd']) |
1568 | 1592 |
1569 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks): | 1593 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t: |
1570 unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api']) | 1594 if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api']) |
1571 | 1595 |
1572 | 1596 |
1573 def gate(args, gate_body=_basic_gate_body): | 1597 def gate(args, gate_body=_basic_gate_body): |
1574 """run the tests used to validate a push | 1598 """run the tests used to validate a push |
1575 | 1599 |
1578 | 1602 |
1579 parser = ArgumentParser(prog='mx gate') | 1603 parser = ArgumentParser(prog='mx gate') |
1580 parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code') | 1604 parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code') |
1581 parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code') | 1605 parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code') |
1582 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM') | 1606 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM') |
1607 parser.add_argument('-t', '--task-filter', help='comma separated list of substrings to select subset of tasks to be run') | |
1583 parser.add_argument('--jacocout', help='specify the output directory for jacoco report') | 1608 parser.add_argument('--jacocout', help='specify the output directory for jacoco report') |
1584 | 1609 |
1585 args = parser.parse_args(args) | 1610 args = parser.parse_args(args) |
1586 | 1611 |
1587 global _jacoco | 1612 global _jacoco |
1613 if args.task_filter: | |
1614 Task.filters = args.task_filter.split(',') | |
1588 | 1615 |
1589 tasks = [] | 1616 tasks = [] |
1590 total = Task('Gate') | 1617 total = Task('Gate') |
1591 try: | 1618 try: |
1592 with Task('Pylint', tasks): | 1619 with Task('Pylint', tasks) as t: |
1593 mx.pylint([]) | 1620 if t: mx.pylint([]) |
1594 | 1621 |
1595 def _clean(name='Clean'): | 1622 def _clean(name='Clean'): |
1596 with Task(name, tasks): | 1623 with Task(name, tasks) as t: |
1597 cleanArgs = [] | 1624 if t: |
1598 if not args.cleanNative: | 1625 cleanArgs = [] |
1599 cleanArgs.append('--no-native') | 1626 if not args.cleanNative: |
1600 if not args.cleanJava: | 1627 cleanArgs.append('--no-native') |
1601 cleanArgs.append('--no-java') | 1628 if not args.cleanJava: |
1602 clean(cleanArgs) | 1629 cleanArgs.append('--no-java') |
1630 clean(cleanArgs) | |
1603 _clean() | 1631 _clean() |
1604 | 1632 |
1605 with Task('IDEConfigCheck', tasks): | 1633 with Task('IDEConfigCheck', tasks): |
1606 mx.ideclean([]) | 1634 if t: |
1607 mx.ideinit([]) | 1635 mx.ideclean([]) |
1636 mx.ideinit([]) | |
1608 | 1637 |
1609 eclipse_exe = mx.get_env('ECLIPSE_EXE') | 1638 eclipse_exe = mx.get_env('ECLIPSE_EXE') |
1610 if eclipse_exe is not None: | 1639 if eclipse_exe is not None: |
1611 with Task('CodeFormatCheck', tasks) as t: | 1640 with Task('CodeFormatCheck', tasks) as t: |
1612 if mx.eclipseformat(['-e', eclipse_exe]) != 0: | 1641 if t and mx.eclipseformat(['-e', eclipse_exe]) != 0: |
1613 t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush') | 1642 t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush') |
1614 | 1643 |
1615 with Task('Canonicalization Check', tasks) as t: | 1644 with Task('Canonicalization Check', tasks) as t: |
1616 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) | 1645 if t: |
1617 if mx.canonicalizeprojects([]) != 0: | 1646 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) |
1618 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') | 1647 if mx.canonicalizeprojects([]) != 0: |
1648 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') | |
1619 | 1649 |
1620 if mx.get_env('JDT'): | 1650 if mx.get_env('JDT'): |
1621 with Task('BuildJavaWithEcj', tasks): | 1651 with Task('BuildJavaWithEcj', tasks): |
1622 build(['-p', '--no-native', '--jdt-warning-as-error']) | 1652 if t: build(['-p', '--no-native', '--jdt-warning-as-error']) |
1623 _clean('CleanAfterEcjBuild') | 1653 _clean('CleanAfterEcjBuild') |
1624 | 1654 |
1625 with Task('BuildJavaWithJavac', tasks): | 1655 with Task('BuildJavaWithJavac', tasks): |
1626 build(['-p', '--no-native', '--force-javac']) | 1656 if t: build(['-p', '--no-native', '--force-javac']) |
1627 | 1657 |
1628 with Task('Checkstyle', tasks) as t: | 1658 with Task('Checkstyle', tasks) as t: |
1629 if mx.checkstyle([]) != 0: | 1659 if t and mx.checkstyle([]) != 0: |
1630 t.abort('Checkstyle warnings were found') | 1660 t.abort('Checkstyle warnings were found') |
1631 | 1661 |
1632 with Task('Checkheaders', tasks) as t: | 1662 with Task('Checkheaders', tasks) as t: |
1633 if checkheaders([]) != 0: | 1663 if t and checkheaders([]) != 0: |
1634 t.abort('Checkheaders warnings were found') | 1664 t.abort('Checkheaders warnings were found') |
1635 | 1665 |
1636 with Task('FindBugs', tasks) as t: | 1666 with Task('FindBugs', tasks) as t: |
1637 if findbugs([]) != 0: | 1667 if t and findbugs([]) != 0: |
1638 t.abort('FindBugs warnings were found') | 1668 t.abort('FindBugs warnings were found') |
1639 | 1669 |
1640 if exists('jacoco.exec'): | 1670 if exists('jacoco.exec'): |
1641 os.unlink('jacoco.exec') | 1671 os.unlink('jacoco.exec') |
1642 | 1672 |
1660 mx.log('Gate task times:') | 1690 mx.log('Gate task times:') |
1661 for t in tasks: | 1691 for t in tasks: |
1662 mx.log(' ' + str(t.duration) + '\t' + t.title) | 1692 mx.log(' ' + str(t.duration) + '\t' + t.title) |
1663 mx.log(' =======') | 1693 mx.log(' =======') |
1664 mx.log(' ' + str(total.duration)) | 1694 mx.log(' ' + str(total.duration)) |
1695 | |
1696 if args.task_filter: | |
1697 Task.filters = None | |
1665 | 1698 |
1666 def deoptalot(args): | 1699 def deoptalot(args): |
1667 """bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on | 1700 """bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on |
1668 | 1701 |
1669 If the first argument is a number, the process will be repeated | 1702 If the first argument is a number, the process will be repeated |