diff graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java @ 2595:4a4dab936c1e

new node layout: AccessField
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 05 May 2011 15:49:48 +0200
parents c58a301eb2d7
children 91d3952f7eb7
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java	Thu May 05 15:43:23 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java	Thu May 05 15:49:48 2011 +0200
@@ -24,6 +24,7 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
@@ -33,7 +34,32 @@
  */
 public abstract class AccessField extends StateSplit {
 
-    private Value object;
+    private static final int INPUT_COUNT = 1;
+    private static final int INPUT_OBJECT = 0;
+
+    private static final int SUCCESSOR_COUNT = 0;
+
+    @Override
+    protected int inputCount() {
+        return super.inputCount() + INPUT_COUNT;
+    }
+
+    @Override
+    protected int successorCount() {
+        return super.successorCount() + SUCCESSOR_COUNT;
+    }
+
+    /**
+     * The instruction that produces the receiver object of this field access (for instance field accesses).
+     */
+     public Value object() {
+        return (Value) inputs().get(super.inputCount() + INPUT_OBJECT);
+    }
+
+    public Value setObject(Value n) {
+        return (Value) inputs().set(super.inputCount() + INPUT_OBJECT, n);
+    }
+
     protected final RiField field;
 
     /**
@@ -41,24 +67,16 @@
      * @param kind the result kind of the access
      * @param object the instruction producing the receiver object
      * @param field the compiler interface representation of the field
-     * @param isStatic indicates if the field is static
      * @param stateBefore the state before the field access
-     * @param isLoaded indicates if the class is loaded
+     * @param inputCount
+     * @param successorCount
+     * @param graph
      */
-    public AccessField(CiKind kind, Value object, RiField field, FrameState stateBefore) {
-        super(kind, stateBefore);
-        this.object = object;
-        this.field = field;
+    public AccessField(CiKind kind, Value object, RiField field, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
+        super(kind, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         assert object != null : "every field access must reference some object";
-    }
-
-    /**
-     * Gets the instruction that produces the receiver object of this field access
-     * (for instance field accesses).
-     * @return the instruction that produces the receiver object
-     */
-    public Value object() {
-        return object;
+        this.field = field;
+        setObject(object);
     }
 
     /**
@@ -92,9 +110,4 @@
     public boolean isVolatile() {
         return isLoaded() && Modifier.isVolatile(field.accessFlags());
     }
-
-    @Override
-    public void inputValuesDo(ValueClosure closure) {
-        object = closure.apply(object);
-    }
 }