changeset 2600:f1bc67c2d453

new node layout: TypeCheck, RegisterFinalizer, Invoke, NewArray, NullCheck
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 05 May 2011 16:32:20 +0200
parents 1c36b17f7ee0
children 224e8b4007bd
files graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java
diffstat 14 files changed, 242 insertions(+), 163 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Thu May 05 16:32:20 2011 +0200
@@ -288,14 +288,14 @@
     @Override
     public void visitCheckCast(CheckCast x) {
         XirArgument obj = toXirArgument(x.object());
-        XirSnippet snippet = xir.genCheckCast(site(x), obj, toXirArgument(x.targetClassInstruction), x.targetClass());
+        XirSnippet snippet = xir.genCheckCast(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass());
         emitXir(snippet, x, stateFor(x), null, true);
     }
 
     @Override
     public void visitInstanceOf(InstanceOf x) {
         XirArgument obj = toXirArgument(x.object());
-        XirSnippet snippet = xir.genInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction), x.targetClass());
+        XirSnippet snippet = xir.genInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass());
         emitXir(snippet, x, maybeStateFor(x), null, true);
     }
 
@@ -347,10 +347,10 @@
 
     @Override
     public void visitNewMultiArray(NewMultiArray x) {
-        XirArgument[] dims = new XirArgument[x.dimensions().length];
+        XirArgument[] dims = new XirArgument[x.dimensionCount()];
 
         for (int i = 0; i < dims.length; i++) {
-            dims[i] = toXirArgument(x.dimensions()[i]);
+            dims[i] = toXirArgument(x.dimension(i));
         }
 
         XirSnippet snippet = xir.genNewMultiArray(site(x), dims, x.elementKind);
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Thu May 05 16:32:20 2011 +0200
@@ -423,7 +423,7 @@
             // this is a load of class constant which might be unresolved
             RiType riType = (RiType) con;
             if (!riType.isResolved() || C1XOptions.TestPatching) {
-                push(CiKind.Object, append(new ResolveClass(riType, RiType.Representation.JavaClass, null)));
+                push(CiKind.Object, append(new ResolveClass(riType, RiType.Representation.JavaClass, null, graph)));
             } else {
                 push(CiKind.Object, append(new Constant(riType.getEncoding(Representation.JavaClass), graph)));
             }
@@ -643,7 +643,7 @@
         RiType type = constantPool().lookupType(cpi, CHECKCAST);
         boolean isInitialized = !C1XOptions.TestPatching && type.isResolved() && type.isInitialized();
         Value typeInstruction = genResolveClass(RiType.Representation.ObjectHub, type, isInitialized, cpi);
-        CheckCast c = new CheckCast(type, typeInstruction, apop(), null);
+        CheckCast c = new CheckCast(type, typeInstruction, apop(), null, graph);
         apush(append(c));
         checkForDirectCompare(c);
     }
@@ -653,7 +653,7 @@
         RiType type = constantPool().lookupType(cpi, INSTANCEOF);
         boolean isInitialized = !C1XOptions.TestPatching && type.isResolved() && type.isInitialized();
         Value typeInstruction = genResolveClass(RiType.Representation.ObjectHub, type, isInitialized, cpi);
-        InstanceOf i = new InstanceOf(type, typeInstruction, apop(), null);
+        InstanceOf i = new InstanceOf(type, typeInstruction, apop(), null, graph);
         ipush(append(i));
         checkForDirectCompare(i);
     }
@@ -668,7 +668,7 @@
     void genNewInstance(int cpi) {
         FrameState stateBefore = curState.immutableCopy(bci());
         RiType type = constantPool().lookupType(cpi, NEW);
-        NewInstance n = new NewInstance(type, cpi, constantPool(), stateBefore);
+        NewInstance n = new NewInstance(type, cpi, constantPool(), stateBefore, graph);
         if (memoryMap != null) {
             memoryMap.newInstance(n);
         }
@@ -679,13 +679,13 @@
         FrameState stateBefore = curState.immutableCopy(bci());
         CiKind kind = CiKind.fromArrayTypeCode(typeCode);
         RiType elementType = compilation.runtime.asRiType(kind);
-        apush(append(new NewTypeArray(ipop(), elementType, stateBefore)));
+        apush(append(new NewTypeArray(ipop(), elementType, stateBefore, graph)));
     }
 
     void genNewObjectArray(int cpi) {
         RiType type = constantPool().lookupType(cpi, ANEWARRAY);
         FrameState stateBefore = curState.immutableCopy(bci());
-        NewArray n = new NewObjectArray(type, ipop(), stateBefore);
+        NewArray n = new NewObjectArray(type, ipop(), stateBefore, graph);
         apush(append(n));
     }
 
