comparison mx/commands.py @ 6495:75f130f2b30f

moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
author Doug Simon <doug.simon@oracle.com>
date Wed, 03 Oct 2012 01:18:03 +0200
parents 74560fdffd51
children 305b9166b455
comparison
equal deleted inserted replaced
6494:df02fa2bce58 6495:75f130f2b30f
272 failed.append(test) 272 failed.append(test)
273 273
274 if len(failed) != 0: 274 if len(failed) != 0:
275 mx.abort('Scala DaCapo failures: ' + str(failed)) 275 mx.abort('Scala DaCapo failures: ' + str(failed))
276 276
277 def _arch():
278 machine = os.uname()[4]
279 if machine in ['amd64', 'x86_64']:
280 return 'amd64'
281 mx.abort('unsupported or unknown machine type: ' + machine)
282
277 def _vmLibDirInJdk(jdk): 283 def _vmLibDirInJdk(jdk):
278 """ 284 """
279 Get the directory within a JDK where the server and client 285 Get the directory within a JDK where the server and client
280 subdirectories are located. 286 subdirectories are located.
281 """ 287 """
282 if platform.system() == 'Darwin': 288 if platform.system() == 'Darwin':
283 return join(jdk, 'jre', 'lib') 289 return join(jdk, 'jre', 'lib')
284 if platform.system() == 'Windows': 290 if platform.system() == 'Windows':
285 return join(jdk, 'jre', 'bin') 291 return join(jdk, 'jre', 'bin')
286 return join(jdk, 'jre', 'lib', 'amd64') 292 return join(jdk, 'jre', 'lib', _arch())
287 293
288 def _vmCfgInJdk(jdk): 294 def _vmCfgInJdk(jdk):
289 """ 295 """
290 Get the jvm.cfg file. 296 Get the jvm.cfg file.
291 """ 297 """
292 if platform.system() == 'Windows': 298 if platform.system() == 'Windows':
293 return join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') 299 return join(jdk, 'jre', 'lib', _arch(), 'jvm.cfg')
294 return join(_vmLibDirInJdk(jdk), 'jvm.cfg') 300 return join(_vmLibDirInJdk(jdk), 'jvm.cfg')
295 301
296 def _jdk(build='product', create=False): 302 def _jdk(build='product', create=False):
297 """ 303 """
298 Get the JDK into which Graal is installed, creating it first if necessary. 304 Get the JDK into which Graal is installed, creating it first if necessary.
462 decl = 'const char* graal_projects[] = {' 468 decl = 'const char* graal_projects[] = {'
463 start = source.find(decl) 469 start = source.find(decl)
464 assert start != -1, 'Could not find "' + decl + '" in ' + fp.name 470 assert start != -1, 'Could not find "' + decl + '" in ' + fp.name
465 end = source.find('};', start) 471 end = source.find('};', start)
466 assert end != -1, 'Could not find "' + decl + '" ... "};" in ' + fp.name 472 assert end != -1, 'Could not find "' + decl + '" ... "};" in ' + fp.name
467 actual = frozenset([a.strip().strip('"') for a in source[start + len(decl):end].split(',')]) 473 actual = frozenset(re.findall(r'"([^"]+)"', source[start + len(decl):end]))
468 expected = frozenset([p.name for p in mx.project('com.oracle.graal.hotspot').all_deps([], False)]) 474 expected = frozenset([p.name for p in mx.project('com.oracle.graal.hotspot.' + _arch()).all_deps([], False)])
469 missing = expected - actual 475 missing = expected - actual
470 extra = actual - expected 476 extra = actual - expected
471 if len(missing) != 0: 477 if len(missing) != 0:
472 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': add missing projects to declaration:\n ' + '\n '.join(missing)) 478 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': add missing project(s) to declaration:\n ' + '\n '.join(missing))
473 if len(extra) != 0: 479 if len(extra) != 0:
474 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove projects from declaration:\n ' + '\n '.join(extra)) 480 mx.abort(fp.name + ':' + str(source[:start].count('\n') + 1) + ': remove project(s) from declaration:\n ' + '\n '.join(extra))
475 481
476 # Check if a build really needs to be done 482 # Check if a build really needs to be done
477 timestampFile = join(vmDir, '.build-timestamp') 483 timestampFile = join(vmDir, '.build-timestamp')
478 if opts2.force or not exists(timestampFile): 484 if opts2.force or not exists(timestampFile):
479 mustBuild = True 485 mustBuild = True
954 This is needed to support HotSpot's assembly dumping features. 960 This is needed to support HotSpot's assembly dumping features.
955 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax.""" 961 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax."""
956 flavor = 'intel' 962 flavor = 'intel'
957 if 'att' in args: 963 if 'att' in args:
958 flavor = 'att' 964 flavor = 'att'
959 lib = mx.lib_suffix('hsdis-amd64') 965 lib = mx.lib_suffix('hsdis-' + _arch())
960 path = join(_graal_home, 'lib', lib) 966 path = join(_graal_home, 'lib', lib)
961 if not exists(path): 967 if not exists(path):
962 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) 968 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib])
963 if copyToDir is not None and exists(copyToDir): 969 if copyToDir is not None and exists(copyToDir):
964 shutil.copy(path, copyToDir) 970 shutil.copy(path, copyToDir)