Mercurial > hg > truffle
comparison mx/mx_graal.py @ 21559:be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 May 2015 15:36:48 +0200 |
parents | b1530a6cce8c |
children | a9fba0dfb155 |
comparison
equal
deleted
inserted
replaced
21558:d563baeca9df | 21559:be896a1983c0 |
---|---|
46 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) | 46 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) |
47 | 47 |
48 """ The VMs that can be built and run along with an optional description. Only VMs with a | 48 """ The VMs that can be built and run along with an optional description. Only VMs with a |
49 description are listed in the dialogue for setting the default VM (see _get_vm()). """ | 49 description are listed in the dialogue for setting the default VM (see _get_vm()). """ |
50 _vmChoices = { | 50 _vmChoices = { |
51 'graal' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.', | 51 'jvmci' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.', |
52 'server' : 'Normal compilation is performed with a tiered system (C1 + C2), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.', | 52 'server' : 'Normal compilation is performed with a tiered system (C1 + C2), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.', |
53 'client' : None, # normal compilation with client compiler, explicit compilation (e.g., by Truffle) with Graal | 53 'client' : None, # normal compilation with client compiler, explicit compilation (e.g., by Truffle) with Graal |
54 'server-nograal' : None, # all compilation with tiered system (i.e., client + server), Graal omitted | 54 'server-nojvmci' : None, # all compilation with tiered system (i.e., client + server), JVMCI omitted |
55 'client-nograal' : None, # all compilation with client compiler, Graal omitted | 55 'client-nojvmci' : None, # all compilation with client compiler, JVMCI omitted |
56 'original' : None, # default VM copied from bootstrap JDK | 56 'original' : None, # default VM copied from bootstrap JDK |
57 } | 57 } |
58 | 58 |
59 """ The VM that will be run by the 'vm' command and built by default by the 'build' command. | 59 """ The VM that will be run by the 'vm' command and built by default by the 'build' command. |
60 This can be set via the global '--vm' option or the DEFAULT_VM environment variable. | 60 This can be set via the global '--vm' option or the DEFAULT_VM environment variable. |
86 | 86 |
87 # max version (first _unsupported_ version) | 87 # max version (first _unsupported_ version) |
88 _untilVersion = None | 88 _untilVersion = None |
89 | 89 |
90 class JDKDeployedDist: | 90 class JDKDeployedDist: |
91 def __init__(self, name, isExtension=False, isGraalClassLoader=False): | 91 def __init__(self, name, isExtension=False, usesJVMCIClassLoader=False): |
92 self.name = name | 92 self.name = name |
93 self.isExtension = isExtension | 93 self.isExtension = isExtension |
94 self.isGraalClassLoader = isGraalClassLoader | 94 self.usesJVMCIClassLoader = usesJVMCIClassLoader |
95 | 95 |
96 _jdkDeployedDists = [ | 96 _jdkDeployedDists = [ |
97 JDKDeployedDist('TRUFFLE'), | 97 JDKDeployedDist('TRUFFLE'), |
98 JDKDeployedDist('GRAAL_LOADER'), | 98 JDKDeployedDist('JVMCI_LOADER'), |
99 JDKDeployedDist('GRAAL', isGraalClassLoader=True), | 99 JDKDeployedDist('GRAAL', usesJVMCIClassLoader=True), |
100 JDKDeployedDist('GRAAL_TRUFFLE', isGraalClassLoader=True) | 100 JDKDeployedDist('GRAAL_TRUFFLE', usesJVMCIClassLoader=True) |
101 ] | 101 ] |
102 | 102 |
103 JDK_UNIX_PERMISSIONS_DIR = 0755 | 103 JDK_UNIX_PERMISSIONS_DIR = 0755 |
104 JDK_UNIX_PERMISSIONS_FILE = 0644 | 104 JDK_UNIX_PERMISSIONS_FILE = 0644 |
105 JDK_UNIX_PERMISSIONS_EXEC = 0755 | 105 JDK_UNIX_PERMISSIONS_EXEC = 0755 |
166 os.chmod(dirname, chmodFlagsDir) | 166 os.chmod(dirname, chmodFlagsDir) |
167 | 167 |
168 os.path.walk(dirname, _chmodDir, chmodFlagsDir) | 168 os.path.walk(dirname, _chmodDir, chmodFlagsDir) |
169 | 169 |
170 def clean(args): | 170 def clean(args): |
171 """clean the GraalVM source tree""" | 171 """clean the source tree""" |
172 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) | 172 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) |
173 | 173 |
174 if opts.native: | 174 if opts.native: |
175 def handleRemoveReadonly(func, path, exc): | 175 def handleRemoveReadonly(func, path, exc): |
176 excvalue = exc[1] | 176 excvalue = exc[1] |
185 shutil.rmtree(name, ignore_errors=False, onerror=handleRemoveReadonly) | 185 shutil.rmtree(name, ignore_errors=False, onerror=handleRemoveReadonly) |
186 elif os.path.isfile(name): | 186 elif os.path.isfile(name): |
187 os.unlink(name) | 187 os.unlink(name) |
188 | 188 |
189 rmIfExists(join(_graal_home, 'build')) | 189 rmIfExists(join(_graal_home, 'build')) |
190 rmIfExists(join(_graal_home, 'build-nograal')) | 190 rmIfExists(join(_graal_home, 'build-nojvmci')) |
191 rmIfExists(_jdksDir()) | 191 rmIfExists(_jdksDir()) |
192 | 192 |
193 def export(args): | 193 def export(args): |
194 """create archives of builds split by vmbuild and vm""" | 194 """create archives of builds split by vmbuild and vm""" |
195 | 195 |
498 if not found: | 498 if not found: |
499 _handle_missing_VM(build, vmToCheck) | 499 _handle_missing_VM(build, vmToCheck) |
500 | 500 |
501 return jdk | 501 return jdk |
502 | 502 |
503 def _updateInstalledGraalOptionsFile(jdk): | 503 def _updateInstalledJVMCIOptionsFile(jdk): |
504 graalOptions = join(_graal_home, 'graal.options') | 504 jvmciOptions = join(_graal_home, 'jvmci.options') |
505 jreLibDir = join(jdk, 'jre', 'lib') | 505 jreLibDir = join(jdk, 'jre', 'lib') |
506 if exists(graalOptions): | 506 if exists(jvmciOptions): |
507 shutil.copy(graalOptions, join(jreLibDir, 'graal.options')) | 507 shutil.copy(jvmciOptions, join(jreLibDir, 'jvmci.options')) |
508 else: | 508 else: |
509 toDelete = join(jreLibDir, 'graal.options') | 509 toDelete = join(jreLibDir, 'jvmci.options') |
510 if exists(toDelete): | 510 if exists(toDelete): |
511 os.unlink(toDelete) | 511 os.unlink(toDelete) |
512 | 512 |
513 def _makeHotspotGeneratedSourcesDir(): | 513 def _makeHotspotGeneratedSourcesDir(): |
514 """ | 514 """ |
550 d.update(fp.read()) | 550 d.update(fp.read()) |
551 sha1 = d.hexdigest() | 551 sha1 = d.hexdigest() |
552 | 552 |
553 # Add SHA1 to end of graalRuntime.inline.hpp | 553 # Add SHA1 to end of graalRuntime.inline.hpp |
554 print >> tmp, '' | 554 print >> tmp, '' |
555 print >> tmp, 'const char* GraalRuntime::_generated_sources_sha1 = "' + sha1 + '";' | 555 print >> tmp, 'const char* JVMCIRuntime::_generated_sources_sha1 = "' + sha1 + '";' |
556 | 556 |
557 mx.update_file(graalRuntime_inline_hpp, tmp.getvalue()) | 557 mx.update_file(graalRuntime_inline_hpp, tmp.getvalue()) |
558 | 558 |
559 # Store SHA1 in generated Java class and append class to specified jar | 559 # Store SHA1 in generated Java class and append class to specified jar |
560 javaPackageName = 'com.oracle.jvmci.hotspot.sourcegen' | 560 javaPackageName = 'com.oracle.jvmci.hotspot.sourcegen' |
598 def _eraseGenerics(className): | 598 def _eraseGenerics(className): |
599 if '<' in className: | 599 if '<' in className: |
600 return className[:className.index('<')] | 600 return className[:className.index('<')] |
601 return className | 601 return className |
602 | 602 |
603 def _classifyGraalServices(classNames, graalJars): | 603 def _classifyJVMCIServices(classNames, jvmciJars): |
604 classification = {} | 604 classification = {} |
605 if not classNames: | 605 if not classNames: |
606 return classification | 606 return classification |
607 for className in classNames: | 607 for className in classNames: |
608 classification[className] = None | 608 classification[className] = None |
609 javap = mx.java().javap | 609 javap = mx.java().javap |
610 output = subprocess.check_output([javap, '-cp', os.pathsep.join(graalJars)] + classNames, stderr=subprocess.STDOUT) | 610 output = subprocess.check_output([javap, '-cp', os.pathsep.join(jvmciJars)] + classNames, stderr=subprocess.STDOUT) |
611 lines = output.split(os.linesep) | 611 lines = output.split(os.linesep) |
612 for line in lines: | 612 for line in lines: |
613 if line.startswith('public interface '): | 613 if line.startswith('public interface '): |
614 declLine = line[len('public interface '):].strip() | 614 declLine = line[len('public interface '):].strip() |
615 for className in classNames: | 615 for className in classNames: |
652 else: | 652 else: |
653 if not classification[className]: | 653 if not classification[className]: |
654 classification[className] = [] | 654 classification[className] = [] |
655 classification[className].extend(newClassification[superInterface]) | 655 classification[className].extend(newClassification[superInterface]) |
656 | 656 |
657 def _filterGraalService(classNames, graalJars): | 657 def _filterJVMCIService(classNames, jvmciJars): |
658 classification = _classifyGraalServices(classNames, graalJars) | 658 classification = _classifyJVMCIServices(classNames, jvmciJars) |
659 needClassification = _extractMaybes(classification) | 659 needClassification = _extractMaybes(classification) |
660 while needClassification: | 660 while needClassification: |
661 _mergeClassification(classification, _classifyGraalServices(needClassification, graalJars)) | 661 _mergeClassification(classification, _classifyJVMCIServices(needClassification, jvmciJars)) |
662 needClassification = _extractMaybes(classification) | 662 needClassification = _extractMaybes(classification) |
663 filtered = [] | 663 filtered = [] |
664 for className in classNames: | 664 for className in classNames: |
665 if classification[className] is True: | 665 if classification[className] is True: |
666 filtered.append(className) | 666 filtered.append(className) |
667 return filtered | 667 return filtered |
668 | 668 |
669 def _extractGraalServiceFiles(graalJars, destination, cleanDestination=True): | 669 def _extractJVMCIServiceFiles(jvmciJars, destination, cleanDestination=True): |
670 if cleanDestination: | 670 if cleanDestination: |
671 if exists(destination): | 671 if exists(destination): |
672 shutil.rmtree(destination) | 672 shutil.rmtree(destination) |
673 os.makedirs(destination) | 673 os.makedirs(destination) |
674 servicesMap = {} | 674 servicesMap = {} |
675 for jar in graalJars: | 675 for jar in jvmciJars: |
676 if os.path.isfile(jar): | 676 if os.path.isfile(jar): |
677 with zipfile.ZipFile(jar) as zf: | 677 with zipfile.ZipFile(jar) as zf: |
678 for member in zf.namelist(): | 678 for member in zf.namelist(): |
679 if not member.startswith('META-INF/services'): | 679 if not member.startswith('META-INF/services'): |
680 continue | 680 continue |
685 serviceImpls = servicesMap.setdefault(serviceName, []) | 685 serviceImpls = servicesMap.setdefault(serviceName, []) |
686 for line in serviceFile.readlines(): | 686 for line in serviceFile.readlines(): |
687 line = line.strip() | 687 line = line.strip() |
688 if line: | 688 if line: |
689 serviceImpls.append(line) | 689 serviceImpls.append(line) |
690 graalServices = _filterGraalService(servicesMap.keys(), graalJars) | 690 jvmciServices = _filterJVMCIService(servicesMap.keys(), jvmciJars) |
691 for serviceName in graalServices: | 691 for serviceName in jvmciServices: |
692 serviceImpls = servicesMap[serviceName] | 692 serviceImpls = servicesMap[serviceName] |
693 fd, tmp = tempfile.mkstemp(prefix=serviceName) | 693 fd, tmp = tempfile.mkstemp(prefix=serviceName) |
694 f = os.fdopen(fd, 'w+') | 694 f = os.fdopen(fd, 'w+') |
695 for serviceImpl in serviceImpls: | 695 for serviceImpl in serviceImpls: |
696 f.write(serviceImpl + os.linesep) | 696 f.write(serviceImpl + os.linesep) |
697 target = join(destination, serviceName) | 697 target = join(destination, serviceName) |
698 f.close() | 698 f.close() |
699 shutil.move(tmp, target) | 699 shutil.move(tmp, target) |
700 if mx.get_os() != 'windows': | 700 if mx.get_os() != 'windows': |
701 os.chmod(target, JDK_UNIX_PERMISSIONS_FILE) | 701 os.chmod(target, JDK_UNIX_PERMISSIONS_FILE) |
702 return graalServices | 702 return jvmciServices |
703 | 703 |
704 def _updateGraalServiceFiles(jdkDir): | 704 def _updateJVMCIServiceFiles(jdkDir): |
705 jreGraalDir = join(jdkDir, 'jre', 'lib', 'graal') | 705 jreJVMCIDir = join(jdkDir, 'jre', 'lib', 'jvmci') |
706 graalJars = [join(jreGraalDir, e) for e in os.listdir(jreGraalDir) if e.startswith('graal') and e.endswith('.jar')] | 706 jvmciJars = [join(jreJVMCIDir, e) for e in os.listdir(jreJVMCIDir) if (e.startswith('jvmci') or e.startswith('graal')) and e.endswith('.jar')] |
707 jreGraalServicesDir = join(jreGraalDir, 'services') | 707 jreJVMCIServicesDir = join(jreJVMCIDir, 'services') |
708 _extractGraalServiceFiles(graalJars, jreGraalServicesDir) | 708 _extractJVMCIServiceFiles(jvmciJars, jreJVMCIServicesDir) |
709 | 709 |
710 | 710 |
711 | 711 |
712 def _installDistInJdks(deployableDist): | 712 def _installDistInJdks(deployableDist): |
713 """ | 713 """ |
714 Installs the jar(s) for a given Distribution into all existing Graal JDKs | 714 Installs the jar(s) for a given Distribution into all existing JVMCI JDKs |
715 """ | 715 """ |
716 | 716 |
717 dist = mx.distribution(deployableDist.name) | 717 dist = mx.distribution(deployableDist.name) |
718 | 718 |
719 if dist.name == 'GRAAL_TRUFFLE': | 719 if dist.name == 'GRAAL': |
720 zf = zipfile.ZipFile(dist.path, 'a') | |
721 zf.writestr('com/oracle/graal/api/runtime/graal.version', graal_version()) | |
722 zf.close() | |
723 elif dist.name == 'GRAAL_TRUFFLE': | |
720 # The content in graalRuntime.inline.hpp is generated from Graal | 724 # The content in graalRuntime.inline.hpp is generated from Graal |
721 # classes that contain com.oracle.jvmci.options.Option annotated fields. | 725 # classes that contain com.oracle.jvmci.options.Option annotated fields. |
722 # Since GRAAL_TRUFFLE is the leaf most distribution containing | 726 # Since GRAAL_TRUFFLE is the leaf most distribution containing |
723 # such classes, the generation is triggered when GRAAL_TRUFFLE | 727 # such classes, the generation is triggered when GRAAL_TRUFFLE |
724 # is (re)built. | 728 # is (re)built. |
730 jdkDir = join(jdks, e) | 734 jdkDir = join(jdks, e) |
731 jreLibDir = join(jdkDir, 'jre', 'lib') | 735 jreLibDir = join(jdkDir, 'jre', 'lib') |
732 if exists(jreLibDir): | 736 if exists(jreLibDir): |
733 if deployableDist.isExtension: | 737 if deployableDist.isExtension: |
734 targetDir = join(jreLibDir, 'ext') | 738 targetDir = join(jreLibDir, 'ext') |
735 elif deployableDist.isGraalClassLoader: | 739 elif deployableDist.usesJVMCIClassLoader: |
736 targetDir = join(jreLibDir, 'graal') | 740 targetDir = join(jreLibDir, 'jvmci') |
737 else: | 741 else: |
738 targetDir = jreLibDir | 742 targetDir = jreLibDir |
739 if not exists(targetDir): | 743 if not exists(targetDir): |
740 os.makedirs(targetDir) | 744 os.makedirs(targetDir) |
741 _copyToJdk(dist.path, targetDir) | 745 _copyToJdk(dist.path, targetDir) |
742 if dist.sourcesPath: | 746 if dist.sourcesPath: |
743 _copyToJdk(dist.sourcesPath, jdkDir) | 747 _copyToJdk(dist.sourcesPath, jdkDir) |
744 if deployableDist.isGraalClassLoader: | 748 if deployableDist.usesJVMCIClassLoader: |
745 # deploy service files | 749 # deploy service files |
746 _updateGraalServiceFiles(jdkDir) | 750 _updateJVMCIServiceFiles(jdkDir) |
747 | 751 |
748 # run a command in the windows SDK Debug Shell | 752 # run a command in the windows SDK Debug Shell |
749 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): | 753 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): |
750 if respondTo is None: | 754 if respondTo is None: |
751 respondTo = {} | 755 respondTo = {} |
888 ' mx --vmbuild ' + firstBuildTarget + ' build') | 892 ' mx --vmbuild ' + firstBuildTarget + ' build') |
889 return result | 893 return result |
890 | 894 |
891 # Call mx.build to compile the Java sources | 895 # Call mx.build to compile the Java sources |
892 parser = AP() | 896 parser = AP() |
893 parser.add_argument('--export-dir', help='directory to which graal.jar and graal.options will be copied', metavar='<path>') | 897 parser.add_argument('--export-dir', help='directory to which JVMCI and Graal jars and jvmci.options will be copied', metavar='<path>') |
894 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') | 898 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') |
895 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) | 899 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) |
896 assert len(opts2.remainder) == 0 | 900 assert len(opts2.remainder) == 0 |
897 | 901 |
898 if opts2.export_dir is not None: | 902 if opts2.export_dir is not None: |
902 assert os.path.isdir(opts2.export_dir), '{0} is not a directory'.format(opts2.export_dir) | 906 assert os.path.isdir(opts2.export_dir), '{0} is not a directory'.format(opts2.export_dir) |
903 | 907 |
904 defsPath = join(_graal_home, 'make', 'defs.make') | 908 defsPath = join(_graal_home, 'make', 'defs.make') |
905 with open(defsPath) as fp: | 909 with open(defsPath) as fp: |
906 defs = fp.read() | 910 defs = fp.read() |
907 graalJars = [] | 911 jvmciJars = [] |
908 for jdkDist in _jdkDeployedDists: | 912 for jdkDist in _jdkDeployedDists: |
909 dist = mx.distribution(jdkDist.name) | 913 dist = mx.distribution(jdkDist.name) |
910 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path) | 914 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path) |
911 if jdkDist.isExtension: | 915 if jdkDist.isExtension: |
912 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_EXT_DIR)/' + basename(dist.path) | 916 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_EXT_DIR)/' + basename(dist.path) |
913 elif jdkDist.isGraalClassLoader: | 917 elif jdkDist.usesJVMCIClassLoader: |
914 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_DIR)/' + basename(dist.path) | 918 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_DIR)/' + basename(dist.path) |
915 graalJars.append(dist.path) | 919 jvmciJars.append(dist.path) |
916 else: | 920 else: |
917 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path) | 921 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path) |
918 if defLine not in defs: | 922 if defLine not in defs: |
919 mx.abort('Missing following line in ' + defsPath + '\n' + defLine) | 923 mx.abort('Missing following line in ' + defsPath + '\n' + defLine) |
920 shutil.copy(dist.path, opts2.export_dir) | 924 shutil.copy(dist.path, opts2.export_dir) |
921 services = _extractGraalServiceFiles(graalJars, join(opts2.export_dir, 'services')) | 925 services = _extractJVMCIServiceFiles(jvmciJars, join(opts2.export_dir, 'services')) |
922 for service in services: | 926 for service in services: |
923 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/' + service | 927 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/' + service |
924 if defLine not in defs: | 928 if defLine not in defs: |
925 mx.abort('Missing following line in ' + defsPath + ' for service from ' + dist.name + '\n' + defLine) | 929 mx.abort('Missing following line in ' + defsPath + ' for service from ' + dist.name + '\n' + defLine) |
926 graalOptions = join(_graal_home, 'graal.options') | 930 jvmciOptions = join(_graal_home, 'jvmci.options') |
927 if exists(graalOptions): | 931 if exists(jvmciOptions): |
928 shutil.copy(graalOptions, opts2.export_dir) | 932 shutil.copy(jvmciOptions, opts2.export_dir) |
929 | 933 |
930 if not _vmSourcesAvailable or not opts2.native: | 934 if not _vmSourcesAvailable or not opts2.native: |
931 return | 935 return |
932 | 936 |
933 builds = [_vmbuild] | 937 builds = [_vmbuild] |
949 elif vm.startswith('server'): | 953 elif vm.startswith('server'): |
950 buildSuffix = '' | 954 buildSuffix = '' |
951 elif vm.startswith('client'): | 955 elif vm.startswith('client'): |
952 buildSuffix = '1' | 956 buildSuffix = '1' |
953 else: | 957 else: |
954 assert vm == 'graal', vm | 958 assert vm == 'jvmci', vm |
955 buildSuffix = 'graal' | 959 buildSuffix = 'jvmci' |
956 | 960 |
957 if _installed_jdks and _installed_jdks != _graal_home: | 961 if _installed_jdks and _installed_jdks != _graal_home: |
958 if not mx.ask_yes_no("Warning: building while --installed-jdks is set (" + _installed_jdks + ") is not recommanded - are you sure you want to continue", 'n'): | 962 if not mx.ask_yes_no("Warning: building while --installed-jdks is set (" + _installed_jdks + ") is not recommanded - are you sure you want to continue", 'n'): |
959 mx.abort(1) | 963 mx.abort(1) |
960 | 964 |
1049 setMakeVar('ARCH_DATA_MODEL', '64', env=env) | 1053 setMakeVar('ARCH_DATA_MODEL', '64', env=env) |
1050 setMakeVar('HOTSPOT_BUILD_JOBS', str(cpus), env=env) | 1054 setMakeVar('HOTSPOT_BUILD_JOBS', str(cpus), env=env) |
1051 setMakeVar('ALT_BOOTDIR', mx.java().jdk, env=env) | 1055 setMakeVar('ALT_BOOTDIR', mx.java().jdk, env=env) |
1052 | 1056 |
1053 setMakeVar('MAKE_VERBOSE', 'y' if mx._opts.verbose else '') | 1057 setMakeVar('MAKE_VERBOSE', 'y' if mx._opts.verbose else '') |
1054 if vm.endswith('nograal'): | 1058 if vm.endswith('nojvmci'): |
1055 setMakeVar('INCLUDE_GRAAL', 'false') | 1059 setMakeVar('INCLUDE_JVMCI', 'false') |
1056 setMakeVar('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()), env=env) | 1060 setMakeVar('ALT_OUTPUTDIR', join(_graal_home, 'build-nojvmci', mx.get_os()), env=env) |
1057 else: | 1061 else: |
1058 version = graal_version() | 1062 version = graal_version() |
1059 setMakeVar('USER_RELEASE_SUFFIX', 'graal-' + version) | 1063 setMakeVar('USER_RELEASE_SUFFIX', 'jvmci-' + version) |
1060 setMakeVar('GRAAL_VERSION', version) | 1064 setMakeVar('INCLUDE_JVMCI', 'true') |
1061 setMakeVar('INCLUDE_GRAAL', 'true') | |
1062 setMakeVar('INSTALL', 'y', env=env) | 1065 setMakeVar('INSTALL', 'y', env=env) |
1063 if mx.get_os() == 'darwin' and platform.mac_ver()[0] != '': | 1066 if mx.get_os() == 'darwin' and platform.mac_ver()[0] != '': |
1064 # Force use of clang on MacOS | 1067 # Force use of clang on MacOS |
1065 setMakeVar('USE_CLANG', 'true') | 1068 setMakeVar('USE_CLANG', 'true') |
1066 if mx.get_os() == 'solaris': | 1069 if mx.get_os() == 'solaris': |
1148 elif _vm_cwd is not None and _vm_cwd != cwd: | 1151 elif _vm_cwd is not None and _vm_cwd != cwd: |
1149 mx.abort("conflicting working directories: do not set --vmcwd for this command") | 1152 mx.abort("conflicting working directories: do not set --vmcwd for this command") |
1150 | 1153 |
1151 build = vmbuild if vmbuild else _vmbuild if _vmSourcesAvailable else 'product' | 1154 build = vmbuild if vmbuild else _vmbuild if _vmSourcesAvailable else 'product' |
1152 jdk = _jdk(build, vmToCheck=vm, installJars=False) | 1155 jdk = _jdk(build, vmToCheck=vm, installJars=False) |
1153 _updateInstalledGraalOptionsFile(jdk) | 1156 _updateInstalledJVMCIOptionsFile(jdk) |
1154 mx.expand_project_in_args(args) | 1157 mx.expand_project_in_args(args) |
1155 if _make_eclipse_launch: | 1158 if _make_eclipse_launch: |
1156 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) | 1159 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) |
1157 if _jacoco == 'on' or _jacoco == 'append': | 1160 if _jacoco == 'on' or _jacoco == 'append': |
1158 jacocoagent = mx.library("JACOCOAGENT", True) | 1161 jacocoagent = mx.library("JACOCOAGENT", True) |
1336 if gc_after_test: | 1339 if gc_after_test: |
1337 coreArgs.append('-JUnitGCAfterTest') | 1340 coreArgs.append('-JUnitGCAfterTest') |
1338 | 1341 |
1339 | 1342 |
1340 def harness(projectsCp, vmArgs): | 1343 def harness(projectsCp, vmArgs): |
1341 if _get_vm() != 'graal': | 1344 if _get_vm() != 'jvmci': |
1342 prefixArgs = ['-esa', '-ea'] | 1345 prefixArgs = ['-esa', '-ea'] |
1343 else: | 1346 else: |
1344 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] | 1347 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] |
1345 if gc_after_test: | 1348 if gc_after_test: |
1346 prefixArgs.append('-XX:-DisableExplicitGC') | 1349 prefixArgs.append('-XX:-DisableExplicitGC') |
1349 | 1352 |
1350 # Remove entries from class path that are in graal.jar and | 1353 # Remove entries from class path that are in graal.jar and |
1351 # run the VM in a mode where application/test classes can | 1354 # run the VM in a mode where application/test classes can |
1352 # access core Graal classes. | 1355 # access core Graal classes. |
1353 cp = prefixCp + coreCp + os.pathsep + projectsCp | 1356 cp = prefixCp + coreCp + os.pathsep + projectsCp |
1354 if isGraalEnabled(_get_vm()): | 1357 if isJVMCIEnabled(_get_vm()): |
1355 excluded = set() | 1358 excluded = set() |
1356 for jdkDist in _jdkDeployedDists: | 1359 for jdkDist in _jdkDeployedDists: |
1357 dist = mx.distribution(jdkDist.name) | 1360 dist = mx.distribution(jdkDist.name) |
1358 excluded.update([d.output_dir() for d in dist.sorted_deps()]) | 1361 excluded.update([d.output_dir() for d in dist.sorted_deps()]) |
1359 cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded]) | 1362 cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded]) |
1360 vmArgs = ['-XX:-UseGraalClassLoader'] + vmArgs | 1363 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs |
1361 | 1364 |
1362 # suppress menubar and dock when running on Mac | 1365 # suppress menubar and dock when running on Mac |
1363 vmArgs = ['-Djava.awt.headless=true'] + vmArgs | 1366 vmArgs = ['-Djava.awt.headless=true'] + vmArgs |
1364 | 1367 |
1365 if len(testclasses) == 1: | 1368 if len(testclasses) == 1: |
1554 else: | 1557 else: |
1555 with VM(v, vmbuild): | 1558 with VM(v, vmbuild): |
1556 build(check_dists_args) | 1559 build(check_dists_args) |
1557 if not args.no_check: | 1560 if not args.no_check: |
1558 vmargs = ['-version'] | 1561 vmargs = ['-version'] |
1559 if v == 'graal': | 1562 if v == 'jvmci': |
1560 vmargs.insert(0, '-XX:-BootstrapGraal') | 1563 vmargs.insert(0, '-XX:-BootstrapJVMCI') |
1561 vm(vmargs, vm=v, vmbuild=vmbuild) | 1564 vm(vmargs, vm=v, vmbuild=vmbuild) |
1562 allDuration = datetime.timedelta(seconds=time.time() - allStart) | 1565 allDuration = datetime.timedelta(seconds=time.time() - allStart) |
1563 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') | 1566 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') |
1564 | 1567 |
1565 class Task: | 1568 class Task: |
1602 """run CompileTheWorld""" | 1605 """run CompileTheWorld""" |
1603 | 1606 |
1604 defaultCtwopts = '-Inline' | 1607 defaultCtwopts = '-Inline' |
1605 | 1608 |
1606 parser = ArgumentParser(prog='mx ctw') | 1609 parser = ArgumentParser(prog='mx ctw') |
1607 parser.add_argument('--ctwopts', action='store', help='space separated Graal options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>') | 1610 parser.add_argument('--ctwopts', action='store', help='space separated JVMCI options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>') |
1608 parser.add_argument('--jar', action='store', help='jar of classes to compiled instead of rt.jar', metavar='<path>') | 1611 parser.add_argument('--jar', action='store', help='jar of classes to compiled instead of rt.jar', metavar='<path>') |
1609 | 1612 |
1610 args, vmargs = parser.parse_known_args(args) | 1613 args, vmargs = parser.parse_known_args(args) |
1611 | 1614 |
1612 if args.ctwopts: | 1615 if args.ctwopts: |
1618 jar = join(_jdk(installJars=False), 'jre', 'lib', 'rt.jar') | 1621 jar = join(_jdk(installJars=False), 'jre', 'lib', 'rt.jar') |
1619 vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*') | 1622 vmargs.append('-G:CompileTheWorldExcludeMethodFilter=sun.awt.X11.*.*') |
1620 | 1623 |
1621 vmargs += ['-XX:+CompileTheWorld'] | 1624 vmargs += ['-XX:+CompileTheWorld'] |
1622 vm_ = _get_vm() | 1625 vm_ = _get_vm() |
1623 if isGraalEnabled(vm_): | 1626 if isJVMCIEnabled(vm_): |
1624 if vm_ == 'graal': | 1627 if vm_ == 'jvmci': |
1625 vmargs += ['-XX:+BootstrapGraal'] | 1628 vmargs += ['-XX:+BootstrapJVMCI'] |
1626 vmargs += ['-G:CompileTheWorldClasspath=' + jar] | 1629 vmargs += ['-G:CompileTheWorldClasspath=' + jar] |
1627 else: | 1630 else: |
1628 vmargs += ['-Xbootclasspath/p:' + jar] | 1631 vmargs += ['-Xbootclasspath/p:' + jar] |
1629 | 1632 |
1630 # suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris) | 1633 # suppress menubar and dock when running on Mac; exclude x11 classes as they may cause vm crashes (on Solaris) |
1631 vmargs = ['-Djava.awt.headless=true'] + vmargs | 1634 vmargs = ['-Djava.awt.headless=true'] + vmargs |
1632 | 1635 |
1633 vm(vmargs) | 1636 vm(vmargs) |
1634 | 1637 |
1635 def _basic_gate_body(args, tasks): | 1638 def _basic_gate_body(args, tasks): |
1636 # Build server-hosted-graal now so we can run the unit tests | 1639 # Build server-hosted-jvmci now so we can run the unit tests |
1637 with Task('BuildHotSpotGraalHosted: product', tasks) as t: | 1640 with Task('BuildHotSpotJVMCIHosted: product', tasks) as t: |
1638 if t: buildvms(['--vms', 'server', '--builds', 'product', '--check-distributions']) | 1641 if t: buildvms(['--vms', 'server', '--builds', 'product', '--check-distributions']) |
1639 | 1642 |
1640 # Run unit tests on server-hosted-graal | 1643 # Run unit tests on server-hosted-jvmci |
1641 with VM('server', 'product'): | 1644 with VM('server', 'product'): |
1642 with Task('UnitTests:hosted-product', tasks) as t: | 1645 with Task('UnitTests:hosted-product', tasks) as t: |
1643 if t: unittest(['--enable-timing', '--verbose', '--fail-fast']) | 1646 if t: unittest(['--enable-timing', '--verbose', '--fail-fast']) |
1644 | 1647 |
1645 # Run ctw against rt.jar on server-hosted-graal | 1648 # Run ctw against rt.jar on server-hosted-jvmci |
1646 with VM('server', 'product'): | 1649 with VM('server', 'product'): |
1647 with Task('CTW:hosted-product', tasks) as t: | 1650 with Task('CTW:hosted-product', tasks) as t: |
1648 if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-CompileTheWorldVerbose']) | 1651 if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-CompileTheWorldVerbose']) |
1649 | 1652 |
1650 # Build the other VM flavors | 1653 # Build the other VM flavors |
1651 with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks) as t: | 1654 with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks) as t: |
1652 if t: buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product', '--check-distributions']) | 1655 if t: buildvms(['--vms', 'jvmci,server', '--builds', 'fastdebug,product', '--check-distributions']) |
1653 | 1656 |
1654 with VM('graal', 'fastdebug'): | 1657 with VM('jvmci', 'fastdebug'): |
1655 with Task('BootstrapWithSystemAssertions:fastdebug', tasks) as t: | 1658 with Task('BootstrapWithSystemAssertions:fastdebug', tasks) as t: |
1656 if t: vm(['-esa', '-XX:-TieredCompilation', '-version']) | 1659 if t: vm(['-esa', '-XX:-TieredCompilation', '-version']) |
1657 | 1660 |
1658 with VM('graal', 'fastdebug'): | 1661 with VM('jvmci', 'fastdebug'): |
1659 with Task('BootstrapEconomyWithSystemAssertions:fastdebug', tasks) as t: | 1662 with Task('BootstrapEconomyWithSystemAssertions:fastdebug', tasks) as t: |
1660 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:CompilerConfiguration=economy', '-version']) | 1663 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:CompilerConfiguration=economy', '-version']) |
1661 | 1664 |
1662 with VM('graal', 'fastdebug'): | 1665 with VM('jvmci', 'fastdebug'): |
1663 with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks) as t: | 1666 with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks) as t: |
1664 if t: vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version']) | 1667 if t: vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version']) |
1665 | 1668 |
1666 with VM('graal', 'fastdebug'): | 1669 with VM('jvmci', 'fastdebug'): |
1667 with Task('BootstrapWithExceptionEdges:fastdebug', tasks) as t: | 1670 with Task('BootstrapWithExceptionEdges:fastdebug', tasks) as t: |
1668 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:+StressInvokeWithExceptionNode', '-version']) | 1671 if t: vm(['-esa', '-XX:-TieredCompilation', '-G:+StressInvokeWithExceptionNode', '-version']) |
1669 | 1672 |
1670 with VM('graal', 'product'): | 1673 with VM('jvmci', 'product'): |
1671 with Task('BootstrapWithGCVerification:product', tasks) as t: | 1674 with Task('BootstrapWithGCVerification:product', tasks) as t: |
1672 if t: | 1675 if t: |
1673 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write | 1676 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
1674 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | 1677 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) |
1675 | 1678 |
1676 with VM('graal', 'product'): | 1679 with VM('jvmci', 'product'): |
1677 with Task('BootstrapWithG1GCVerification:product', tasks) as t: | 1680 with Task('BootstrapWithG1GCVerification:product', tasks) as t: |
1678 if t: | 1681 if t: |
1679 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write | 1682 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
1680 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | 1683 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) |
1681 | 1684 |
1682 with VM('graal', 'product'): | 1685 with VM('jvmci', 'product'): |
1683 with Task('BootstrapWithRegisterPressure:product', tasks) as t: | 1686 with Task('BootstrapWithRegisterPressure:product', tasks) as t: |
1684 if t: | 1687 if t: |
1685 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14' | 1688 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14' |
1686 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=' + registers, '-esa', '-version']) | 1689 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=' + registers, '-esa', '-version']) |
1687 | 1690 |
1688 with VM('graal', 'product'): | 1691 with VM('jvmci', 'product'): |
1689 with Task('BootstrapSSAWithRegisterPressure:product', tasks) as t: | 1692 with Task('BootstrapSSAWithRegisterPressure:product', tasks) as t: |
1690 if t: | 1693 if t: |
1691 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14' | 1694 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14' |
1692 vm(['-XX:-TieredCompilation', '-G:+SSA_LIR', '-G:RegisterPressure=' + registers, '-esa', '-version']) | 1695 vm(['-XX:-TieredCompilation', '-G:+SSA_LIR', '-G:RegisterPressure=' + registers, '-esa', '-version']) |
1693 | 1696 |
1694 with VM('graal', 'product'): | 1697 with VM('jvmci', 'product'): |
1695 with Task('BootstrapWithImmutableCode:product', tasks) as t: | 1698 with Task('BootstrapWithImmutableCode:product', tasks) as t: |
1696 if t: vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version']) | 1699 if t: vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version']) |
1697 | 1700 |
1698 for vmbuild in ['fastdebug', 'product']: | 1701 for vmbuild in ['fastdebug', 'product']: |
1699 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): | 1702 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
1700 with Task(str(test) + ':' + vmbuild, tasks) as t: | 1703 with Task(str(test) + ':' + vmbuild, tasks) as t: |
1701 if t and not test.test('graal'): | 1704 if t and not test.test('jvmci'): |
1702 t.abort(test.name + ' Failed') | 1705 t.abort(test.name + ' Failed') |
1703 | 1706 |
1704 # ensure -Xbatch still works | 1707 # ensure -Xbatch still works |
1705 with VM('graal', 'product'): | 1708 with VM('jvmci', 'product'): |
1706 with Task('DaCapo_pmd:BatchMode:product', tasks) as t: | 1709 with Task('DaCapo_pmd:BatchMode:product', tasks) as t: |
1707 if t: dacapo(['-Xbatch', 'pmd']) | 1710 if t: dacapo(['-Xbatch', 'pmd']) |
1708 | 1711 |
1709 # ensure -Xcomp still works | 1712 # ensure -Xcomp still works |
1710 with VM('graal', 'product'): | 1713 with VM('jvmci', 'product'): |
1711 with Task('XCompMode:product', tasks) as t: | 1714 with Task('XCompMode:product', tasks) as t: |
1712 if t: vm(['-Xcomp', '-version']) | 1715 if t: vm(['-Xcomp', '-version']) |
1713 | 1716 |
1714 if args.jacocout is not None: | 1717 if args.jacocout is not None: |
1715 jacocoreport([args.jacocout]) | 1718 jacocoreport([args.jacocout]) |
1726 if args.buildNonGraal: | 1729 if args.buildNonGraal: |
1727 with Task('BuildHotSpotVarieties', tasks) as t: | 1730 with Task('BuildHotSpotVarieties', tasks) as t: |
1728 if t: | 1731 if t: |
1729 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) | 1732 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) |
1730 if mx.get_os() not in ['windows', 'cygwin']: | 1733 if mx.get_os() not in ['windows', 'cygwin']: |
1731 buildvms(['--vms', 'server-nograal', '--builds', 'product,optimized']) | 1734 buildvms(['--vms', 'server-nojvmci', '--builds', 'product,optimized']) |
1732 | 1735 |
1733 for vmbuild in ['product', 'fastdebug']: | 1736 for vmbuild in ['product', 'fastdebug']: |
1734 for theVm in ['client', 'server']: | 1737 for theVm in ['client', 'server']: |
1735 if not isVMSupported(theVm): | 1738 if not isVMSupported(theVm): |
1736 mx.log('The ' + theVm + ' VM is not supported on this platform') | 1739 mx.log('The ' + theVm + ' VM is not supported on this platform') |
1738 with VM(theVm, vmbuild): | 1741 with VM(theVm, vmbuild): |
1739 with Task('DaCapo_pmd:' + theVm + ':' + vmbuild, tasks) as t: | 1742 with Task('DaCapo_pmd:' + theVm + ':' + vmbuild, tasks) as t: |
1740 if t: dacapo(['pmd']) | 1743 if t: dacapo(['pmd']) |
1741 | 1744 |
1742 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t: | 1745 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t: |
1743 if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api']) | 1746 if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api', 'java.test']) |
1744 | 1747 |
1745 | 1748 |
1746 def gate(args, gate_body=_basic_gate_body): | 1749 def gate(args, gate_body=_basic_gate_body): |
1747 """run the tests used to validate a push | 1750 """run the tests used to validate a push |
1748 | 1751 |
1751 | 1754 |
1752 parser = ArgumentParser(prog='mx gate') | 1755 parser = ArgumentParser(prog='mx gate') |
1753 parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code') | 1756 parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code') |
1754 parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code') | 1757 parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code') |
1755 parser.add_argument('-i', '--omit-ide-clean', action='store_false', dest='cleanIde', help='omit cleaning the ide project files') | 1758 parser.add_argument('-i', '--omit-ide-clean', action='store_false', dest='cleanIde', help='omit cleaning the ide project files') |
1756 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM') | 1759 parser.add_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM') |
1757 parser.add_argument('-t', '--task-filter', help='comma separated list of substrings to select subset of tasks to be run') | 1760 parser.add_argument('-t', '--task-filter', help='comma separated list of substrings to select subset of tasks to be run') |
1758 parser.add_argument('--jacocout', help='specify the output directory for jacoco report') | 1761 parser.add_argument('--jacocout', help='specify the output directory for jacoco report') |
1759 | 1762 |
1760 args = parser.parse_args(args) | 1763 args = parser.parse_args(args) |
1761 | 1764 |
1851 | 1854 |
1852 if args.task_filter: | 1855 if args.task_filter: |
1853 Task.filters = None | 1856 Task.filters = None |
1854 | 1857 |
1855 def deoptalot(args): | 1858 def deoptalot(args): |
1856 """bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on | 1859 """bootstrap a fastdebug JVMCI VM with DeoptimizeALot and VerifyOops on |
1857 | 1860 |
1858 If the first argument is a number, the process will be repeated | 1861 If the first argument is a number, the process will be repeated |
1859 this number of times. All other arguments are passed to the VM.""" | 1862 this number of times. All other arguments are passed to the VM.""" |
1860 count = 1 | 1863 count = 1 |
1861 if len(args) > 0 and args[0].isdigit(): | 1864 if len(args) > 0 and args[0].isdigit(): |
2149 mx.log(x[:-1]) | 2152 mx.log(x[:-1]) |
2150 else: | 2153 else: |
2151 buildOutput.append(x) | 2154 buildOutput.append(x) |
2152 env = os.environ.copy() | 2155 env = os.environ.copy() |
2153 env['JAVA_HOME'] = _jdk(vmToCheck='server') | 2156 env['JAVA_HOME'] = _jdk(vmToCheck='server') |
2154 env['MAVEN_OPTS'] = '-server -XX:-UseGraalClassLoader' | 2157 env['MAVEN_OPTS'] = '-server -XX:-UseJVMCIClassLoader' |
2155 mx.log("Building benchmarks...") | 2158 mx.log("Building benchmarks...") |
2156 cmd = ['mvn'] | 2159 cmd = ['mvn'] |
2157 if args.settings: | 2160 if args.settings: |
2158 cmd = cmd + ['-s', args.settings] | 2161 cmd = cmd + ['-s', args.settings] |
2159 if args.clean: | 2162 if args.clean: |
2175 if '-h' in args: | 2178 if '-h' in args: |
2176 mx.help_(['jmh']) | 2179 mx.help_(['jmh']) |
2177 mx.abort(1) | 2180 mx.abort(1) |
2178 | 2181 |
2179 vmArgs, benchmarksAndJsons = _extract_VM_args(args) | 2182 vmArgs, benchmarksAndJsons = _extract_VM_args(args) |
2180 if isGraalEnabled(_get_vm()) and '-XX:-UseGraalClassLoader' not in vmArgs: | 2183 if isJVMCIEnabled(_get_vm()) and '-XX:-UseJVMCIClassLoader' not in vmArgs: |
2181 vmArgs = ['-XX:-UseGraalClassLoader'] + vmArgs | 2184 vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs |
2182 | 2185 |
2183 benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')] | 2186 benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')] |
2184 jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')] | 2187 jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')] |
2185 jmhOutDir = join(_graal_home, 'mx', 'jmh') | 2188 jmhOutDir = join(_graal_home, 'mx', 'jmh') |
2186 if not exists(jmhOutDir): | 2189 if not exists(jmhOutDir): |
2380 if len(args) == 1: | 2383 if len(args) == 1: |
2381 out = args[0] | 2384 out = args[0] |
2382 elif len(args) > 1: | 2385 elif len(args) > 1: |
2383 mx.abort('jacocoreport takes only one argument : an output directory') | 2386 mx.abort('jacocoreport takes only one argument : an output directory') |
2384 | 2387 |
2385 includes = ['com.oracle.graal'] | 2388 includes = ['com.oracle.graal', 'com.oracle.jvmci'] |
2386 for p in mx.projects(): | 2389 for p in mx.projects(): |
2387 projsetting = getattr(p, 'jacoco', '') | 2390 projsetting = getattr(p, 'jacoco', '') |
2388 if projsetting == 'include': | 2391 if projsetting == 'include': |
2389 includes.append(p.name) | 2392 includes.append(p.name) |
2390 | 2393 |
2407 def sl(args): | 2410 def sl(args): |
2408 """run an SL program""" | 2411 """run an SL program""" |
2409 vmArgs, slArgs = _extract_VM_args(args) | 2412 vmArgs, slArgs = _extract_VM_args(args) |
2410 vm(vmArgs + ['-cp', mx.classpath(["TRUFFLE", "com.oracle.truffle.sl"]), "com.oracle.truffle.sl.SLMain"] + slArgs) | 2413 vm(vmArgs + ['-cp', mx.classpath(["TRUFFLE", "com.oracle.truffle.sl"]), "com.oracle.truffle.sl.SLMain"] + slArgs) |
2411 | 2414 |
2412 def isGraalEnabled(vm): | 2415 def isJVMCIEnabled(vm): |
2413 return vm != 'original' and not vm.endswith('nograal') | 2416 return vm != 'original' and not vm.endswith('nojvmci') |
2414 | 2417 |
2415 def jol(args): | 2418 def jol(args): |
2416 """Java Object Layout""" | 2419 """Java Object Layout""" |
2417 joljar = mx.library('JOL_INTERNALS').get_path(resolve=True) | 2420 joljar = mx.library('JOL_INTERNALS').get_path(resolve=True) |
2418 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s)) | 2421 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s)) |
2477 # TODO: improve matcher: if mx args are given, this doesn't work | 2480 # TODO: improve matcher: if mx args are given, this doesn't work |
2478 complt += '\t\tcase $line[1] in\n' | 2481 complt += '\t\tcase $line[1] in\n' |
2479 complt += '\t\t\t(vm | vmg | vmfg | unittest | jmh | dacapo | scaladacapo | specjvm2008 | specjbb2013 | specjbb2005)\n' | 2482 complt += '\t\t\t(vm | vmg | vmfg | unittest | jmh | dacapo | scaladacapo | specjvm2008 | specjbb2013 | specjbb2005)\n' |
2480 complt += '\t\t\t\tnoglob \\\n' | 2483 complt += '\t\t\t\tnoglob \\\n' |
2481 complt += '\t\t\t\t\t_arguments -s -S \\\n' | 2484 complt += '\t\t\t\t\t_arguments -s -S \\\n' |
2482 complt += _appendOptions("graal", r"G\:") | 2485 complt += _appendOptions("jvmci", r"G\:") |
2483 # TODO: fix -XX:{-,+}Use* flags | 2486 # TODO: fix -XX:{-,+}Use* flags |
2484 complt += _appendOptions("hotspot", r"XX\:") | 2487 complt += _appendOptions("hotspot", r"XX\:") |
2485 complt += '\t\t\t\t\t"-version" && ret=0 \n' | 2488 complt += '\t\t\t\t\t"-version" && ret=0 \n' |
2486 complt += '\t\t\t\t;;\n' | 2489 complt += '\t\t\t\t;;\n' |
2487 complt += '\t\tesac\n' | 2490 complt += '\t\tesac\n' |
2539 'optName' : '<optName>', | 2542 'optName' : '<optName>', |
2540 'optDefault' : '<optDefault>', | 2543 'optDefault' : '<optDefault>', |
2541 'optDoc' : '<optDoc>', | 2544 'optDoc' : '<optDoc>', |
2542 })) | 2545 })) |
2543 | 2546 |
2544 # gather graal options | 2547 # gather JVMCI options |
2545 output = StringIO.StringIO() | 2548 output = StringIO.StringIO() |
2546 vm(['-XX:-BootstrapGraal', '-XX:+UnlockDiagnosticVMOptions', '-G:+PrintFlags' if optionType == "graal" else '-XX:+PrintFlagsWithComments'], | 2549 vm(['-XX:-BootstrapJVMCI', '-XX:+UnlockDiagnosticVMOptions', '-G:+PrintFlags' if optionType == "jvmci" else '-XX:+PrintFlagsWithComments'], |
2547 vm="graal", | 2550 vm="jvmci", |
2548 vmbuild="optimized", | 2551 vmbuild="optimized", |
2549 nonZeroIsFatal=False, | 2552 nonZeroIsFatal=False, |
2550 out=output.write, | 2553 out=output.write, |
2551 err=subprocess.STDOUT) | 2554 err=subprocess.STDOUT) |
2552 | 2555 |