changeset 6681:02983279d0e6

refactor StructuredGraph constructor, remove debug output
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 07 Nov 2012 15:59:38 +0100
parents 10a3d06d58dc
children 504a6ab40bb7
files graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java
diffstat 4 files changed, 14 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Wed Nov 07 15:59:11 2012 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Wed Nov 07 15:59:38 2012 +0100
@@ -28,6 +28,7 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.Node.Verbosity;
@@ -153,8 +154,7 @@
         }
         for (int i = 0; i < locks.length; i++) {
             if (GraphUtil.originalValue(locks[i]) != GraphUtil.originalValue(other.locks[i])) {
-                System.out.println("unbalanced monitors");
-                return false;
+                throw new BailoutException("unbalanced monitors");
             }
         }
         return true;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Wed Nov 07 15:59:11 2012 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Wed Nov 07 15:59:38 2012 +0100
@@ -1373,7 +1373,6 @@
 
         synchronizedEpilogue(FrameState.AFTER_BCI);
         if (!frameState.locksEmpty()) {
-            System.out.println("unbalanced monitors");
             throw new BailoutException("unbalanced monitors");
         }
         ReturnNode returnNode = currentGraph.add(new ReturnNode(x));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Wed Nov 07 15:59:11 2012 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Wed Nov 07 15:59:38 2012 +0100
@@ -57,30 +57,23 @@
     /**
      * Creates a new Graph containing a single {@link BeginNode} as the {@link #start() start} node.
      */
-    public StructuredGraph(String name) {
-        this(name, null);
+    public StructuredGraph(String name, ResolvedJavaMethod method) {
+        this(name, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI);
     }
 
-    public StructuredGraph(String name, ResolvedJavaMethod method) {
-        this(name, method, uniqueGraphIds.incrementAndGet());
+    public StructuredGraph(ResolvedJavaMethod method) {
+        this(null, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI);
     }
 
-    private StructuredGraph(String name, ResolvedJavaMethod method, long graphId) {
+    public StructuredGraph(ResolvedJavaMethod method, int entryBCI) {
+        this(null, method, uniqueGraphIds.incrementAndGet(), entryBCI);
+    }
+
+    private StructuredGraph(String name, ResolvedJavaMethod method, long graphId, int entryBCI) {
         super(name);
         this.start = add(new StartNode());
         this.method = method;
         this.graphId = graphId;
-        this.entryBCI = INVOCATION_ENTRY_BCI;
-    }
-
-    public StructuredGraph(ResolvedJavaMethod method) {
-        this(method, INVOCATION_ENTRY_BCI);
-    }
-
-    public StructuredGraph(ResolvedJavaMethod method, int entryBCI) {
-        this.start = add(new StartNode());
-        this.method = method;
-        this.graphId = uniqueGraphIds.incrementAndGet();
         this.entryBCI = entryBCI;
     }
 
@@ -128,7 +121,7 @@
 
     @Override
     public StructuredGraph copy(String newName) {
-        StructuredGraph copy = new StructuredGraph(newName, method, graphId);
+        StructuredGraph copy = new StructuredGraph(newName, method, graphId, entryBCI);
         HashMap<Node, Node> replacements = new HashMap<>();
         replacements.put(start, copy.start);
         copy.addDuplicates(getNodes(), replacements);
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java	Wed Nov 07 15:59:11 2012 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java	Wed Nov 07 15:59:38 2012 +0100
@@ -157,10 +157,10 @@
         boolean success = true;
         for (Node node : obsoleteNodes) {
             if (flood.isMarked(node)) {
-                System.out.println("offending node path:");
+                trace("offending node path:");
                 Node current = node;
                 while (current != null) {
-                    System.out.println(current);
+                    trace(current.toString());
                     current = path.get(current);
                     if (current != null && current instanceof FixedNode && !obsoleteNodes.contains(current)) {
                         break;