changeset 9233:374ece5ff845

Make LocationNodes usable in Snippets.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 22 Apr 2013 18:57:35 +0200
parents bb2447c64055
children 6aea59f0965c f453894e72ea
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/GenericStamp.java
diffstat 4 files changed, 27 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java	Mon Apr 22 17:59:14 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java	Mon Apr 22 18:57:35 2013 +0200
@@ -48,11 +48,11 @@
 
     public static AddLocationNode create(LocationNode x, LocationNode y, Graph graph) {
         assert x.getValueKind().equals(y.getValueKind()) && x.locationIdentity() == y.locationIdentity();
-        return graph.unique(new AddLocationNode(x, y));
+        return graph.unique(new AddLocationNode(x.locationIdentity(), x.getValueKind(), x, y));
     }
 
-    private AddLocationNode(LocationNode x, LocationNode y) {
-        super(x.locationIdentity(), x.getValueKind());
+    private AddLocationNode(Object identity, Kind kind, ValueNode x, ValueNode y) {
+        super(identity, kind);
         this.x = x;
         this.y = y;
     }
@@ -60,7 +60,7 @@
     @Override
     protected LocationNode addDisplacement(long displacement) {
         LocationNode added = getX().addDisplacement(displacement);
-        return graph().unique(new AddLocationNode(added, getY()));
+        return graph().unique(new AddLocationNode(locationIdentity(), getValueKind(), added, getY()));
     }
 
     @Override
@@ -102,4 +102,7 @@
         Value xAddr = getX().generateLea(gen, base);
         getY().generateStore(gen, xAddr, value, deopting);
     }
+
+    @NodeIntrinsic
+    public static native Location addLocation(@ConstantNodeParameter Object identity, @ConstantNodeParameter Kind kind, Location x, Location y);
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Mon Apr 22 17:59:14 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Mon Apr 22 18:57:35 2013 +0200
@@ -58,10 +58,14 @@
     }
 
     public static IndexedLocationNode create(Object identity, Kind kind, long displacement, ValueNode index, Graph graph, int indexScaling) {
-        return graph.unique(new IndexedLocationNode(identity, kind, index, displacement, indexScaling));
+        return graph.unique(new IndexedLocationNode(identity, kind, displacement, index, indexScaling));
     }
 
-    private IndexedLocationNode(Object identity, Kind kind, ValueNode index, long displacement, int indexScaling) {
+    private IndexedLocationNode(Object identity, Kind kind, ValueNode index, int indexScaling) {
+        this(identity, kind, 0, index, indexScaling);
+    }
+
+    private IndexedLocationNode(Object identity, Kind kind, long displacement, ValueNode index, int indexScaling) {
         super(identity, kind);
         this.index = index;
         this.displacement = displacement;
@@ -99,4 +103,7 @@
     public void generateStore(LIRGeneratorTool gen, Value base, Value value, DeoptimizingNode deopting) {
         gen.emitStore(getValueKind(), base, displacement, gen.operand(index()), indexScaling(), value, deopting);
     }
+
+    @NodeIntrinsic
+    public static native Location indexedLocation(@ConstantNodeParameter Object identity, @ConstantNodeParameter Kind kind, int index, @ConstantNodeParameter int indexScaling);
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java	Mon Apr 22 17:59:14 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java	Mon Apr 22 18:57:35 2013 +0200
@@ -30,9 +30,9 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * A location for a memory access in terms of the kind of value accessed and how to access it.
- * All locations have the form [base + location], where base is a node and location is defined
- * by subclasses of the {@link LocationNode}.
+ * A location for a memory access in terms of the kind of value accessed and how to access it. All
+ * locations have the form [base + location], where base is a node and location is defined by
+ * subclasses of the {@link LocationNode}.
  */
 public abstract class LocationNode extends FloatingNode implements LIRLowerable, ValueNumberable {
 
@@ -41,7 +41,7 @@
 
     /**
      * Creates a new unique location identity for read and write operations.
-     *
+     * 
      * @param name the name of the new location identity, for debugging purposes
      * @return the new location identity
      */
@@ -67,6 +67,12 @@
      */
     public static final Object FINAL_LOCATION = createLocation("FINAL_LOCATION");
 
+    /**
+     * Marker interface for locations in snippets.
+     */
+    public interface Location {
+    }
+
     public static Object getArrayLocation(Kind elementKind) {
         return elementKind;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/GenericStamp.java	Mon Apr 22 17:59:14 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/GenericStamp.java	Mon Apr 22 18:57:35 2013 +0200
@@ -33,7 +33,7 @@
     private final GenericStampType type;
 
     protected GenericStamp(GenericStampType type) {
-        super(Kind.Void);
+        super(type == GenericStampType.Void ? Kind.Void : Kind.Illegal);
         this.type = type;
     }