changeset 18884:0857a4186ecd

added Fingerprint points to assist debugging replay compilation
author Doug Simon <doug.simon@oracle.com>
date Tue, 20 Jan 2015 16:52:16 +0100
parents fe7a58f50fe4
children 0e9ae9a7e675
files graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java
diffstat 5 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Tue Jan 20 16:22:11 2015 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Tue Jan 20 16:52:16 2015 +0100
@@ -123,6 +123,11 @@
             }
             return false;
         }
+
+        @Override
+        public String toString() {
+            return node.toString();
+        }
     }
 
     /**
@@ -745,6 +750,9 @@
         if (nodeEventListener != null) {
             nodeEventListener.nodeAdded(node);
         }
+        if (Fingerprint.ENABLED) {
+            Fingerprint.submit("%s: %s", NodeEvent.NODE_ADDED, node);
+        }
     }
 
     @SuppressWarnings("unused")
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Tue Jan 20 16:22:11 2015 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Tue Jan 20 16:52:16 2015 +0100
@@ -31,6 +31,8 @@
 import sun.misc.*;
 
 import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.debug.*;
+import com.oracle.graal.graph.Graph.NodeEvent;
 import com.oracle.graal.graph.Graph.NodeEventListener;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graph.spi.*;
@@ -685,6 +687,9 @@
             if (listener != null) {
                 listener.inputChanged(node);
             }
+            if (Fingerprint.ENABLED) {
+                Fingerprint.submit("%s: %s", NodeEvent.INPUT_CHANGED, node);
+            }
         }
     }
 
@@ -695,6 +700,9 @@
             if (listener != null) {
                 listener.usagesDroppedToZero(node);
             }
+            if (Fingerprint.ENABLED) {
+                Fingerprint.submit("%s: %s", NodeEvent.ZERO_USAGES, node);
+            }
         }
     }
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Tue Jan 20 16:22:11 2015 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Tue Jan 20 16:52:16 2015 +0100
@@ -166,7 +166,7 @@
         isLeafNode = inputs.getCount() + successors.getCount() == 0;
 
         canGVN = Node.ValueNumberable.class.isAssignableFrom(clazz);
-        startGVNNumber = clazz.hashCode();
+        startGVNNumber = clazz.getName().hashCode();
 
         NodeInfo info = getAnnotationTimed(clazz, NodeInfo.class);
         assert info != null : "Missing NodeInfo annotation on " + clazz;
@@ -721,9 +721,15 @@
                     replacement = replacements.replacement(node);
                 }
                 if (replacement != node) {
+                    if (Fingerprint.ENABLED) {
+                        Fingerprint.submit("replacing %s with %s", node, replacement);
+                    }
                     assert replacement != null;
                     newNodes.put(node, replacement);
                 } else {
+                    if (Fingerprint.ENABLED) {
+                        Fingerprint.submit("duplicating %s", node);
+                    }
                     Node newNode = node.clone(graph, WithAllEdges);
                     assert newNode.inputs().isEmpty() || newNode.usages().isEmpty();
                     assert newNode.getClass() == node.getClass();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java	Tue Jan 20 16:22:11 2015 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java	Tue Jan 20 16:52:16 2015 +0100
@@ -228,6 +228,9 @@
      *            canonicalized after inlining
      */
     public static Map<Node, Node> inline(Invoke invoke, StructuredGraph inlineGraph, boolean receiverNullCheck, List<Node> canonicalizedNodes) {
+        if (Fingerprint.ENABLED) {
+            Fingerprint.submit("inlining %s into %s: %s", formatGraph(inlineGraph), formatGraph(invoke.asNode().graph()), inlineGraph.getNodes().snapshot());
+        }
         final NodeInputList<ValueNode> parameters = invoke.callTarget().arguments();
         FixedNode invokeNode = invoke.asNode();
         StructuredGraph graph = invokeNode.graph();
@@ -355,6 +358,13 @@
         return duplicates;
     }
 
+    private static String formatGraph(StructuredGraph graph) {
+        if (graph.method() == null) {
+            return graph.name;
+        }
+        return graph.method().format("%H.%n(%p)");
+    }
+
     private static void processSimpleInfopoints(Invoke invoke, StructuredGraph inlineGraph, Map<Node, Node> duplicates) {
         if (inlineGraph.getNodes(SimpleInfopointNode.class).isEmpty()) {
             return;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java	Tue Jan 20 16:22:11 2015 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java	Tue Jan 20 16:52:16 2015 +0100
@@ -106,6 +106,10 @@
             if (dumpGraph && Debug.isDumpEnabled(PHASE_DUMP_LEVEL)) {
                 Debug.dump(PHASE_DUMP_LEVEL, graph, "After phase %s", getName());
             }
+            if (Fingerprint.ENABLED) {
+                String graphDesc = graph.method() == null ? graph.name : graph.method().format("%H.%n(%p)");
+                Fingerprint.submit("After phase %s nodes in %s are %s", getName(), graphDesc, graph.getNodes().snapshot());
+            }
             if (Debug.isVerifyEnabled()) {
                 Debug.verify(graph, "After phase %s", getName());
             }