# HG changeset patch # User Doug Simon # Date 1406551691 -7200 # Node ID 6e7311d571ffe588b90313c2f94405304b3b46df # Parent 89be7c4db12c4ba7fd84c9b5c09ef5859fc3e3f4 modify the 'mx vm' command to check that the VM is up-to-date with respect to graalRuntime.inline.hpp diff -r 89be7c4db12c -r 6e7311d571ff mx/mx_graal.py --- a/mx/mx_graal.py Mon Jul 28 13:55:33 2014 +0200 +++ b/mx/mx_graal.py Mon Jul 28 14:48:11 2014 +0200 @@ -484,17 +484,28 @@ if exists(toDelete): os.unlink(toDelete) +def _graalRuntime_inline_hpp_path(): + hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot') + if not exists(hsSrcGenDir): + os.makedirs(hsSrcGenDir) + return join(hsSrcGenDir, 'graalRuntime.inline.hpp') + def _update_graalRuntime_inline_hpp(graalJar): p = mx.project('com.oracle.graal.hotspot.sourcegen') mainClass = 'com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp' if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')): - hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot') - if not exists(hsSrcGenDir): - os.makedirs(hsSrcGenDir) - + graalRuntime_inline_hpp = _graalRuntime_inline_hpp_path() tmp = StringIO.StringIO() mx.run_java(['-cp', '{}{}{}'.format(graalJar, os.pathsep, p.output_dir()), mainClass], out=tmp.write) - mx.update_file(join(hsSrcGenDir, 'graalRuntime.inline.hpp'), tmp.getvalue()) + mx.update_file(graalRuntime_inline_hpp, tmp.getvalue()) + +def _check_graalRuntime_inline_hpp_upToDate(jdk, vm, bld): + if isGraalEnabled(vm): + hpp = _graalRuntime_inline_hpp_path() + vmLib = mx.TimeStampFile(join(_vmLibDirInJdk(jdk), vm, mx.add_lib_prefix(mx.add_lib_suffix('jvm')))) + if vmLib.isOlderThan(hpp): + mx.log('The VM ' + vmLib.path + ' is older than ' + hpp) + mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build"') def _installGraalJarInJdks(graalDist): graalJar = graalDist.path @@ -885,6 +896,7 @@ build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' jdk = _jdk(build, vmToCheck=vm, installGraalJar=False) _updateInstalledGraalOptionsFile(jdk) + _check_graalRuntime_inline_hpp_upToDate(jdk, vm, build) mx.expand_project_in_args(args) if _make_eclipse_launch: mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))