comparison 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
comparison
equal deleted inserted replaced
22428:ca5200277c37 22429:a1b0a76567c7
124 124
125 def targetDir(self): 125 def targetDir(self):
126 return join('jre', 'lib') 126 return join('jre', 'lib')
127 127
128 class JvmciJDKDeployedDist(JarJDKDeployedDist): 128 class JvmciJDKDeployedDist(JarJDKDeployedDist):
129 def __init__(self, name, partOfHotSpot=False): 129 def __init__(self, name, partOfHotSpot=False, compilers=False):
130 JarJDKDeployedDist.__init__(self, name, partOfHotSpot) 130 JarJDKDeployedDist.__init__(self, name, partOfHotSpot)
131 self._compilers = compilers
131 132
132 def targetDir(self): 133 def targetDir(self):
133 return join('jre', 'lib', 'jvmci') 134 return join('jre', 'lib', 'jvmci')
134 135
135 def deploy(self, jdkDir): 136 def deploy(self, jdkDir):
136 JarJDKDeployedDist.deploy(self, jdkDir) 137 JarJDKDeployedDist.deploy(self, jdkDir)
137 _updateJVMCIFiles(jdkDir) 138 _updateJVMCIFiles(jdkDir)
139 if self._compilers:
140 _updateJVMCIProperties(jdkDir, self._compilers)
138 141
139 def _exe(l): 142 def _exe(l):
140 return mx.exe_suffix(l) 143 return mx.exe_suffix(l)
141 144
142 def _lib(l): 145 def _lib(l):
616 def _updateJVMCIFiles(jdkDir, obsoleteCheck=False): 619 def _updateJVMCIFiles(jdkDir, obsoleteCheck=False):
617 jreJVMCIDir = join(jdkDir, 'jre', 'lib', 'jvmci') 620 jreJVMCIDir = join(jdkDir, 'jre', 'lib', 'jvmci')
618 jvmciJars = [join(jreJVMCIDir, e) for e in os.listdir(jreJVMCIDir) if e.endswith('.jar')] 621 jvmciJars = [join(jreJVMCIDir, e) for e in os.listdir(jreJVMCIDir) if e.endswith('.jar')]
619 jreJVMCIServicesDir = join(jreJVMCIDir, 'services') 622 jreJVMCIServicesDir = join(jreJVMCIDir, 'services')
620 _extractJVMCIFiles(_getJdkDeployedJars(jdkDir), jvmciJars, jreJVMCIServicesDir, obsoleteCheck) 623 _extractJVMCIFiles(_getJdkDeployedJars(jdkDir), jvmciJars, jreJVMCIServicesDir, obsoleteCheck)
624
625 def _updateJVMCIProperties(jdkDir, compilers):
626 jvmciProperties = join(jdkDir, 'jre', 'lib', 'jvmci', 'jvmci.properties')
627 if not exists(jvmciProperties):
628 with open(jvmciProperties, 'w') as fp:
629 for compiler in compilers:
630 print >> fp, "jvmci.compiler=" + compiler
631 else:
632 oldCompilers = []
633 with open(jvmciProperties) as fp:
634 for line in fp:
635 if line.startswith('jvmci.compiler='):
636 oldCompilers += [line.strip().split('=')[1]]
637 changed = False
638 newCompilers = []
639 for c in compilers:
640 if not c in oldCompilers:
641 changed = True
642 newCompilers += [c]
643 if changed:
644 with open(jvmciProperties, 'w') as fp:
645 # prepend new compilers, since the first property wins
646 for c in newCompilers:
647 print >> fp, "jvmci.compiler=" + c
648 for c in oldCompilers:
649 print >> fp, "jvmci.compiler=" + c
621 650
622 def _installDistInJdks(deployableDist): 651 def _installDistInJdks(deployableDist):
623 """ 652 """
624 Installs the jar(s) for a given Distribution into all existing JVMCI JDKs 653 Installs the jar(s) for a given Distribution into all existing JVMCI JDKs
625 """ 654 """