@@ -697,7 +697,7 @@
         for (int i = rank - 1; i >= 0; i--) {
             dims[i] = ipop();
         }
-        NewArray n = new NewMultiArray(type, dims, stateBefore, cpi, constantPool());
+        NewArray n = new NewMultiArray(type, dims, stateBefore, cpi, constantPool(), graph);
         apush(append(n));
     }
 
@@ -744,7 +744,7 @@
         if (initialized) {
             holderInstr = appendConstant(holder.getEncoding(representation));
         } else {
-            holderInstr = append(new ResolveClass(holder, representation, null));
+            holderInstr = append(new ResolveClass(holder, representation, null, graph));
         }
         return holderInstr;
     }
@@ -1001,7 +1001,7 @@
 
         if (needsCheck) {
             // append a call to the finalizer registration
-            append(new RegisterFinalizer(curState.loadLocal(0), curState.immutableCopy(bci())));
+            append(new RegisterFinalizer(curState.loadLocal(0), curState.immutableCopy(bci()), graph));
             C1XMetrics.InlinedFinalizerChecks++;
         }
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.util.*;
 import com.sun.c1x.value.*;
@@ -31,19 +32,21 @@
 
 /**
  * The {@code CheckCast} instruction represents a {@link Bytecodes#CHECKCAST}.
- *
- * @author Ben L. Titzer
  */
 public final class CheckCast extends TypeCheck {
 
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
     /**
      * Creates a new CheckCast instruction.
      * @param targetClass the class being cast to
      * @param object the instruction producing the object
      * @param stateBefore the state before the cast
+     * @param graph
      */
-    public CheckCast(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore) {
-        super(targetClass, targetClassInstruction, object, CiKind.Object, stateBefore);
+    public CheckCast(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore, Graph graph) {
+        super(targetClass, targetClassInstruction, object, CiKind.Object, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         initFlag(Flag.NonNull, object.isNonNull());
     }
 
@@ -72,14 +75,14 @@
 
     @Override
     public int valueNumber() {
-        return targetClass.isResolved() ? Util.hash1(Bytecodes.CHECKCAST, object) : 0;
+        return targetClass.isResolved() ? Util.hash1(Bytecodes.CHECKCAST, object()) : 0;
     }
 
     @Override
     public boolean valueEqual(Instruction i) {
         if (i instanceof CheckCast) {
             CheckCast o = (CheckCast) i;
-            return targetClass == o.targetClass && object == o.object;
+            return targetClass == o.targetClass && object() == o.object();
         }
         return false;
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.util.*;
 import com.sun.c1x.value.*;
@@ -31,19 +32,21 @@
 
 /**
  * The {@code InstanceOf} instruction represents an instanceof test.
- *
- * @author Ben L. Titzer
  */
 public final class InstanceOf extends TypeCheck {
 
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
     /**
      * Constructs a new InstanceOf instruction.
      * @param targetClass the target class of the instanceof check
      * @param object the instruction producing the object input to this instruction
      * @param stateBefore the state before this instruction
+     * @param graph
      */
-    public InstanceOf(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore) {
-        super(targetClass, targetClassInstruction, object, CiKind.Int, stateBefore);
+    public InstanceOf(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore, Graph graph) {
+        super(targetClass, targetClassInstruction, object, CiKind.Int, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
     }
 
     @Override
@@ -53,14 +56,14 @@
 
     @Override
     public int valueNumber() {
-        return Util.hash1(Bytecodes.INSTANCEOF, object);
+        return Util.hash1(Bytecodes.INSTANCEOF, object());
     }
 
     @Override
     public boolean valueEqual(Instruction i) {
         if (i instanceof InstanceOf) {
             InstanceOf o = (InstanceOf) i;
-            return targetClass == o.targetClass && object == o.object;
+            return targetClass == o.targetClass && object() == o.object();
         }
         return false;
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java	Thu May 05 16:32:20 2011 +0200
@@ -22,43 +22,53 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 
 /**
  * The {@code NewArray} class is the base of all instructions that allocate arrays.
- *
- * @author Ben L. Titzer
  */
 public abstract class NewArray extends StateSplit {
 
-    Value length;
+    private static final int INPUT_COUNT = 1;
+    private static final int INPUT_LENGTH = 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 length of this array.
+     */
+     public Value length() {
+        return (Value) inputs().get(super.inputCount() + INPUT_LENGTH);
+    }
+
+    public Value setLength(Value n) {
+        return (Value) inputs().set(super.inputCount() + INPUT_LENGTH, n);
+    }
 
     /**
      * Constructs a new NewArray instruction.
      * @param length the instruction that produces the length for this allocation
      * @param stateBefore the state before the allocation
+     * @param inputCount
+     * @param successorCount
+     * @param graph
      */
-    NewArray(Value length, FrameState stateBefore) {
-        super(CiKind.Object, stateBefore);
-        this.length = length;
+    NewArray(Value length, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
+        super(CiKind.Object, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         setFlag(Flag.NonNull);
+        setLength(length);
     }
 
-    /**
-     * Gets the instruction that produces the length of this array.
-     * @return the instruction that produces the length
-     */
-    public Value length() {
-        return length;
-    }
-
-    /**
-     * Applies the specified closure to all input values of this instruction.
-     * @param closure the closure to apply
-     */
-    @Override
-    public void inputValuesDo(ValueClosure closure) {
-        length = closure.apply(length);
-    }
 }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
@@ -29,11 +30,12 @@
 
 /**
  * The {@code NewInstance} instruction represents the allocation of an instance class object.
- *
- * @author Ben L. Titzer
  */
 public final class NewInstance extends StateSplit {
 
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
     final RiType instanceClass;
     public final int cpi;
     public final RiConstantPool constantPool;
@@ -43,9 +45,10 @@
      * @param type the class being allocated
      * @param cpi the constant pool index
      * @param stateBefore the state before executing this instruction
+     * @param graph
      */
-    public NewInstance(RiType type, int cpi, RiConstantPool constantPool, FrameState stateBefore) {
-        super(CiKind.Object, stateBefore);
+    public NewInstance(RiType type, int cpi, RiConstantPool constantPool, FrameState stateBefore, Graph graph) {
+        super(CiKind.Object, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.instanceClass = type;
         this.cpi = cpi;
         this.constantPool = constantPool;
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
@@ -30,12 +31,44 @@
 /**
  * The {@code NewMultiArray} instruction represents an allocation of a multi-dimensional object
  * array.
- *
- * @author Ben L. Titzer
  */
 public final class NewMultiArray extends NewArray {
+
+    private final int dimensionCount;
+
+    private static final int SUCCESSOR_COUNT = 0;
+
+    @Override
+    protected int inputCount() {
+        return super.inputCount() + dimensionCount;
+    }
+
+    @Override
+    protected int successorCount() {
+        return super.successorCount() + SUCCESSOR_COUNT;
+    }
+
+    /**
+     * The list of instructions which produce input for this instruction.
+     */
+    public Value dimension(int index) {
+        assert index >= 0 && index < dimensionCount;
+        return (Value) inputs().get(super.inputCount() + index);
+    }
+
+    public Value setDimension(int index, Value n) {
+        assert index >= 0 && index < dimensionCount;
+        return (Value) inputs().set(super.inputCount() + index, n);
+    }
+
+    /**
+     * The rank of the array allocated by this instruction, i.e. how many array dimensions.
+     */
+    public int dimensionCount() {
+        return dimensionCount;
+    }
+
     public final RiType elementKind;
-    final Value[] dimensions;
     public final int cpi;
     public final RiConstantPool constantPool;
 
@@ -46,35 +79,17 @@
      * @param stateBefore the state before this instruction
      * @param cpi the constant pool index for resolution
      * @param riConstantPool the constant pool for resolution
+     * @param graph
      */
-    public NewMultiArray(RiType elementKind, Value[] dimensions, FrameState stateBefore, int cpi, RiConstantPool riConstantPool) {
-        super(null, stateBefore);
+    public NewMultiArray(RiType elementKind, Value[] dimensions, FrameState stateBefore, int cpi, RiConstantPool riConstantPool, Graph graph) {
+        super(null, stateBefore, dimensions.length, SUCCESSOR_COUNT, graph);
         this.constantPool = riConstantPool;
         this.elementKind = elementKind;
-        this.dimensions = dimensions;
         this.cpi = cpi;
-    }
-
-    /**
-     * Gets the list of instructions which produce input for this instruction.
-     * @return the list of instructions which produce input
-     */
-    public Value[] dimensions() {
-        return dimensions;
-    }
 
-    /**
-     * Gets the rank of the array allocated by this instruction, i.e. how many array dimensions.
-     * @return the rank of the array allocated
-     */
-    public int rank() {
-        return dimensions.length;
-    }
-
-    @Override
-    public void inputValuesDo(ValueClosure closure) {
+        this.dimensionCount = dimensions.length;
         for (int i = 0; i < dimensions.length; i++) {
-            dimensions[i] = closure.apply(dimensions[i]);
+            setDimension(i, dimensions[i]);
         }
     }
 
@@ -94,12 +109,11 @@
     @Override
     public void print(LogStream out) {
         out.print("new multi array [");
-        final Value[] dimensions = dimensions();
-        for (int i = 0; i < dimensions.length; i++) {
+        for (int i = 0; i < dimensionCount; i++) {
           if (i > 0) {
               out.print(", ");
           }
-          out.print(dimensions[i]);
+          out.print(dimension(i));
         }
         out.print("] ").print(CiUtil.toJavaName(elementKind));
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
@@ -29,11 +30,12 @@
 
 /**
  * The {@code NewObjectArray} instruction represents an allocation of an object array.
- *
- * @author Ben L. Titzer
  */
 public final class NewObjectArray extends NewArray {
 
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
     final RiType elementClass;
 
     /**
@@ -41,9 +43,10 @@
      * @param elementClass the class of elements in this array
      * @param length the instruction producing the length of the array
      * @param stateBefore the state before the allocation
+     * @param graph
      */
-    public NewObjectArray(RiType elementClass, Value length, FrameState stateBefore) {
-        super(length, stateBefore);
+    public NewObjectArray(RiType elementClass, Value length, FrameState stateBefore, Graph graph) {
+        super(length, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.elementClass = elementClass;
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
@@ -29,15 +30,16 @@
 
 /**
  * The {@code NewTypeArray} class definition.
- *
- * @author Ben L. Titzer
  */
 public final class NewTypeArray extends NewArray {
 
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
     final RiType elementType;
 
-    public NewTypeArray(Value length, RiType elementType, FrameState stateBefore) {
-        super(length, stateBefore);
+    public NewTypeArray(Value length, RiType elementType, FrameState stateBefore, Graph graph) {
+        super(length, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.elementType = elementType;
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.util.*;
 import com.sun.c1x.value.*;
@@ -33,30 +34,42 @@
  */
 public final class NullCheck extends StateSplit {
 
-    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 object tested against null.
+     */
+     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);
+    }
 
     /**
      * Constructs a new NullCheck instruction.
-     * @param obj the instruction producing the object to check against null
+     * @param object the instruction producing the object to check against null
      * @param stateBefore the state before executing the null check
+     * @param graph
      */
-    public NullCheck(Value obj, FrameState stateBefore) {
-        super(obj.kind, stateBefore);
-        this.object = obj;
+    public NullCheck(Value object, FrameState stateBefore, Graph graph) {
+        super(object.kind, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setFlag(Flag.NonNull);
-    }
-
-    /**
-     * Gets the instruction that produces the object tested against null.
-     * @return the instruction producing the object
-     */
-    public Value object() {
-        return object;
-    }
-
-    @Override
-    public void inputValuesDo(ValueClosure closure) {
-        object = closure.apply(object);
+        setObject(object);
     }
 
     @Override
@@ -66,14 +79,14 @@
 
     @Override
     public int valueNumber() {
-        return Util.hash1(Bytecodes.IFNONNULL, object);
+        return Util.hash1(Bytecodes.IFNONNULL, object());
     }
 
     @Override
     public boolean valueEqual(Instruction i) {
         if (i instanceof NullCheck) {
             NullCheck o = (NullCheck) i;
-            return object == o.object;
+            return object() == o.object();
         }
         return false;
     }
@@ -81,13 +94,13 @@
     @Override
     public RiType declaredType() {
         // null check does not alter the type of the object
-        return object.declaredType();
+        return object().declaredType();
     }
 
     @Override
     public RiType exactType() {
         // null check does not alter the type of the object
-        return object.exactType();
+        return object().exactType();
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java	Thu May 05 16:32:20 2011 +0200
@@ -22,27 +22,45 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 
+/**
+ * This instruction is used to perform the finalizer registration at the end of the java.lang.Object constructor.
+ */
 public class RegisterFinalizer extends StateSplit {
 
-    private Value object;
+    private static final int INPUT_COUNT = 1;
+    private static final int INPUT_OBJECT = 0;
 
-    public RegisterFinalizer(Value object, FrameState stateBefore) {
-        super(CiKind.Void, stateBefore);
-        this.object = object;
-    }
+    private static final int SUCCESSOR_COUNT = 0;
 
-    public Value object() {
-        return object;
+    @Override
+    protected int inputCount() {
+        return super.inputCount() + INPUT_COUNT;
     }
 
     @Override
-    public void inputValuesDo(ValueClosure closure) {
-        object = closure.apply(object);
-        super.inputValuesDo(closure);
+    protected int successorCount() {
+        return super.successorCount() + SUCCESSOR_COUNT;
+    }
+
+    /**
+     * The instruction that produces the object whose finalizer should be registered.
+     */
+     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);
+    }
+
+    public RegisterFinalizer(Value object, FrameState stateBefore, Graph graph) {
+        super(CiKind.Void, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+        setObject(object);
     }
 
     @Override
@@ -52,6 +70,6 @@
 
     @Override
     public void print(LogStream out) {
-        out.print("register finalizer ").print(object);
+        out.print("register finalizer ").print(object());
     }
 }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java	Thu May 05 16:32:20 2011 +0200
@@ -22,6 +22,7 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
@@ -30,17 +31,17 @@
 /**
  * An instruction that represents the runtime resolution of a Java class object. For example, an
  * ldc of a class constant that is unresolved.
- *
- * @author Ben L. Titzer
- * @author Thomas Wuerthinger
  */
 public final class ResolveClass extends StateSplit {
 
+    private static final int INPUT_COUNT = 0;
+    private static final int SUCCESSOR_COUNT = 0;
+
     public final RiType type;
     public final RiType.Representation portion;
 
-    public ResolveClass(RiType type, RiType.Representation r, FrameState stateBefore) {
-        super(type.getRepresentationKind(r), stateBefore);
+    public ResolveClass(RiType type, RiType.Representation r, FrameState stateBefore, Graph graph) {
+        super(type.getRepresentationKind(r), stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.portion = r;
         this.type = type;
         setFlag(Flag.NonNull);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java	Thu May 05 16:32:20 2011 +0200
@@ -54,10 +54,6 @@
         this.stateBefore = stateBefore;
     }
 
-    public StateSplit(CiKind kind, FrameState stateBefore) {
-        this(kind, stateBefore, 0, 0, null);
-    }
-
     @Override
     public boolean canTrap() {
         return stateBefore != null;
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java	Thu May 05 16:07:00 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java	Thu May 05 16:32:20 2011 +0200
@@ -22,20 +22,55 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.graal.graph.*;
 import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
 
 /**
  * The {@code TypeCheck} instruction is the base class of casts and instanceof tests.
- *
- * @author Ben L. Titzer
  */
 public abstract class TypeCheck extends StateSplit {
 
+    private static final int INPUT_COUNT = 2;
+    private static final int INPUT_OBJECT = 0;
+    private static final int INPUT_TARGET_CLASS_INSTRUCTION = 1;
+
+    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 which produces the object input.
+     */
+     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);
+    }
+
+    /**
+     * The instruction that loads the target class object that is used by this checkcast.
+     */
+     public Value targetClassInstruction() {
+        return (Value) inputs().get(super.inputCount() + INPUT_TARGET_CLASS_INSTRUCTION);
+    }
+
+    public Value setTargetClassInstruction(Value n) {
+        return (Value) inputs().set(super.inputCount() + INPUT_TARGET_CLASS_INSTRUCTION, n);
+    }
+
     final RiType targetClass;
-    public Value targetClassInstruction;
-    Value object;
 
     /**
      * Creates a new TypeCheck instruction.
@@ -43,20 +78,15 @@
      * @param object the instruction which produces the object
      * @param kind the result type of this instruction
      * @param stateBefore the state before this instruction is executed
+     * @param inputCount
+     * @param successorCount
+     * @param graph
      */
-    public TypeCheck(RiType targetClass, Value targetClassInstruction, Value object, CiKind kind, FrameState stateBefore) {
-        super(kind, stateBefore);
+    public TypeCheck(RiType targetClass, Value targetClassInstruction, Value object, CiKind kind, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
+        super(kind, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         this.targetClass = targetClass;
-        this.targetClassInstruction = targetClassInstruction;
-        this.object = object;
-    }
-
-    /**
-     * Gets the instruction that loads the target class object that is used by this checkcast.
-     * @return the target class instruction
-     */
-    public Value targetClassInstruction() {
-        return targetClassInstruction;
+        setObject(object);
+        setTargetClassInstruction(targetClassInstruction);
     }
 
     /**
@@ -68,14 +98,6 @@
     }
 
     /**
-     * Gets the instruction which produces the object input.
-     * @return the instruction producing the object
-     */
-    public Value object() {
-        return object;
-    }
-
-    /**
      * Checks whether the target class of this instruction is loaded.
      * @return {@code true} if the target class is loaded
      */
@@ -83,13 +105,4 @@
         return targetClass != null;
     }
 
-    /**
-     * Iterates over the input values to this instruction.
-     * @param closure the closure to apply
-     */
-    @Override
-    public void inputValuesDo(ValueClosure closure) {
-        object = closure.apply(object);
-        targetClassInstruction = closure.apply(targetClassInstruction);
-    }
 }