changeset 14016:555867401850

Make Debug.metric objects static
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 25 Feb 2014 09:49:47 -0800
parents 0354f629431a
children e34f406850e5
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java
diffstat 4 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Tue Feb 25 13:36:18 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Tue Feb 25 09:49:47 2014 -0800
@@ -165,6 +165,11 @@
         return toValue(state.lockAt(i));
     }
 
+    private static final DebugMetric STATE_VIRTUAL_OBJECTS = Debug.metric("StateVirtualObjects");
+    private static final DebugMetric STATE_ILLEGALS = Debug.metric("StateIllegals");
+    private static final DebugMetric STATE_VARIABLES = Debug.metric("StateVariables");
+    private static final DebugMetric STATE_CONSTANTS = Debug.metric("StateConstants");
+
     protected Value toValue(ValueNode value) {
         if (value instanceof VirtualObjectNode) {
             VirtualObjectNode obj = (VirtualObjectNode) value;
@@ -182,22 +187,22 @@
                     vobject = VirtualObject.get(obj.type(), null, virtualObjects.size());
                     virtualObjects.put(obj, vobject);
                 }
-                Debug.metric("StateVirtualObjects").increment();
+                STATE_VIRTUAL_OBJECTS.increment();
                 return vobject;
             }
         } else if (value instanceof ConstantNode) {
-            Debug.metric("StateConstants").increment();
+            STATE_CONSTANTS.increment();
             return ((ConstantNode) value).getValue();
 
         } else if (value != null) {
-            Debug.metric("StateVariables").increment();
+            STATE_VARIABLES.increment();
             Value operand = nodeOperands.get(value);
             assert operand != null && (operand instanceof Variable || operand instanceof Constant) : operand + " for " + value;
             return operand;
 
         } else {
             // return a dummy value because real value not needed
-            Debug.metric("StateIllegals").increment();
+            STATE_ILLEGALS.increment();
             return Value.ILLEGAL;
         }
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Feb 25 13:36:18 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Feb 25 09:49:47 2014 -0800
@@ -52,6 +52,8 @@
 
 public class CompilationTask implements Runnable, Comparable {
 
+    private static final DebugMetric BAILOUTS = Debug.metric("Bailouts");
+
     public static final ThreadLocal<Boolean> withinEnqueue = new ThreadLocal<Boolean>() {
 
         @Override
@@ -254,7 +256,7 @@
             }
             stats.finish(method);
         } catch (BailoutException bailout) {
-            Debug.metric("Bailouts").increment();
+            BAILOUTS.increment();
             if (ExitVMOnBailout.getValue()) {
                 TTY.cachedOut.println(MetaUtil.format("Bailout in %H.%n(%p)", method));
                 bailout.printStackTrace(TTY.cachedOut);
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Feb 25 13:36:18 2014 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Feb 25 09:49:47 2014 -0800
@@ -1049,6 +1049,8 @@
             }
         }
 
+        private static final DebugMetric EXPLICIT_EXCEPTIONS = Debug.metric("ExplicitExceptions");
+
         protected void emitExplicitExceptions(ValueNode receiver, ValueNode outOfBoundsIndex) {
             assert receiver != null;
             if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) {
@@ -1060,7 +1062,7 @@
                 ValueNode length = append(new ArrayLengthNode(receiver));
                 emitBoundsCheck(outOfBoundsIndex, length);
             }
-            Debug.metric("ExplicitExceptions").increment();
+            EXPLICIT_EXCEPTIONS.increment();
         }
 
         private void genPutField(JavaField field) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Tue Feb 25 13:36:18 2014 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Tue Feb 25 09:49:47 2014 -0800
@@ -45,6 +45,8 @@
     private ControlFlowOptimizer() {
     }
 
+    private static final DebugMetric BLOCKS_DELETED = Debug.metric("BlocksDeleted");
+
     /**
      * Checks whether a block can be deleted. Only blocks with exactly one successor and an
      * unconditional branch to this successor are eligable.
@@ -102,7 +104,7 @@
                     alignBlock(lir, other);
                 }
 
-                Debug.metric("BlocksDeleted").increment();
+                BLOCKS_DELETED.increment();
                 iterator.remove();
             }
         }