Mercurial > hg > graal-jvmci-8
comparison mx.jvmci/mx_jvmci.py @ 23311:54b4e75c6088
added get_jvmci_hotspot_version and get_jdk_hotspot_version to respectively query the HotSpot version JVMCI is based on and the version in the bootstrap JDK
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 22 Feb 2016 14:14:37 +0100 |
parents | b9114ca0c174 |
children | c1935b089c01 |
comparison
equal
deleted
inserted
replaced
23310:e5b5170606a2 | 23311:54b4e75c6088 |
---|---|
866 def _hotspotGetVariant(vm=None): | 866 def _hotspotGetVariant(vm=None): |
867 if not vm: | 867 if not vm: |
868 vm = get_vm() | 868 vm = get_vm() |
869 variant = {'client': 'compiler1', 'server': 'compiler2', 'client-nojvmci': 'compiler1', 'server-nojvmci': 'compiler2'}.get(vm, vm) | 869 variant = {'client': 'compiler1', 'server': 'compiler2', 'client-nojvmci': 'compiler1', 'server-nojvmci': 'compiler2'}.get(vm, vm) |
870 return variant | 870 return variant |
871 | |
872 """ | |
873 Represents a JDK HotSpot version derived from a build tag such as "jdk8u66-b16". | |
874 """ | |
875 class JDKHotSpotVersion: | |
876 def __init__(self, javaCompliance, update, build): | |
877 self.javaCompliance = javaCompliance | |
878 self.update = update | |
879 self.build = build | |
880 | |
881 @staticmethod | |
882 def parse_tag(tag): | |
883 m = re.match(r'jdk8u(\d+)-b(\d+)', tag) | |
884 assert m, 'unrecognized jdk8 build tag: ' + tag | |
885 return JDKHotSpotVersion(mx.JavaCompliance('8'), m.group(1), m.group(2)) | |
886 | |
887 def __str__(self): | |
888 return '{}_{}_{}'.format(self.javaCompliance.value, self.update, self.build) | |
889 | |
890 def __cmp__(self, other): | |
891 assert isinstance(other, JDKHotSpotVersion), 'cannot compare a JDKHotSpotVersion object with ' + type(other) | |
892 return cmp(str(self), str(other)) | |
893 | |
894 def get_jvmci_hotspot_version(): | |
895 """ | |
896 Gets the upstream HotSpot version JVMCI is based on. | |
897 """ | |
898 vc = mx.VC.get_vc(_suite.dir, abortOnError=False) | |
899 assert vc, 'expected jvmci-8 to be version controlled' | |
900 assert isinstance(vc, mx.HgConfig), 'expected jvmci-8 VC to be Mercurial, not ' + vc.proper_name | |
901 lines = vc.hg_command(_suite.dir, ['log', '-r', 'keyword("Added tag jdk8u")', '--template', '{desc}\\n'], quiet=True).strip().split('\n') | |
902 assert lines, 'no hg commits found that match "Added tag jdk8u..."' | |
903 versions = [line.split()[2] for line in lines] | |
904 return JDKHotSpotVersion.parse_tag(sorted(versions)[-1]) | |
905 | |
906 def get_jdk_hotspot_version(tag=mx.DEFAULT_JDK_TAG): | |
907 """ | |
908 Gets the HotSpot version in the JDK selected by `tag`. | |
909 """ | |
910 jdk = mx.get_jdk(tag=tag) | |
911 output = subprocess.check_output([jdk.java, '-version'], stderr=subprocess.STDOUT) | |
912 m = re.search(r'Java\(TM\) SE Runtime Environment \(build 1.8.0_(\d+)-b(\d+)\)', output) | |
913 return JDKHotSpotVersion(jdk.javaCompliance, m.group(1), m.group(2)) | |
871 | 914 |
872 class HotSpotBuildTask(mx.NativeBuildTask): | 915 class HotSpotBuildTask(mx.NativeBuildTask): |
873 def __init__(self, project, args, vmbuild, vm): | 916 def __init__(self, project, args, vmbuild, vm): |
874 mx.NativeBuildTask.__init__(self, args, project) | 917 mx.NativeBuildTask.__init__(self, args, project) |
875 self.vm = vm | 918 self.vm = vm |