changeset 13365:bfc5acea3c12

consolidated mechanism for overriding options in CompileTheWorld
author Doug Simon <doug.simon@oracle.com>
date Tue, 17 Dec 2013 17:09:22 +0100
parents 5a4293f24642
children 1480cfe97462
files graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java
diffstat 3 files changed, 13 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Tue Dec 17 16:45:02 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Tue Dec 17 17:09:22 2013 +0100
@@ -28,6 +28,7 @@
 
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.CompileTheWorld.Config;
 
 /**
  * Tests {@link CompileTheWorld} functionality.
@@ -39,7 +40,7 @@
         boolean originalSetting = ExitVMOnException.getValue();
         // Compile a couple classes in rt.jar
         String file = System.getProperty("java.home") + "/lib/rt.jar";
-        new CompileTheWorld(file, null, 1, 5, false).compile();
+        new CompileTheWorld(file, new Config(null), 1, 5, false).compile();
         ExitVMOnException.setValue(originalSetting);
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Tue Dec 17 16:45:02 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Tue Dec 17 17:09:22 2013 +0100
@@ -110,12 +110,14 @@
          * 
          * @param options a space separated set of option value settings with each option setting in
          *            a format compatible with
-         *            {@link HotSpotOptions#parseOption(String, OptionConsumer)}
+         *            {@link HotSpotOptions#parseOption(String, OptionConsumer)}. Ignored if null.
          */
         public Config(String options) {
-            for (String option : options.split("\\s+")) {
-                if (!HotSpotOptions.parseOption(option, this)) {
-                    throw new GraalInternalError("Invalid option specified: %s", option);
+            if (options != null) {
+                for (String option : options.split("\\s+")) {
+                    if (!HotSpotOptions.parseOption(option, this)) {
+                        throw new GraalInternalError("Invalid option specified: %s", option);
+                    }
                 }
             }
         }
@@ -141,14 +143,6 @@
         public void set(OptionDescriptor desc, Object value) {
             put(desc.getOptionValue(), value);
         }
-
-        public static Config parse(String input) {
-            if (input == null) {
-                return null;
-            } else {
-                return new Config(input);
-            }
-        }
     }
 
     // Some runtime instances we need.
@@ -187,11 +181,11 @@
         this.config = config;
 
         // We don't want the VM to exit when a method fails to compile...
-        ExitVMOnException.setValue(false);
+        config.put(ExitVMOnException, false);
 
         // ...but we want to see exceptions.
-        PrintBailout.setValue(true);
-        PrintStackTraceOnException.setValue(true);
+        config.put(PrintBailout, true);
+        config.put(PrintStackTraceOnException, true);
     }
 
     /**
@@ -321,7 +315,7 @@
         }
 
         println();
-        println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime);
+        TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime);
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Tue Dec 17 16:45:02 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Tue Dec 17 17:09:22 2013 +0100
@@ -338,7 +338,7 @@
         for (int i = 0; i < iterations; i++) {
             runtime.getCompilerToVM().resetCompilationStatistics();
             TTY.println("CompileTheWorld : iteration " + i);
-            CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), Config.parse(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(),
+            CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(),
                             CompileTheWorldStopAt.getValue(), CompileTheWorldVerbose.getValue());
             ctw.compile();
         }