comparison mx/mx_graal.py @ 16600:6e7311d571ff

modify the 'mx vm' command to check that the VM is up-to-date with respect to graalRuntime.inline.hpp
author Doug Simon <doug.simon@oracle.com>
date Mon, 28 Jul 2014 14:48:11 +0200
parents 89be7c4db12c
children c55478e640e1
comparison
equal deleted inserted replaced
16599:89be7c4db12c 16600:6e7311d571ff
482 else: 482 else:
483 toDelete = join(jreLibDir, 'graal.options') 483 toDelete = join(jreLibDir, 'graal.options')
484 if exists(toDelete): 484 if exists(toDelete):
485 os.unlink(toDelete) 485 os.unlink(toDelete)
486 486
487 def _graalRuntime_inline_hpp_path():
488 hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot')
489 if not exists(hsSrcGenDir):
490 os.makedirs(hsSrcGenDir)
491 return join(hsSrcGenDir, 'graalRuntime.inline.hpp')
492
487 def _update_graalRuntime_inline_hpp(graalJar): 493 def _update_graalRuntime_inline_hpp(graalJar):
488 p = mx.project('com.oracle.graal.hotspot.sourcegen') 494 p = mx.project('com.oracle.graal.hotspot.sourcegen')
489 mainClass = 'com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp' 495 mainClass = 'com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp'
490 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')): 496 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')):
491 hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot') 497 graalRuntime_inline_hpp = _graalRuntime_inline_hpp_path()
492 if not exists(hsSrcGenDir):
493 os.makedirs(hsSrcGenDir)
494
495 tmp = StringIO.StringIO() 498 tmp = StringIO.StringIO()
496 mx.run_java(['-cp', '{}{}{}'.format(graalJar, os.pathsep, p.output_dir()), mainClass], out=tmp.write) 499 mx.run_java(['-cp', '{}{}{}'.format(graalJar, os.pathsep, p.output_dir()), mainClass], out=tmp.write)
497 mx.update_file(join(hsSrcGenDir, 'graalRuntime.inline.hpp'), tmp.getvalue()) 500 mx.update_file(graalRuntime_inline_hpp, tmp.getvalue())
501
502 def _check_graalRuntime_inline_hpp_upToDate(jdk, vm, bld):
503 if isGraalEnabled(vm):
504 hpp = _graalRuntime_inline_hpp_path()
505 vmLib = mx.TimeStampFile(join(_vmLibDirInJdk(jdk), vm, mx.add_lib_prefix(mx.add_lib_suffix('jvm'))))
506 if vmLib.isOlderThan(hpp):
507 mx.log('The VM ' + vmLib.path + ' is older than ' + hpp)
508 mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build"')
498 509
499 def _installGraalJarInJdks(graalDist): 510 def _installGraalJarInJdks(graalDist):
500 graalJar = graalDist.path 511 graalJar = graalDist.path
501 if graalJar.endswith('graal.jar'): 512 if graalJar.endswith('graal.jar'):
502 _update_graalRuntime_inline_hpp(graalJar) 513 _update_graalRuntime_inline_hpp(graalJar)
883 mx.abort("conflicting working directories: do not set --vmcwd for this command") 894 mx.abort("conflicting working directories: do not set --vmcwd for this command")
884 895
885 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' 896 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
886 jdk = _jdk(build, vmToCheck=vm, installGraalJar=False) 897 jdk = _jdk(build, vmToCheck=vm, installGraalJar=False)
887 _updateInstalledGraalOptionsFile(jdk) 898 _updateInstalledGraalOptionsFile(jdk)
899 _check_graalRuntime_inline_hpp_upToDate(jdk, vm, build)
888 mx.expand_project_in_args(args) 900 mx.expand_project_in_args(args)
889 if _make_eclipse_launch: 901 if _make_eclipse_launch:
890 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) 902 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
891 if _jacoco == 'on' or _jacoco == 'append': 903 if _jacoco == 'on' or _jacoco == 'append':
892 jacocoagent = mx.library("JACOCOAGENT", True) 904 jacocoagent = mx.library("JACOCOAGENT", True)