changeset 15010:f36e56e9dd9a

add allowedUsageType to GuardProxy/GuardPhi, changelog, remove debug output
author Lukas Stadler <lukas.stadler@oracle.com>
date Mon, 07 Apr 2014 14:54:24 +0200
parents e49f62425090
children c8e575742f36
files CHANGELOG.md graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java
diffstat 5 files changed, 10 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.md	Mon Apr 07 13:55:45 2014 +0200
+++ b/CHANGELOG.md	Mon Apr 07 14:54:24 2014 +0200
@@ -4,6 +4,7 @@
 ### Graal
 * Explicit support for oop compression/uncompression in high level graph.
 * LIRGenerator refactoring.
+* Explicit types for inputs (InputType enum).
 * ...
 
 ### Truffle
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Apr 07 13:55:45 2014 +0200
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Apr 07 14:54:24 2014 +0200
@@ -136,8 +136,6 @@
     private static final int INLINE_USAGE_COUNT = 2;
     private static final Node[] NO_NODES = {};
 
-    private static final boolean VERIFY_TYPES = true;
-
     /**
      * Head of usage list. The elements of the usage list in order are {@link #usage0},
      * {@link #usage1} and {@link #extraUsages}. The first null entry terminates the list.
@@ -748,14 +746,12 @@
             for (Node usage : usages()) {
                 assertFalse(usage.isDeleted(), "usage %s must never be deleted", usage);
                 assertTrue(usage.inputs().contains(this), "missing input in usage %s", usage);
-                if (VERIFY_TYPES) {
-                    NodeClassIterator iterator = usage.inputs().iterator();
-                    while (iterator.hasNext()) {
-                        Position pos = iterator.nextPosition();
-                        if (pos.get(usage) == this && pos.getInputType(usage) != InputType.Unchecked) {
-                            assert isAllowedUsageType(pos.getInputType(usage)) : "invalid input of type " + pos.getInputType(usage) + " from " + usage + " to " + this + " (" +
-                                            pos.getInputName(usage) + ")";
-                        }
+                NodeClassIterator iterator = usage.inputs().iterator();
+                while (iterator.hasNext()) {
+                    Position pos = iterator.nextPosition();
+                    if (pos.get(usage) == this && pos.getInputType(usage) != InputType.Unchecked) {
+                        assert isAllowedUsageType(pos.getInputType(usage)) : "invalid input of type " + pos.getInputType(usage) + " from " + usage + " to " + this + " (" + pos.getInputName(usage) +
+                                        ")";
                     }
                 }
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java	Mon Apr 07 13:55:45 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java	Mon Apr 07 14:54:24 2014 +0200
@@ -26,7 +26,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.type.*;
 
-@NodeInfo(nameTemplate = "GuardPhi({i#values})")
+@NodeInfo(nameTemplate = "GuardPhi({i#values})", allowedUsageTypes = {InputType.Guard})
 public class GuardPhiNode extends PhiNode implements GuardingNode {
 
     @Input(InputType.Guard) final NodeInputList<ValueNode> values = new NodeInputList<>(this);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java	Mon Apr 07 13:55:45 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java	Mon Apr 07 14:54:24 2014 +0200
@@ -27,6 +27,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
+@NodeInfo(allowedUsageTypes = {InputType.Guard})
 public class GuardProxyNode extends ProxyNode implements GuardingNode, Proxy {
 
     @Input(InputType.Guard) private GuardingNode value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java	Mon Apr 07 13:55:45 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java	Mon Apr 07 14:54:24 2014 +0200
@@ -25,7 +25,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
-import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.type.*;
 
 /**
@@ -133,23 +132,10 @@
 
     @Override
     public boolean isAllowedUsageType(InputType type) {
-        if (getKind() != Kind.Void && getKind() != Kind.Illegal && type == InputType.Value) {
+        if (getKind() != Kind.Void && type == InputType.Value) {
             return true;
         } else {
             return super.isAllowedUsageType(type);
         }
     }
-
-    @Override
-    public boolean verify() {
-        if ((getKind() != Kind.Illegal && getKind() != Kind.Void) != isAllowedUsageType(InputType.Value)) {
-            System.out.println("mismatch: " + this + " kind: " + getKind() + " isAllowedUsageType: " + isAllowedUsageType(InputType.Value));
-        }
-        if (!(this instanceof WriteNode || this instanceof ReadNode || this instanceof JavaWriteNode || this instanceof JavaReadNode || this instanceof InvokeNode)) {
-            if ((this instanceof GuardingNode) != isAllowedUsageType(InputType.Guard)) {
-                System.out.println("mismatch: " + this + " guard: " + (this instanceof GuardingNode) + " isAllowedUsageType: " + isAllowedUsageType(InputType.Guard));
-            }
-        }
-        return super.verify();
-    }
 }