diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java @ 16895:06c15e88d383

added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
author Doug Simon <doug.simon@oracle.com>
date Mon, 18 Aug 2014 14:04:21 +0200
parents cbd42807a31f
children f90dcdbbb75e
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Mon Aug 18 13:49:25 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Mon Aug 18 14:04:21 2014 +0200
@@ -38,19 +38,35 @@
 @NodeInfo
 public class ReadNode extends FloatableAccessNode implements LIRLowerable, Canonicalizable, PiPushable, Virtualizable, GuardingNode {
 
-    public ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) {
+    public static ReadNode create(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) {
+        return new ReadNodeGen(object, location, stamp, barrierType);
+    }
+
+    ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) {
         super(object, location, stamp, null, barrierType);
     }
 
-    public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
+    public static ReadNode create(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
+        return new ReadNodeGen(object, location, stamp, guard, barrierType);
+    }
+
+    ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
         super(object, location, stamp, guard, barrierType);
     }
 
-    public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) {
+    public static ReadNode create(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) {
+        return new ReadNodeGen(object, location, stamp, guard, barrierType, nullCheck, stateBefore);
+    }
+
+    ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) {
         super(object, location, stamp, guard, barrierType, nullCheck, stateBefore);
     }
 
-    private ReadNode(ValueNode object, ValueNode location, ValueNode guard, BarrierType barrierType) {
+    public static ReadNode create(ValueNode object, ValueNode location, ValueNode guard, BarrierType barrierType) {
+        return new ReadNodeGen(object, location, guard, barrierType);
+    }
+
+    ReadNode(ValueNode object, ValueNode location, ValueNode guard, BarrierType barrierType) {
         /*
          * Used by node intrinsics. Really, you can trust me on that! Since the initial value for
          * location is a parameter, i.e., a ParameterNode, the constructor cannot use the declared
@@ -72,14 +88,14 @@
             GuardingNode guard = getGuard();
             if (guard != null && !(guard instanceof FixedNode)) {
                 // The guard is necessary even if the read goes away.
-                return new ValueAnchorNode((ValueNode) guard);
+                return ValueAnchorNode.create((ValueNode) guard);
             } else {
                 // Read without usages or guard can be safely removed.
                 return null;
             }
         }
         if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) {
-            return new ReadNode(((PiNode) object()).getOriginalNode(), location(), stamp(), getGuard(), getBarrierType(), getNullCheck(), stateBefore());
+            return ReadNode.create(((PiNode) object()).getOriginalNode(), location(), stamp(), getGuard(), getBarrierType(), getNullCheck(), stateBefore());
         }
         if (!getNullCheck()) {
             return canonicalizeRead(this, location(), object(), tool);
@@ -92,7 +108,7 @@
 
     @Override
     public FloatingAccessNode asFloatingNode(MemoryNode lastLocationAccess) {
-        return graph().unique(new FloatingReadNode(object(), location(), lastLocationAccess, stamp(), getGuard(), getBarrierType()));
+        return graph().unique(FloatingReadNode.create(object(), location(), lastLocationAccess, stamp(), getGuard(), getBarrierType()));
     }
 
     @Override