25 # ---------------------------------------------------------------------------------------------------- 26 27 import os, shutil, zipfile, re, time, sys, datetime, platform 28 from os.path import join, exists, dirname, isdir 29 from argparse import ArgumentParser, REMAINDER 30 import StringIO 31 import xml.dom.minidom 32 import subprocess 33 34 import mx 35 import mx_gate 36 import mx_unittest 37 38 from mx_gate import Task 39 from mx_unittest import unittest 40 41 _suite = mx.suite('jvmci') 42 43 JVMCI_VERSION = 9 44 45 """ 46 Top level directory of the JDK source workspace. 47 """ 48 _jdkSourceRoot = dirname(_suite.dir) 49 50 _JVMCI_JDK_TAG = 'jvmci' 51 52 _minVersion = mx.VersionSpec('1.9') 53 54 # max version (first _unsupported_ version) 55 _untilVersion = None 56 57 _jvmciModes = { 58 'hosted' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI'], 59 'jit' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:+UseJVMCICompiler'], 60 'disabled' : [] 61 } 62 63 # TODO: can optimized be built without overriding release build? 64 _jdkDebugLevels = ['release', 'fastdebug', 'slowdebug'] 65 66 # TODO: add client once/if it can be built on 64-bit platforms 67 _jdkJvmVariants = ['server', 'client'] 68 69 """ 128 129 def get_vm(): 130 """ 131 Gets the configured VM. 132 """ 133 return _vm 134 135 def relativeVmLibDirInJdk(): 136 mxos = mx.get_os() 137 if mxos == 'darwin': 138 return join('lib') 139 if mxos == 'windows' or mxos == 'cygwin': 140 return join('bin') 141 return join('lib', mx.get_arch()) 142 143 def isJVMCIEnabled(vm): 144 assert vm in _jdkJvmVariants 145 return True 146 147 def _makehelp(): 148 return subprocess.check_output([mx.gmake_cmd(), 'help'], cwd=_jdkSourceRoot) 149 150 def _runmake(args): 151 """run the JDK make process 152 153 To build hotspot and import it into the JDK: "mx make hotspot import-hotspot" 154 {0}""" 155 156 jdkBuildDir = _get_jdk_build_dir() 157 if not exists(jdkBuildDir): 158 # JDK9 must be bootstrapped with a JDK8 159 compliance = mx.JavaCompliance('8') 160 jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value) 161 cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--with-jvm-features=graal', 162 '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home, '--with-jvm-features=graal'] 163 mx.run(cmd, cwd=_jdkSourceRoot) 164 cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel] 165 if mx.get_opts().verbose: 166 cmd.append('LOG=debug') 167 cmd.extend(args) 168 if mx.get_opts().use_jdk_image and 'images' not in args: 169 cmd.append('images') 170 171 if not mx.get_opts().verbose: 172 mx.log('--------------- make execution ----------------------') 173 mx.log('Working directory: ' + _jdkSourceRoot) 174 mx.log('Command line: ' + ' '.join(cmd)) 175 mx.log('-----------------------------------------------------') 176 177 mx.run(cmd, cwd=_jdkSourceRoot) 178 179 def _runmultimake(args): 180 """run the JDK make process for one or more configurations""" 181 182 jvmVariantsDefault = ','.join(_jdkJvmVariants) 183 debugLevelsDefault = ','.join(_jdkDebugLevels) 184 185 parser = ArgumentParser(prog='mx multimake') 186 parser.add_argument('--jdk-jvm-variants', '--vms', help='a comma separated list of VMs to build (default: ' + jvmVariantsDefault + ')', metavar='<args>', default=jvmVariantsDefault) 187 parser.add_argument('--jdk-debug-levels', '--builds', help='a comma separated list of JDK debug levels (default: ' + debugLevelsDefault + ')', metavar='<args>', default=debugLevelsDefault) 188 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build') 189 select = parser.add_mutually_exclusive_group() 190 select.add_argument('-c', '--console', action='store_true', help='send build output to console instead of log files') 191 select.add_argument('-d', '--output-dir', help='directory for log files instead of current working directory', default=os.getcwd(), metavar='<dir>') 192 193 args = parser.parse_args(args) 194 jvmVariants = args.jdk_jvm_variants.split(',') 195 debugLevels = [_translateLegacyDebugLevel(dl) for dl in args.jdk_debug_levels.split(',')] 196 197 allStart = time.time() | 25 # ---------------------------------------------------------------------------------------------------- 26 27 import os, shutil, zipfile, re, time, sys, datetime, platform 28 from os.path import join, exists, dirname, isdir 29 from argparse import ArgumentParser, REMAINDER 30 import StringIO 31 import xml.dom.minidom 32 import subprocess 33 34 import mx 35 import mx_gate 36 import mx_unittest 37 38 from mx_gate import Task 39 from mx_unittest import unittest 40 41 _suite = mx.suite('jvmci') 42 43 JVMCI_VERSION = 9 44 45 _JVMCI_JDK_TAG = 'jvmci' 46 47 _minVersion = mx.VersionSpec('1.9') 48 49 # max version (first _unsupported_ version) 50 _untilVersion = None 51 52 _jvmciModes = { 53 'hosted' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI'], 54 'jit' : ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '-XX:+UseJVMCICompiler'], 55 'disabled' : [] 56 } 57 58 # TODO: can optimized be built without overriding release build? 59 _jdkDebugLevels = ['release', 'fastdebug', 'slowdebug'] 60 61 # TODO: add client once/if it can be built on 64-bit platforms 62 _jdkJvmVariants = ['server', 'client'] 63 64 """ 123 124 def get_vm(): 125 """ 126 Gets the configured VM. 127 """ 128 return _vm 129 130 def relativeVmLibDirInJdk(): 131 mxos = mx.get_os() 132 if mxos == 'darwin': 133 return join('lib') 134 if mxos == 'windows' or mxos == 'cygwin': 135 return join('bin') 136 return join('lib', mx.get_arch()) 137 138 def isJVMCIEnabled(vm): 139 assert vm in _jdkJvmVariants 140 return True 141 142 def _makehelp(): 143 return subprocess.check_output([mx.gmake_cmd(), 'help'], cwd=_get_jdk_dir()) 144 145 def _runmake(args): 146 """run the JDK make process 147 148 To build hotspot and import it into the JDK: "mx make hotspot import-hotspot" 149 {0}""" 150 151 jdkBuildDir = _get_jdk_build_dir() 152 if not exists(jdkBuildDir): 153 # JDK10 must be bootstrapped with a JDK9 154 compliance = mx.JavaCompliance('9') 155 jdk9 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value) 156 cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--with-jvm-features=graal', 157 '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk9.home, '--with-jvm-features=graal'] 158 mx.run(cmd, cwd=_get_jdk_dir()) 159 cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel] 160 if mx.get_opts().verbose: 161 cmd.append('LOG=debug') 162 cmd.extend(args) 163 if mx.get_opts().use_jdk_image and 'images' not in args: 164 cmd.append('images') 165 166 if not mx.get_opts().verbose: 167 mx.log('--------------- make execution ----------------------') 168 mx.log('Working directory: ' + _get_jdk_dir()) 169 mx.log('Command line: ' + ' '.join(cmd)) 170 mx.log('-----------------------------------------------------') 171 172 mx.run(cmd, cwd=_get_jdk_dir()) 173 174 def _runmultimake(args): 175 """run the JDK make process for one or more configurations""" 176 177 jvmVariantsDefault = ','.join(_jdkJvmVariants) 178 debugLevelsDefault = ','.join(_jdkDebugLevels) 179 180 parser = ArgumentParser(prog='mx multimake') 181 parser.add_argument('--jdk-jvm-variants', '--vms', help='a comma separated list of VMs to build (default: ' + jvmVariantsDefault + ')', metavar='<args>', default=jvmVariantsDefault) 182 parser.add_argument('--jdk-debug-levels', '--builds', help='a comma separated list of JDK debug levels (default: ' + debugLevelsDefault + ')', metavar='<args>', default=debugLevelsDefault) 183 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build') 184 select = parser.add_mutually_exclusive_group() 185 select.add_argument('-c', '--console', action='store_true', help='send build output to console instead of log files') 186 select.add_argument('-d', '--output-dir', help='directory for log files instead of current working directory', default=os.getcwd(), metavar='<dir>') 187 188 args = parser.parse_args(args) 189 jvmVariants = args.jdk_jvm_variants.split(',') 190 debugLevels = [_translateLegacyDebugLevel(dl) for dl in args.jdk_debug_levels.split(',')] 191 192 allStart = time.time() |