diff graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java @ 13361:5a6c617a66ac

added -G:+CompileTheWorldVerbose and -G:CompileTheWorldIterations options
author Doug Simon <doug.simon@oracle.com>
date Tue, 17 Dec 2013 16:41:26 +0100
parents 0e5c4f9fa9a5
children 9fd85def8368
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Tue Dec 17 15:44:23 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Tue Dec 17 16:41:26 2013 +0100
@@ -51,10 +51,19 @@
  */
 public final class CompileTheWorld {
 
-    static class Options {
+    /**
+     * Magic token to trigger reading files from the boot class path.
+     */
+    public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
+
+    public static class Options {
         // @formatter:off
         @Option(help = "Compile all methods in all classes on given class path")
-        public static final OptionValue<String> CompileTheWorldClasspath = new OptionValue<>(null);
+        public static final OptionValue<String> CompileTheWorldClasspath = new OptionValue<>(SUN_BOOT_CLASS_PATH);
+        @Option(help = "Verbose CompileTheWorld operation")
+        public static final OptionValue<Boolean> CompileTheWorldVerbose = new OptionValue<>(true);
+        @Option(help = "The number of CompileTheWorld iterations to perform")
+        public static final OptionValue<Integer> CompileTheWorldIterations = new OptionValue<>(1);
         @Option(help = "First class to consider when using -XX:+CompileTheWorld")
         public static final OptionValue<Integer> CompileTheWorldStartAt = new OptionValue<>(1);
         @Option(help = "Last class to consider when using -XX:+CompileTheWorld")
@@ -64,6 +73,19 @@
                        "The format for each option is the same as on the command line just without the '-G:' prefix.")
         public static final OptionValue<String> CompileTheWorldConfig = new OptionValue<>(null);
         // @formatter:on
+
+        /**
+         * Overrides {@link #CompileTheWorldStartAt} and {@link #CompileTheWorldStopAt} from
+         * {@code -XX} HotSpot options of the same name if the latter have non-default values.
+         */
+        static void overrideWithNativeOptions(HotSpotVMConfig c) {
+            if (c.compileTheWorldStartAt != 1) {
+                CompileTheWorldStartAt.setValue(c.compileTheWorldStartAt);
+            }
+            if (c.compileTheWorldStopAt != Integer.MAX_VALUE) {
+                CompileTheWorldStopAt.setValue(c.compileTheWorldStopAt);
+            }
+        }
     }
 
     /**
@@ -79,7 +101,7 @@
      * </pre>
      */
     @SuppressWarnings("serial")
-    static class Config extends HashMap<OptionValue<?>, Object> implements AutoCloseable, OptionConsumer {
+    public static class Config extends HashMap<OptionValue<?>, Object> implements AutoCloseable, OptionConsumer {
         OverrideScope scope;
 
         /**
@@ -89,7 +111,7 @@
          *            a format compatible with
          *            {@link HotSpotOptions#parseOption(String, OptionConsumer)}
          */
-        Config(String options) {
+        public Config(String options) {
             for (String option : options.split("\\s+")) {
                 if (!HotSpotOptions.parseOption(option, this)) {
                     throw new GraalInternalError("Invalid option specified: %s", option);
@@ -118,21 +140,16 @@
         public void set(OptionDescriptor desc, Object value) {
             put(desc.getOptionValue(), value);
         }
-    }
 
-    static Config parseConfig(String input) {
-        if (input == null) {
-            return null;
-        } else {
-            return new Config(input);
+        public static Config parse(String input) {
+            if (input == null) {
+                return null;
+            } else {
+                return new Config(input);
+            }
         }
     }
 
-    /**
-     * This is our magic token to trigger reading files from the boot class path.
-     */
-    public static final String SUN_BOOT_CLASS_PATH = "sun.boot.class.path";
-
     // Some runtime instances we need.
     private final HotSpotGraalRuntime runtime = runtime();
     private final VMToCompilerImpl vmToCompiler = (VMToCompilerImpl) runtime.getVMToCompiler();
@@ -155,15 +172,6 @@
     private final Config config;
 
     /**
-     * Creates a compile-the-world instance with default values from
-     * {@link Options#CompileTheWorldClasspath}, {@link Options#CompileTheWorldStartAt} and
-     * {@link Options#CompileTheWorldStopAt}.
-     */
-    public CompileTheWorld() {
-        this(CompileTheWorldClasspath.getValue(), parseConfig(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(), CompileTheWorldStopAt.getValue(), true);
-    }
-
-    /**
      * Creates a compile-the-world instance.
      * 
      * @param files {@link File#pathSeparator} separated list of Zip/Jar files to compile