changeset 13323:48e821e409eb

Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 13 Dec 2013 19:16:25 +0100
parents f28ea693056f
children e1365fd16104
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DelegatingDebugConfig.java graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java
diffstat 6 files changed, 67 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Fri Dec 13 15:53:30 2013 +0000
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Fri Dec 13 19:16:25 2013 +0100
@@ -110,6 +110,10 @@
         return isEnabled(logFilter);
     }
 
+    public boolean isLogEnabledForMethod() {
+        return isEnabledForMethod(logFilter);
+    }
+
     public boolean isMeterEnabled() {
         return isEnabled(meterFilter);
     }
@@ -118,6 +122,10 @@
         return isEnabled(dumpFilter);
     }
 
+    public boolean isDumpEnabledForMethod() {
+        return isEnabledForMethod(dumpFilter);
+    }
+
     public boolean isTimeEnabled() {
         return isEnabled(timerFilter);
     }
@@ -130,6 +138,10 @@
         return checkDebugFilter(Debug.currentScope(), filter) && checkMethodFilter();
     }
 
+    private boolean isEnabledForMethod(DebugFilter filter) {
+        return filter != null && checkMethodFilter();
+    }
+
     private static boolean checkDebugFilter(String currentScope, DebugFilter filter) {
         return filter != null && filter.matches(currentScope);
     }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Fri Dec 13 15:53:30 2013 +0000
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Fri Dec 13 19:16:25 2013 +0100
@@ -69,6 +69,17 @@
         return ENABLED;
     }
 
+    public static boolean isDumpEnabledForMethod() {
+        if (!ENABLED) {
+            return false;
+        }
+        DebugConfig config = DebugScope.getConfig();
+        if (config == null) {
+            return false;
+        }
+        return config.isDumpEnabledForMethod();
+    }
+
     public static boolean isDumpEnabled() {
         return ENABLED && DebugScope.getInstance().isDumpEnabled();
     }
@@ -81,6 +92,17 @@
         return ENABLED && DebugScope.getInstance().isTimeEnabled();
     }
 
+    public static boolean isLogEnabledForMethod() {
+        if (!ENABLED) {
+            return false;
+        }
+        DebugConfig config = DebugScope.getConfig();
+        if (config == null) {
+            return false;
+        }
+        return config.isLogEnabledForMethod();
+    }
+
     public static boolean isLogEnabled() {
         return ENABLED && DebugScope.getInstance().isLogEnabled();
     }
@@ -431,6 +453,10 @@
                 return isLogEnabled;
             }
 
+            public boolean isLogEnabledForMethod() {
+                return isLogEnabled;
+            }
+
             @Override
             public boolean isMeterEnabled() {
                 return isMeterEnabled;
@@ -441,6 +467,10 @@
                 return isDumpEnabled;
             }
 
+            public boolean isDumpEnabledForMethod() {
+                return isDumpEnabled;
+            }
+
             @Override
             public boolean isTimeEnabled() {
                 return isTimerEnabled;
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java	Fri Dec 13 15:53:30 2013 +0000
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java	Fri Dec 13 19:16:25 2013 +0100
@@ -36,6 +36,12 @@
     boolean isLogEnabled();
 
     /**
+     * Determines if logging can be enabled in the current method, regardless of the
+     * {@linkplain Debug#currentScope() current debug scope}.
+     */
+    boolean isLogEnabledForMethod();
+
+    /**
      * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug
      * scope}.
      * 
@@ -52,6 +58,12 @@
     boolean isDumpEnabled();
 
     /**
+     * Determines if dumping can be enabled in the current method, regardless of the
+     * {@linkplain Debug#currentScope() current debug scope}.
+     */
+    boolean isDumpEnabledForMethod();
+
+    /**
      * Adds an object the context used by this configuration to do filtering.
      */
     void addToContext(Object o);
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DelegatingDebugConfig.java	Fri Dec 13 15:53:30 2013 +0000
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DelegatingDebugConfig.java	Fri Dec 13 19:16:25 2013 +0100
@@ -38,6 +38,10 @@
         return delegate.isLogEnabled();
     }
 
+    public boolean isLogEnabledForMethod() {
+        return delegate.isLogEnabledForMethod();
+    }
+
     @Override
     public boolean isMeterEnabled() {
         return delegate.isMeterEnabled();
@@ -48,6 +52,10 @@
         return delegate.isDumpEnabled();
     }
 
+    public boolean isDumpEnabledForMethod() {
+        return delegate.isDumpEnabledForMethod();
+    }
+
     @Override
     public boolean isTimeEnabled() {
         return delegate.isTimeEnabled();
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Fri Dec 13 15:53:30 2013 +0000
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Fri Dec 13 19:16:25 2013 +0100
@@ -589,7 +589,7 @@
      * ordering between the nodes within the list.
      */
     public boolean maybeCompress() {
-        if (Debug.isEnabled()) {
+        if (Debug.isDumpEnabledForMethod() || Debug.isLogEnabledForMethod()) {
             return false;
         }
         int liveNodeCount = getNodeCount();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java	Fri Dec 13 15:53:30 2013 +0000
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java	Fri Dec 13 19:16:25 2013 +0100
@@ -27,6 +27,7 @@
 import java.util.*;
 import java.util.Map.Entry;
 
+import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.GuardsStage;
@@ -34,7 +35,6 @@
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.graph.*;
 import com.oracle.graal.phases.schedule.*;
@@ -54,13 +54,6 @@
  * does the actual control-flow expansion of the remaining {@link GuardNode GuardNodes}.
  */
 public class GuardLoweringPhase extends BasePhase<MidTierContext> {
-    static class Options {
-        //@formatter:off
-        @Option(help = "")
-        public static final OptionValue<Boolean> UseGuardIdAsSpeculationId = new OptionValue<>(false);
-        //@formatter:on
-    }
-
     private static class UseImplicitNullChecks extends ScheduledNodeIterator {
 
         private final IdentityHashMap<ValueNode, GuardNode> nullGuarded = new IdentityHashMap<>();
@@ -134,9 +127,9 @@
         private final Block block;
         private boolean useGuardIdAsSpeculationId;
 
-        public LowerGuards(Block block) {
+        public LowerGuards(Block block, boolean useGuardIdAsSpeculationId) {
             this.block = block;
-            this.useGuardIdAsSpeculationId = Options.UseGuardIdAsSpeculationId.getValue();
+            this.useGuardIdAsSpeculationId = useGuardIdAsSpeculationId;
         }
 
         @Override
@@ -203,6 +196,6 @@
         if (OptImplicitNullChecks.getValue() && implicitNullCheckLimit > 0) {
             new UseImplicitNullChecks(implicitNullCheckLimit).processNodes(block, schedule);
         }
-        new LowerGuards(block).processNodes(block, schedule);
+        new LowerGuards(block, Debug.isDumpEnabledForMethod() || Debug.isLogEnabledForMethod()).processNodes(block, schedule);
     }
 }