.mx.jvmci/mx_jvmci.py

Print this page




 140 
 141 def isJVMCIEnabled(vm):
 142     assert vm in _jdkJvmVariants
 143     return True
 144 
 145 class JvmciJDKDeployedDist(object):
 146     def __init__(self, name, compilers=False):
 147         self._name = name
 148         self._compilers = compilers
 149 
 150     def dist(self):
 151         return mx.distribution(self._name)
 152 
 153     def deploy(self, jdkDir):
 154         mx.nyi('deploy', self)
 155 
 156 class ExtJDKDeployedDist(JvmciJDKDeployedDist):
 157     def __init__(self, name):
 158         JvmciJDKDeployedDist.__init__(self, name)
 159 
 160 
 161 """
 162 The monolithic JVMCI distribution is deployed through use of -Xbootclasspath/p
 163 so that it's not necessary to run JDK make after editing JVMCI sources.
 164 The latter causes all JDK Java sources to be rebuilt since JVMCI is
 165 (currently) in java.base.
 166 """
 167 _monolithicJvmci = JvmciJDKDeployedDist('JVMCI')
 168 
 169 """
 170 List of distributions that are deployed on the boot class path.
 171 Note: In jvmci-8, they were deployed directly into the JDK directory.
 172 """
 173 jdkDeployedDists = [_monolithicJvmci]
 174 
 175 def _makehelp():
 176     return subprocess.check_output([mx.gmake_cmd(), 'help'], cwd=_jdkSourceRoot)
 177 
 178 def _runmake(args):
 179     """run the JDK make process
 180 
 181 To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
 182 {0}"""
 183 
 184     jdkBuildDir = _get_jdk_build_dir()
 185     if not exists(jdkBuildDir):
 186         # JDK9 must be bootstrapped with a JDK8
 187         compliance = mx.JavaCompliance('8')
 188         jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
 189         cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--disable-debug-symbols', '--disable-precompiled-headers',
 190                '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home]
 191         mx.run(cmd, cwd=_jdkSourceRoot)
 192     cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
 193     if mx.get_opts().verbose:


 740 
 741 def add_bootclasspath_prepend(dep):
 742     assert isinstance(dep, mx.ClasspathDependency)
 743     _jvmci_bootclasspath_prepends.append(dep)
 744 
 745 class JVMCI9JDKConfig(mx.JDKConfig):
 746     def __init__(self, debugLevel):
 747         self.debugLevel = debugLevel
 748         jdkBuildDir = _get_jdk_build_dir(debugLevel)
 749         jdkDir = join(jdkBuildDir, 'images', 'jdk') if mx.get_opts().use_jdk_image else join(jdkBuildDir, 'jdk')
 750         mx.JDKConfig.__init__(self, jdkDir, tag=_JVMCI_JDK_TAG)
 751 
 752     def parseVmArgs(self, args, addDefaultArgs=True):
 753         args = mx.expand_project_in_args(args, insitu=False)
 754         jacocoArgs = mx_gate.get_jacoco_agent_args()
 755         if jacocoArgs:
 756             args = jacocoArgs + args
 757 
 758         args = ['-Xbootclasspath/p:' + dep.classpath_repr() for dep in _jvmci_bootclasspath_prepends] + args
 759 








 760         jvmciModeArgs = _jvmciModes[_vm.jvmciMode]
 761         if jvmciModeArgs:
 762             bcpDeps = [jdkDist.dist() for jdkDist in jdkDeployedDists]
 763             if bcpDeps:
 764                 args = ['-Xbootclasspath/p:' + os.pathsep.join([d.classpath_repr() for d in bcpDeps])] + args
 765 
 766         # Set the default JVMCI compiler
 767         for jdkDist in reversed(jdkDeployedDists):
 768             assert isinstance(jdkDist, JvmciJDKDeployedDist), jdkDist
 769             if jdkDist._compilers:
 770                 jvmciCompiler = jdkDist._compilers[-1]
 771                 args = ['-Djvmci.compiler=' + jvmciCompiler] + args
 772                 break
 773 
 774         if '-version' in args:
 775             ignoredArgs = args[args.index('-version') + 1:]
 776             if  len(ignoredArgs) > 0:
 777                 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs))
 778         return self.processArgs(args, addDefaultArgs=addDefaultArgs)
 779 




 140 
 141 def isJVMCIEnabled(vm):
 142     assert vm in _jdkJvmVariants
 143     return True
 144 
 145 class JvmciJDKDeployedDist(object):
 146     def __init__(self, name, compilers=False):
 147         self._name = name
 148         self._compilers = compilers
 149 
 150     def dist(self):
 151         return mx.distribution(self._name)
 152 
 153     def deploy(self, jdkDir):
 154         mx.nyi('deploy', self)
 155 
 156 class ExtJDKDeployedDist(JvmciJDKDeployedDist):
 157     def __init__(self, name):
 158         JvmciJDKDeployedDist.__init__(self, name)
 159 









 160 """
 161 List of distributions that are deployed on the boot class path.
 162 Note: In jvmci-8, they were deployed directly into the JDK directory.
 163 """
 164 jdkDeployedDists = []
 165 
 166 def _makehelp():
 167     return subprocess.check_output([mx.gmake_cmd(), 'help'], cwd=_jdkSourceRoot)
 168 
 169 def _runmake(args):
 170     """run the JDK make process
 171 
 172 To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
 173 {0}"""
 174 
 175     jdkBuildDir = _get_jdk_build_dir()
 176     if not exists(jdkBuildDir):
 177         # JDK9 must be bootstrapped with a JDK8
 178         compliance = mx.JavaCompliance('8')
 179         jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
 180         cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--disable-debug-symbols', '--disable-precompiled-headers',
 181                '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home]
 182         mx.run(cmd, cwd=_jdkSourceRoot)
 183     cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
 184     if mx.get_opts().verbose:


 731 
 732 def add_bootclasspath_prepend(dep):
 733     assert isinstance(dep, mx.ClasspathDependency)
 734     _jvmci_bootclasspath_prepends.append(dep)
 735 
 736 class JVMCI9JDKConfig(mx.JDKConfig):
 737     def __init__(self, debugLevel):
 738         self.debugLevel = debugLevel
 739         jdkBuildDir = _get_jdk_build_dir(debugLevel)
 740         jdkDir = join(jdkBuildDir, 'images', 'jdk') if mx.get_opts().use_jdk_image else join(jdkBuildDir, 'jdk')
 741         mx.JDKConfig.__init__(self, jdkDir, tag=_JVMCI_JDK_TAG)
 742 
 743     def parseVmArgs(self, args, addDefaultArgs=True):
 744         args = mx.expand_project_in_args(args, insitu=False)
 745         jacocoArgs = mx_gate.get_jacoco_agent_args()
 746         if jacocoArgs:
 747             args = jacocoArgs + args
 748 
 749         args = ['-Xbootclasspath/p:' + dep.classpath_repr() for dep in _jvmci_bootclasspath_prepends] + args
 750 
 751         # Remove JVMCI jars from class path. They are only necessary when
 752         # compiling with a javac from JDK8 or earlier.
 753         cpIndex, cp = mx.find_classpath_arg(args)
 754         if cp:
 755             excluded = frozenset([dist.path for dist in _suite.dists])
 756             cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded])
 757             args[cpIndex] = cp
 758 
 759         jvmciModeArgs = _jvmciModes[_vm.jvmciMode]
 760         if jvmciModeArgs:
 761             bcpDeps = [jdkDist.dist() for jdkDist in jdkDeployedDists]
 762             if bcpDeps:
 763                 args = ['-Xbootclasspath/p:' + os.pathsep.join([d.classpath_repr() for d in bcpDeps])] + args
 764 
 765         # Set the default JVMCI compiler
 766         for jdkDist in reversed(jdkDeployedDists):
 767             assert isinstance(jdkDist, JvmciJDKDeployedDist), jdkDist
 768             if jdkDist._compilers:
 769                 jvmciCompiler = jdkDist._compilers[-1]
 770                 args = ['-Djvmci.compiler=' + jvmciCompiler] + args
 771                 break
 772 
 773         if '-version' in args:
 774             ignoredArgs = args[args.index('-version') + 1:]
 775             if  len(ignoredArgs) > 0:
 776                 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs))
 777         return self.processArgs(args, addDefaultArgs=addDefaultArgs)
 778