# HG changeset patch # User Doug Simon # Date 1387296562 -3600 # Node ID bfc5acea3c125f8101c48989332eed7c8239e900 # Parent 5a4293f24642cfb51b1d96a6673e52fef7722fda consolidated mechanism for overriding options in CompileTheWorld diff -r 5a4293f24642 -r bfc5acea3c12 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java --- 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); } diff -r 5a4293f24642 -r bfc5acea3c12 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- 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); } /** diff -r 5a4293f24642 -r bfc5acea3c12 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- 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(); }