changeset 15000:cc844a4512f1

added graal.version system property that is (only) defined by Graal enabled VMs
author Doug Simon <doug.simon@oracle.com>
date Mon, 07 Apr 2014 16:24:49 +0200
parents ab81149f6029
children 27c04ee36dcb
files make/bsd/makefiles/vm.make make/linux/makefiles/vm.make make/solaris/makefiles/vm.make make/windows/makefiles/vm.make mx/mx_graal.py src/share/vm/runtime/arguments.cpp
diffstat 6 files changed, 35 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/make/bsd/makefiles/vm.make	Mon Apr 07 11:46:20 2014 +0200
+++ b/make/bsd/makefiles/vm.make	Mon Apr 07 16:24:49 2014 +0200
@@ -111,6 +111,10 @@
 CXXFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
 endif
 
+ifeq ($(INCLUDE_GRAAL), true)
+  CXXFLAGS += -DGRAAL_VERSION="\"$(GRAAL_VERSION)\""
+endif
+
 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
 CFLAGS += $(CFLAGS_WARN/BYFILE)
 
--- a/make/linux/makefiles/vm.make	Mon Apr 07 11:46:20 2014 +0200
+++ b/make/linux/makefiles/vm.make	Mon Apr 07 16:24:49 2014 +0200
@@ -113,6 +113,10 @@
 CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64
 endif # ifneq ($(LP64), 1)
 
+ifeq ($(INCLUDE_GRAAL), true)
+  CXXFLAGS += -DGRAAL_VERSION="\"$(GRAAL_VERSION)\""
+endif
+
 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
 CFLAGS += $(CFLAGS_WARN/BYFILE)
 
--- a/make/solaris/makefiles/vm.make	Mon Apr 07 11:46:20 2014 +0200
+++ b/make/solaris/makefiles/vm.make	Mon Apr 07 16:24:49 2014 +0200
@@ -100,6 +100,10 @@
 CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64
 endif # ifneq ($(LP64), 1)
 
+ifeq ($(INCLUDE_GRAAL), true)
+  CXXFLAGS += -DGRAAL_VERSION="\"$(GRAAL_VERSION)\""
+endif
+
 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
 CFLAGS += $(CFLAGS_WARN)
 
--- a/make/windows/makefiles/vm.make	Mon Apr 07 11:46:20 2014 +0200
+++ b/make/windows/makefiles/vm.make	Mon Apr 07 16:24:49 2014 +0200
@@ -71,6 +71,10 @@
 # Define that so jni.h is on correct side
 CXX_FLAGS=$(CXX_FLAGS) /D "_JNI_IMPLEMENTATION_"
 
+!if "$(INCLUDE_GRAAL)" == "true"
+  CXX_FLAGS=$(CXX_FLAGS) /D "GRAAL_VERSION=\"$(GRAAL_VERSION)\""
+!endif
+
 !if "$(BUILDARCH)" == "ia64"
 STACK_SIZE="/STACK:1048576,262144"
 !else
--- a/mx/mx_graal.py	Mon Apr 07 11:46:20 2014 +0200
+++ b/mx/mx_graal.py	Mon Apr 07 16:24:49 2014 +0200
@@ -654,18 +654,6 @@
             env.setdefault('HOTSPOT_BUILD_JOBS', str(cpus))
             env.setdefault('ALT_BOOTDIR', mx.java().jdk)
 
-            # extract latest release tag for graal
-            try:
-                tags = [x.split(' ')[0] for x in subprocess.check_output(['hg', 'tags']).split('\n') if x.startswith("graal-")]
-            except:
-                # not a mercurial repository or hg commands are not available.
-                tags = None
-
-            if tags:
-                # extract the most recent tag
-                tag = sorted(tags, key=lambda e: [int(x) for x in e[len("graal-"):].split('.')], reverse=True)[0]
-                env.setdefault('USER_RELEASE_SUFFIX', tag)
-
             if not mx._opts.verbose:
                 runCmd.append('MAKE_VERBOSE=')
             env['JAVA_HOME'] = jdk
@@ -673,6 +661,22 @@
                 env['INCLUDE_GRAAL'] = 'false'
                 env.setdefault('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()))
             else:
+                # extract latest release tag for graal
+                try:
+                    tags = [x.split(' ')[0] for x in subprocess.check_output(['hg', '-R', _graal_home, 'tags']).split('\n') if x.startswith("graal-")]
+                except:
+                    # not a mercurial repository or hg commands are not available.
+                    tags = None
+
+                if tags:
+                    # extract the most recent tag
+                    tag = sorted(tags, key=lambda e: [int(x) for x in e[len("graal-"):].split('.')], reverse=True)[0]
+                    env.setdefault('USER_RELEASE_SUFFIX', tag)
+                    env.setdefault('GRAAL_VERSION', tag[len("graal-"):])
+                else:
+                    version = 'unknown-{}-{}'.format(platform.node(), time.strftime('%Y-%m-%d_%H-%M-%S_%Z'))
+                    env.setdefault('USER_RELEASE_SUFFIX', 'graal-' + version)
+                    env.setdefault('GRAAL_VERSION', version)
                 env['INCLUDE_GRAAL'] = 'true'
             env.setdefault('INSTALL', 'y')
             if mx.get_os() == 'solaris':
--- a/src/share/vm/runtime/arguments.cpp	Mon Apr 07 11:46:20 2014 +0200
+++ b/src/share/vm/runtime/arguments.cpp	Mon Apr 07 16:24:49 2014 +0200
@@ -182,6 +182,9 @@
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(),  false));
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(),  false));
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(),  true));
+#ifdef GRAAL
+  PropertyList_add(&_system_properties, new SystemProperty("graal.version", GRAAL_VERSION,  true));
+#endif
 
   // following are JVMTI agent writeable properties.
   // Properties values are set to NULL and they are