comparison mx.jvmci/mx_jvmci.py @ 22758:a130b51efb07

removed @Option mechanism from JVMCI (GRAAL-1371)
author Doug Simon <doug.simon@oracle.com>
date Mon, 21 Dec 2015 15:53:56 +0100
parents b2ffe9891356
children f2206f5bb62e
comparison
equal deleted inserted replaced
22757:f4c4cc22a31c 22758:a130b51efb07
187 jdkDeployedDists = [ 187 jdkDeployedDists = [
188 LibJDKDeployedDist('JVMCI_SERVICE', partOfHotSpot=True), 188 LibJDKDeployedDist('JVMCI_SERVICE', partOfHotSpot=True),
189 JvmciJDKDeployedDist('JVMCI_API', partOfHotSpot=True), 189 JvmciJDKDeployedDist('JVMCI_API', partOfHotSpot=True),
190 JvmciJDKDeployedDist('JVMCI_HOTSPOT', partOfHotSpot=True), 190 JvmciJDKDeployedDist('JVMCI_HOTSPOT', partOfHotSpot=True),
191 JvmciJDKDeployedDist('JVMCI_HOTSPOTVMCONFIG', partOfHotSpot=True), 191 JvmciJDKDeployedDist('JVMCI_HOTSPOTVMCONFIG', partOfHotSpot=True),
192 JvmciJDKDeployedDist('JVMCI_OPTIONS', partOfHotSpot=True),
193 HotSpotVMJDKDeployedDist('JVM_<vmbuild>_<vm>'), 192 HotSpotVMJDKDeployedDist('JVM_<vmbuild>_<vm>'),
194 ] 193 ]
195 194
196 JDK_UNIX_PERMISSIONS_DIR = 0755 195 JDK_UNIX_PERMISSIONS_DIR = 0755
197 JDK_UNIX_PERMISSIONS_FILE = 0644 196 JDK_UNIX_PERMISSIONS_FILE = 0644
591 break 590 break
592 if not found: 591 if not found:
593 _handle_missing_VM(build, vmToCheck) 592 _handle_missing_VM(build, vmToCheck)
594 593
595 return jdkDir 594 return jdkDir
596
597 def _updateInstalledJVMCIOptionsFile(jdkDir):
598 jvmciOptions = join(_suite.dir, 'jvmci.options')
599 jreLibDir = join(jdkDir, 'jre', 'lib')
600 if exists(jvmciOptions):
601 shutil.copy(jvmciOptions, join(jreLibDir, 'jvmci', 'options'))
602 else:
603 toDelete = join(jreLibDir, 'jvmci', 'options')
604 if exists(toDelete):
605 os.unlink(toDelete)
606 595
607 def copyToJdk(src, dst, permissions=JDK_UNIX_PERMISSIONS_FILE): 596 def copyToJdk(src, dst, permissions=JDK_UNIX_PERMISSIONS_FILE):
608 name = os.path.basename(src) 597 name = os.path.basename(src)
609 mx.ensure_dir_exists(dst) 598 mx.ensure_dir_exists(dst)
610 dstLib = join(dst, name) 599 dstLib = join(dst, name)
1115 f.write(line) 1104 f.write(line)
1116 1105
1117 mx_gate.add_jacoco_includes(['jdk.vm.ci.*']) 1106 mx_gate.add_jacoco_includes(['jdk.vm.ci.*'])
1118 1107
1119 def run_vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): 1108 def run_vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
1120 """ 1109 """run a Java program by executing the java executable in a JVMCI JDK"""
1121 Runs a Java program by executing the java executable in a JVMCI JDK.
1122 """
1123 jdkTag = mx.get_jdk_option().tag 1110 jdkTag = mx.get_jdk_option().tag
1124 if jdkTag and jdkTag != _JVMCI_JDK_TAG: 1111 if jdkTag and jdkTag != _JVMCI_JDK_TAG:
1125 mx.abort('The "--jdk" option must have the tag "' + _JVMCI_JDK_TAG + '" when running a command requiring a JVMCI VM') 1112 mx.abort('The "--jdk" option must have the tag "' + _JVMCI_JDK_TAG + '" when running a command requiring a JVMCI VM')
1126 jdk = get_jvmci_jdk(vmbuild=vmbuild) 1113 jdk = get_jvmci_jdk(vmbuild=vmbuild)
1127 return jdk.run_java(args, vm=vm, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) 1114 return jdk.run_java(args, vm=vm, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
1728 self.jvmciServices.setdefault(service, []).append(provider) 1715 self.jvmciServices.setdefault(service, []).append(provider)
1729 # Make provider available as a normal service as well to 1716 # Make provider available as a normal service as well to
1730 # allow for deployment on JDK9 without having to recompile. 1717 # allow for deployment on JDK9 without having to recompile.
1731 self.services.setdefault(service, []).append(provider) 1718 self.services.setdefault(service, []).append(provider)
1732 return True 1719 return True
1733 elif arcname.endswith('_OptionDescriptors.class'):
1734 # Need to create service files for the providers of the
1735 # jdk.vm.ci.options.Options service created by
1736 # jdk.vm.ci.options.processor.OptionProcessor.
1737 provider = arcname[:-len('.class'):].replace('/', '.')
1738 self.services.setdefault('jdk.vm.ci.options.OptionDescriptors', []).append(provider)
1739 return False 1720 return False
1740 1721
1741 def __addsrc__(self, arcname, contents): 1722 def __addsrc__(self, arcname, contents):
1742 return False 1723 return False
1743 1724
1781 args = mx.expand_project_in_args(args, insitu=False) 1762 args = mx.expand_project_in_args(args, insitu=False)
1782 jacocoArgs = mx_gate.get_jacoco_agent_args() 1763 jacocoArgs = mx_gate.get_jacoco_agent_args()
1783 if jacocoArgs: 1764 if jacocoArgs:
1784 args = jacocoArgs + args 1765 args = jacocoArgs + args
1785 1766
1786 # Support for -G: options
1787 def translateGOption(arg):
1788 if arg.startswith('-G:+'):
1789 if '=' in arg:
1790 mx.abort('Mixing + and = in -G: option specification: ' + arg)
1791 arg = '-Djvmci.option.' + arg[len('-G:+'):] + '=true'
1792 elif arg.startswith('-G:-'):
1793 if '=' in arg:
1794 mx.abort('Mixing - and = in -G: option specification: ' + arg)
1795 arg = '-Djvmci.option.' + arg[len('-G:+'):] + '=false'
1796 elif arg.startswith('-G:'):
1797 arg = '-Djvmci.option.' + arg[len('-G:'):]
1798 return arg
1799 args = map(translateGOption, args)
1800
1801 args = ['-Xbootclasspath/p:' + dep.classpath_repr() for dep in _jvmci_bootclasspath_prepends] + args 1767 args = ['-Xbootclasspath/p:' + dep.classpath_repr() for dep in _jvmci_bootclasspath_prepends] + args
1802 1768
1803 # Set the default JVMCI compiler 1769 # Set the default JVMCI compiler
1804 for jdkDist in reversed(jdkDeployedDists): 1770 for jdkDist in reversed(jdkDeployedDists):
1805 if isinstance(jdkDist, JvmciJDKDeployedDist): 1771 if isinstance(jdkDist, JvmciJDKDeployedDist):
1824 1790
1825 if cwd is None: 1791 if cwd is None:
1826 cwd = _vm_cwd 1792 cwd = _vm_cwd
1827 elif _vm_cwd is not None and _vm_cwd != cwd: 1793 elif _vm_cwd is not None and _vm_cwd != cwd:
1828 mx.abort("conflicting working directories: do not set --vmcwd for this command") 1794 mx.abort("conflicting working directories: do not set --vmcwd for this command")
1829
1830 _updateInstalledJVMCIOptionsFile(self.home)
1831 1795
1832 args = self.parseVmArgs(args, addDefaultArgs=addDefaultArgs) 1796 args = self.parseVmArgs(args, addDefaultArgs=addDefaultArgs)
1833 if _make_eclipse_launch: 1797 if _make_eclipse_launch:
1834 mx.make_eclipse_launch(_suite, args, _suite.name + '-' + build, name=None, deps=mx.dependencies()) 1798 mx.make_eclipse_launch(_suite, args, _suite.name + '-' + build, name=None, deps=mx.dependencies())
1835 1799