# HG changeset patch # User Gilles Duboscq # Date 1386958585 -3600 # Node ID 48e821e409eb9d919e533f28b26bdeacba1d9e1a # Parent f28ea693056f39037245424d9c5a2a3d331eae36 Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id diff -r f28ea693056f -r 48e821e409eb graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java --- 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); } diff -r f28ea693056f -r 48e821e409eb graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java --- 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; diff -r f28ea693056f -r 48e821e409eb graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java --- 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); diff -r f28ea693056f -r 48e821e409eb graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DelegatingDebugConfig.java --- 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(); diff -r f28ea693056f -r 48e821e409eb graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java --- 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(); diff -r f28ea693056f -r 48e821e409eb graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java --- 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 { - static class Options { - //@formatter:off - @Option(help = "") - public static final OptionValue UseGuardIdAsSpeculationId = new OptionValue<>(false); - //@formatter:on - } - private static class UseImplicitNullChecks extends ScheduledNodeIterator { private final IdentityHashMap 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); } }