Mercurial > hg > graal-jvmci-8
diff mx.jvmci/mx_jvmci.py @ 22429:a1b0a76567c7
Select default compiler from jvmci.compiler system property.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 17 Aug 2015 18:32:44 +0200 |
parents | 9c55f608b79e |
children | 5bf761306682 |
line wrap: on
line diff
--- a/mx.jvmci/mx_jvmci.py Tue Aug 11 15:17:53 2015 +0200 +++ b/mx.jvmci/mx_jvmci.py Mon Aug 17 18:32:44 2015 +0200 @@ -126,8 +126,9 @@ return join('jre', 'lib') class JvmciJDKDeployedDist(JarJDKDeployedDist): - def __init__(self, name, partOfHotSpot=False): + def __init__(self, name, partOfHotSpot=False, compilers=False): JarJDKDeployedDist.__init__(self, name, partOfHotSpot) + self._compilers = compilers def targetDir(self): return join('jre', 'lib', 'jvmci') @@ -135,6 +136,8 @@ def deploy(self, jdkDir): JarJDKDeployedDist.deploy(self, jdkDir) _updateJVMCIFiles(jdkDir) + if self._compilers: + _updateJVMCIProperties(jdkDir, self._compilers) def _exe(l): return mx.exe_suffix(l) @@ -619,6 +622,32 @@ jreJVMCIServicesDir = join(jreJVMCIDir, 'services') _extractJVMCIFiles(_getJdkDeployedJars(jdkDir), jvmciJars, jreJVMCIServicesDir, obsoleteCheck) +def _updateJVMCIProperties(jdkDir, compilers): + jvmciProperties = join(jdkDir, 'jre', 'lib', 'jvmci', 'jvmci.properties') + if not exists(jvmciProperties): + with open(jvmciProperties, 'w') as fp: + for compiler in compilers: + print >> fp, "jvmci.compiler=" + compiler + else: + oldCompilers = [] + with open(jvmciProperties) as fp: + for line in fp: + if line.startswith('jvmci.compiler='): + oldCompilers += [line.strip().split('=')[1]] + changed = False + newCompilers = [] + for c in compilers: + if not c in oldCompilers: + changed = True + newCompilers += [c] + if changed: + with open(jvmciProperties, 'w') as fp: + # prepend new compilers, since the first property wins + for c in newCompilers: + print >> fp, "jvmci.compiler=" + c + for c in oldCompilers: + print >> fp, "jvmci.compiler=" + c + def _installDistInJdks(deployableDist): """ Installs the jar(s) for a given Distribution into all existing JVMCI JDKs