diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeData.java @ 16755:bd28da642eea

Truffle-DSL: Several new features implemented: Implementation of a new code generation layout which shares code between generated nodes. Declaration order of specializations is now used as specialization order. Specializations do no longer perform fallthrough on respecialization, they now always respecialize from the first specialization. Implemented support for contains relations between specializations. Improved reachability error messages. Preliminary support for @Implies.
author Christian Humer <christian.humer@gmail.com>
date Mon, 11 Aug 2014 15:53:05 +0200
parents 64dcb92ee75a
children
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeData.java	Mon Aug 11 15:53:05 2014 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeData.java	Mon Aug 11 15:53:05 2014 +0200
@@ -54,11 +54,9 @@
 
     private final NodeExecutionData thisExecution;
 
-    private int polymorphicDepth = -1;
-
-    public NodeData(TypeElement type, String shortName, TypeSystemData typeSystem, List<NodeChildData> children, List<NodeExecutionData> executions, List<NodeFieldData> fields,
-                    List<String> assumptions, int polymorphicDepth) {
-        super(type, null, null);
+    public NodeData(ProcessorContext context, TypeElement type, String shortName, TypeSystemData typeSystem, List<NodeChildData> children, List<NodeExecutionData> executions,
+                    List<NodeFieldData> fields, List<String> assumptions) {
+        super(context, type, null, null);
         this.nodeId = type.getSimpleName().toString();
         this.shortName = shortName;
         this.typeSystem = typeSystem;
@@ -66,7 +64,6 @@
         this.children = children;
         this.childExecutions = executions;
         this.assumptions = assumptions;
-        this.polymorphicDepth = polymorphicDepth;
         this.thisExecution = new NodeExecutionData(new NodeChildData(null, null, "this", getNodeType(), getNodeType(), null, Cardinality.ONE), -1, false);
         this.thisExecution.getChild().setNode(this);
         if (children != null) {
@@ -76,14 +73,22 @@
         }
     }
 
-    public NodeData(TypeElement type) {
-        this(type, null, null, null, null, null, null, -1);
+    public NodeData(ProcessorContext context, TypeElement type) {
+        this(context, type, null, null, null, null, null, null);
     }
 
     public NodeExecutionData getThisExecution() {
         return thisExecution;
     }
 
+    public boolean isFallbackReachable() {
+        SpecializationData generic = getGenericSpecialization();
+        if (generic != null) {
+            return generic.isReachable();
+        }
+        return false;
+    }
+
     public void addEnclosedNode(NodeData node) {
         this.enclosingNodes.add(node);
         node.declaringNode = this;
@@ -121,16 +126,8 @@
         return false;
     }
 
-    public int getPolymorphicDepth() {
-        return polymorphicDepth;
-    }
-
-    public boolean isPolymorphic() {
-        return polymorphicDepth > 1;
-    }
-
-    public void setPolymorphicDepth(int polymorphicDepth) {
-        this.polymorphicDepth = polymorphicDepth;
+    public boolean isPolymorphic(ProcessorContext context) {
+        return needsRewrites(context);
     }
 
     public List<CreateCastData> getCasts() {
@@ -404,7 +401,6 @@
         dumpProperty(builder, indent, "fields", getChildren());
         dumpProperty(builder, indent, "executableTypes", getExecutableTypes());
         dumpProperty(builder, indent, "specializations", getSpecializations());
-        dumpProperty(builder, indent, "polymorphicDepth", getPolymorphicDepth());
         dumpProperty(builder, indent, "assumptions", getAssumptions());
         dumpProperty(builder, indent, "casts", getCasts());
         dumpProperty(builder, indent, "messages", collectMessages());