.mx.jvmci/mx_jvmci.py

Print this page




 136         return join('lib')
 137     if mxos == 'windows' or mxos == 'cygwin':
 138         return join('bin')
 139     return join('lib', mx.get_arch())
 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():


 651 
 652 def jol(args):
 653     """Java Object Layout"""
 654     joljar = mx.library('JOL_INTERNALS').get_path(resolve=True)
 655     candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s))
 656 
 657     if len(candidates) > 0:
 658         candidates = mx.select_items(sorted(candidates))
 659     else:
 660         # mx.findclass can be mistaken, don't give up yet
 661         candidates = args
 662 
 663     run_vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates)
 664 
 665 class JVMCIArchiveParticipant:
 666     def __init__(self, dist):
 667         self.dist = dist
 668 
 669     def __opened__(self, arc, srcArc, services):
 670         self.services = services

 671         self.arc = arc
 672 
 673     def __add__(self, arcname, contents):
 674         if arcname.startswith('META-INF/jvmci.providers/'):
 675             provider = arcname[len('META-INF/jvmci.providers/'):]
 676             for service in contents.strip().split(os.linesep):
 677                 assert service
 678                 self.services.setdefault(service, []).append(provider)
 679             return True
 680         return False
 681 
 682     def __addsrc__(self, arcname, contents):
 683         return False
 684 
 685     def __closing__(self):
 686         pass
 687 
 688 def _get_openjdk_os():
 689     # See: common/autoconf/platform.m4
 690     os = mx.get_os()
 691     if 'darwin' in os:
 692         os = 'macosx'
 693     elif 'linux' in os:
 694         os = 'linux'
 695     elif 'solaris' in os:
 696         os = 'solaris'
 697     elif 'cygwin' in os or 'mingw' in os:
 698         os = 'windows'
 699     return os


 847     jvmciMode = None
 848 
 849     if opts.jdk_jvm_variant is not None:
 850         jvmVariant = opts.jdk_jvm_variant
 851         if jdkTag and jdkTag != _JVMCI_JDK_TAG:
 852             mx.warn('Ignoring "--jdk-jvm-variant" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"')
 853 
 854     if opts.jdk_debug_level is not None:
 855         debugLevel = _translateLegacyDebugLevel(opts.jdk_debug_level)
 856         if jdkTag and jdkTag != _JVMCI_JDK_TAG:
 857             mx.warn('Ignoring "--jdk-debug-level" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"')
 858 
 859     if opts.jvmci_mode is not None:
 860         jvmciMode = opts.jvmci_mode
 861         if jdkTag and jdkTag != _JVMCI_JDK_TAG:
 862             mx.warn('Ignoring "--jvmci-mode" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"')
 863 
 864     _vm.update(jvmVariant, debugLevel, jvmciMode)
 865 
 866     for jdkDist in jdkDeployedDists:
 867         dist = jdkDist.dist()
 868         if isinstance(jdkDist, JvmciJDKDeployedDist):
 869             dist.set_archiveparticipant(JVMCIArchiveParticipant(dist))


 136         return join('lib')
 137     if mxos == 'windows' or mxos == 'cygwin':
 138         return join('bin')
 139     return join('lib', mx.get_arch())
 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     def post_parse_cmd_line(self):
 157         self.set_archiveparticipant()
 158 
 159     def set_archiveparticipant(self):
 160         dist = self.dist()
 161         dist.set_archiveparticipant(JVMCIArchiveParticipant(dist))
 162 
 163 class ExtJDKDeployedDist(JvmciJDKDeployedDist):
 164     def __init__(self, name):
 165         JvmciJDKDeployedDist.__init__(self, name)
 166 
 167 
 168 """
 169 The monolithic JVMCI distribution is deployed through use of -Xbootclasspath/p
 170 so that it's not necessary to run JDK make after editing JVMCI sources.
 171 The latter causes all JDK Java sources to be rebuilt since JVMCI is
 172 (currently) in java.base.
 173 """
 174 _monolithicJvmci = JvmciJDKDeployedDist('JVMCI')
 175 
 176 """
 177 List of distributions that are deployed on the boot class path.
 178 Note: In jvmci-8, they were deployed directly into the JDK directory.
 179 """
 180 jdkDeployedDists = [_monolithicJvmci]
 181 
 182 def _makehelp():


 658 
 659 def jol(args):
 660     """Java Object Layout"""
 661     joljar = mx.library('JOL_INTERNALS').get_path(resolve=True)
 662     candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s))
 663 
 664     if len(candidates) > 0:
 665         candidates = mx.select_items(sorted(candidates))
 666     else:
 667         # mx.findclass can be mistaken, don't give up yet
 668         candidates = args
 669 
 670     run_vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates)
 671 
 672 class JVMCIArchiveParticipant:
 673     def __init__(self, dist):
 674         self.dist = dist
 675 
 676     def __opened__(self, arc, srcArc, services):
 677         self.services = services
 678         self.jvmciServices = services
 679         self.arc = arc
 680 
 681     def __add__(self, arcname, contents):






 682         return False
 683 
 684     def __addsrc__(self, arcname, contents):
 685         return False
 686 
 687     def __closing__(self):
 688         pass
 689 
 690 def _get_openjdk_os():
 691     # See: common/autoconf/platform.m4
 692     os = mx.get_os()
 693     if 'darwin' in os:
 694         os = 'macosx'
 695     elif 'linux' in os:
 696         os = 'linux'
 697     elif 'solaris' in os:
 698         os = 'solaris'
 699     elif 'cygwin' in os or 'mingw' in os:
 700         os = 'windows'
 701     return os


 849     jvmciMode = None
 850 
 851     if opts.jdk_jvm_variant is not None:
 852         jvmVariant = opts.jdk_jvm_variant
 853         if jdkTag and jdkTag != _JVMCI_JDK_TAG:
 854             mx.warn('Ignoring "--jdk-jvm-variant" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"')
 855 
 856     if opts.jdk_debug_level is not None:
 857         debugLevel = _translateLegacyDebugLevel(opts.jdk_debug_level)
 858         if jdkTag and jdkTag != _JVMCI_JDK_TAG:
 859             mx.warn('Ignoring "--jdk-debug-level" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"')
 860 
 861     if opts.jvmci_mode is not None:
 862         jvmciMode = opts.jvmci_mode
 863         if jdkTag and jdkTag != _JVMCI_JDK_TAG:
 864             mx.warn('Ignoring "--jvmci-mode" option as "--jdk" tag is not "' + _JVMCI_JDK_TAG + '"')
 865 
 866     _vm.update(jvmVariant, debugLevel, jvmciMode)
 867 
 868     for jdkDist in jdkDeployedDists:
 869         jdkDist.post_parse_cmd_line()