changeset 2906:0017f484608c

Made boolean options more robust to also allow -G:Time or -G:Meter.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 08 Jun 2011 17:42:07 +0200
parents 8681191723f3
children aff4a6f17c26 35fb2fef44f1
files graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotOptions.java src/share/vm/runtime/arguments.cpp
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotOptions.java	Wed Jun 08 17:27:31 2011 +0200
+++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotOptions.java	Wed Jun 08 17:42:07 2011 +0200
@@ -52,10 +52,12 @@
         } else {
             int index = option.indexOf('=');
             if (index == -1) {
-                return false;
+                fieldName = option;
+                valueString = null;
+            } else {
+                fieldName = option.substring(0, index);
+                valueString = option.substring(index + 1);
             }
-            fieldName = option.substring(0, index);
-            valueString = option.substring(index + 1);
         }
 
         Field f;
@@ -70,7 +72,11 @@
                 } else if (f.getType() == Integer.TYPE) {
                     value = Integer.parseInt(valueString);
                 } else if (f.getType() == Boolean.TYPE) {
-                    value = Boolean.parseBoolean(valueString);
+                    if (valueString == null || valueString.length() == 0) {
+                        value = true;
+                    } else {
+                        value = Boolean.parseBoolean(valueString);
+                    }
                 } else if (f.getType() == String.class) {
                     value = valueString;
                 }
--- a/src/share/vm/runtime/arguments.cpp	Wed Jun 08 17:27:31 2011 +0200
+++ b/src/share/vm/runtime/arguments.cpp	Wed Jun 08 17:42:07 2011 +0200
@@ -2699,7 +2699,7 @@
       sprintf(temp, "%s/graal/com.oracle.max.graal.graphviz/bin", graal_dir);
       scp_p->add_prefix(temp);
       *scp_assembly_required_p = true;
-    } else if (match_option(option, "-G:", &tail)) { // -graal:xxxx
+    } else if (match_option(option, "-G:", &tail)) { // -G:XXX
       // Option for the graal compiler.
       if (PrintVMOptions) {
         tty->print_cr("graal option %s", tail);