diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java @ 13685:29a6cb0783de

Allow TruffleOptions to be set using system properties.
author Chris Seaton <chris.seaton@oracle.com>
date Sun, 19 Jan 2014 18:18:42 +0000
parents 494b818b527c
children c35d86f53ace
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java	Fri Jan 17 23:16:59 2014 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java	Sun Jan 19 18:18:42 2014 +0000
@@ -32,31 +32,53 @@
  */
 public class TruffleOptions {
 
-    /** Enables/disables the rewriting of traces in the truffle runtime to stdout. */
-    public static boolean TraceRewrites = false;
+    /**
+     * Enables/disables the rewriting of traces in the truffle runtime to stdout.
+     * <p>
+     * Can be set with {@code -Dtruffle.TraceRewrites=true}.
+     */
+    public static boolean TraceRewrites = Boolean.getBoolean("truffle.TraceRewrites");
 
     /**
      * Enables the generation of detailed rewrite reasons. Enabling this may introduce some overhead
      * for rewriting nodes.
+     * <p>
+     * Can be set with {@code -Dtruffle.DetailedRewriteReasons=true}.
      */
-    public static final boolean DetailedRewriteReasons = false;
+    public static final boolean DetailedRewriteReasons = Boolean.getBoolean("truffle.DetailedRewriteReasons");
 
     /**
      * Filters rewrites that do not contain the given string in the qualified name of the source or
      * target class hierarchy.
+     * <p>
+     * Can be set with {@code -Dtruffle.TraceRewritesFilterClass=name}.
      */
-    public static String TraceRewritesFilterClass = null;
+    public static String TraceRewritesFilterClass = System.getProperty("truffle.TraceRewritesFilterClass");
 
     /**
      * Filters rewrites which does not contain the {@link Kind} in its source {@link NodeInfo}. If
      * no {@link NodeInfo} is defined the element is filtered if the filter value is set.
+     * <p>
+     * Can be set with
+     * {@code -Dtruffle.TraceRewritesFilterFromKind=UNINITIALIZED|SPECIALIZED|POLYMORPHIC|GENERIC}.
      */
-    public static NodeInfo.Kind TraceRewritesFilterFromKind = null;
+    public static NodeInfo.Kind TraceRewritesFilterFromKind = parseNodeInfoKind(System.getProperty("truffle.TraceRewritesFilterFromKind"));
 
     /**
      * Filters rewrites which does not contain the {@link Kind} in its target {@link NodeInfo}. If
      * no {@link NodeInfo} is defined the element is filtered if the filter value is set.
+     * <p>
+     * Can be set with
+     * {@code -Dtruffle.TraceRewritesFilterToKind=UNINITIALIZED|SPECIALIZED|POLYMORPHIC|GENERIC}.
      */
-    public static NodeInfo.Kind TraceRewritesFilterToKind = null;
+    public static NodeInfo.Kind TraceRewritesFilterToKind = parseNodeInfoKind(System.getProperty("truffle.TraceRewritesFilterToKind"));
+
+    private static NodeInfo.Kind parseNodeInfoKind(String kind) {
+        if (kind == null) {
+            return null;
+        }
+
+        return NodeInfo.Kind.valueOf(kind);
+    }
 
 }