changeset 21990:2a98e51646c2

Graal VM should be the default one after building basic-graal. Prepending rather than appending selected DEFAULT_VM to jvm.cfg file.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 17 Jun 2015 12:07:29 +0200
parents f8732226922c
children 3f56ef88aa42
files mx/mx_graal.py
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mx/mx_graal.py	Tue Jun 16 17:52:13 2015 -0700
+++ b/mx/mx_graal.py	Wed Jun 17 12:07:29 2015 +0200
@@ -1008,20 +1008,26 @@
                 lines.append(line)
 
         if not found:
-            mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg)
+            mx.log('Prepending "' + prefix + 'KNOWN" to ' + jvmCfg)
             if mx.get_os() != 'windows':
                 os.chmod(jvmCfg, JDK_UNIX_PERMISSIONS_FILE)
             with open(jvmCfg, 'w') as f:
+                written = False
                 for line in lines:
+                    if line.startswith('#'):
+                        f.write(line)
+                        continue
+                    if not written:
+                        f.write(vmKnown)
+                        if vm == 'jvmci':
+                            # Legacy support
+                            f.write('-graal ALIASED_TO -jvmci\n')
+                        written = True
                     if line.startswith(prefix):
                         line = vmKnown
-                        found = True
+                        if written:
+                            continue
                     f.write(line)
-                if not found:
-                    f.write(vmKnown)
-                    if vm == 'jvmci':
-                        # Legacy support
-                        f.write('-graal ALIASED_TO -jvmci\n')
 
         for jdkDist in _jdkDeployedDists: # Install non HotSpot distribution
             if not jdkDist.partOfHotSpot: