diff mx/mx_graal.py @ 16605:c55478e640e1

generalized check that VM is up-to-date with all generated sources
author Doug Simon <doug.simon@oracle.com>
date Mon, 28 Jul 2014 16:51:45 +0200
parents 6e7311d571ff
children 8cdb9ef96c01
line wrap: on
line diff
--- a/mx/mx_graal.py	Mon Jul 28 15:53:07 2014 +0200
+++ b/mx/mx_graal.py	Mon Jul 28 16:51:45 2014 +0200
@@ -484,11 +484,15 @@
         if exists(toDelete):
             os.unlink(toDelete)
 
-def _graalRuntime_inline_hpp_path():
+def _makeHotspotGeneratedSourcesDir():
     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')
+    return hsSrcGenDir
+
+
+def _graalRuntime_inline_hpp_path():
+    return join(_makeHotspotGeneratedSourcesDir(), 'graalRuntime.inline.hpp')
 
 def _update_graalRuntime_inline_hpp(graalJar):
     p = mx.project('com.oracle.graal.hotspot.sourcegen')
@@ -499,13 +503,14 @@
         mx.run_java(['-cp', '{}{}{}'.format(graalJar, os.pathsep, p.output_dir()), mainClass], out=tmp.write)
         mx.update_file(graalRuntime_inline_hpp, tmp.getvalue())
 
-def _check_graalRuntime_inline_hpp_upToDate(jdk, vm, bld):
+def _checkVMIsNewerThanGeneratedSources(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"')
+        for name in ['graalRuntime.inline.hpp', 'HotSpotVMConfig.inline.hpp']:
+            genSrc = join(_makeHotspotGeneratedSourcesDir(), name)
+            if vmLib.isOlderThan(genSrc):
+                mx.log('The VM ' + vmLib.path + ' is older than ' + genSrc)
+                mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build"')
 
 def _installGraalJarInJdks(graalDist):
     graalJar = graalDist.path
@@ -896,7 +901,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)
+    _checkVMIsNewerThanGeneratedSources(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))