changeset 17601:a9dc2307146f

ValuePosition: refactor get(LIRInstruction).
author Josef Eisl <josef.eisl@jku.at>
date Wed, 15 Oct 2014 17:13:37 +0200
parents 6388d789b1d0
children ad52f96395bb
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java
diffstat 3 files changed, 5 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Wed Oct 15 19:48:51 2014 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Wed Oct 15 17:13:37 2014 +0200
@@ -121,10 +121,6 @@
         return result.toString();
     }
 
-    Value getValue(CompositeValue obj, ValuePosition pos) {
-        return getValueForPosition(obj, values, pos);
-    }
-
     CompositeValue createUpdatedValue(CompositeValue compValue, ValuePosition pos, Value value) {
         CompositeValue newCompValue = compValue.clone();
         setValueForPosition(newCompValue, values, pos, value);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Wed Oct 15 19:48:51 2014 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Wed Oct 15 17:13:37 2014 +0200
@@ -311,13 +311,6 @@
         }
     }
 
-    protected static Value getValueForPosition(Object obj, Values values, ValuePosition pos) {
-        if (pos.getIndex() < values.getDirectCount()) {
-            return values.getValue(obj, pos.getIndex());
-        }
-        return values.getValueArray(obj, pos.getIndex())[pos.getSubIndex()];
-    }
-
     protected static void setValueForPosition(Object obj, Values values, ValuePosition pos, Value value) {
         if (pos.getIndex() < values.getDirectCount()) {
             values.setValue(obj, pos.getIndex(), value);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java	Wed Oct 15 19:48:51 2014 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java	Wed Oct 15 17:13:37 2014 +0200
@@ -79,14 +79,15 @@
      * @return The value denoted by this {@linkplain ValuePosition position}.
      */
     public Value get(LIRInstruction inst) {
+        Object obj = inst;
         if (isCompositePosition()) {
-            CompositeValue compValue = (CompositeValue) outerPosition.get(inst);
-            return compValue.getValueClass().getValue(compValue, this);
+            obj = outerPosition.get(inst);
+            assert obj instanceof CompositeValue : "The holder of a composite position is not a CompositeValue? " + obj;
         }
         if (index < values.getDirectCount()) {
-            return values.getValue(inst, index);
+            return values.getValue(obj, index);
         }
-        return values.getValueArray(inst, index)[subIndex];
+        return values.getValueArray(obj, index)[subIndex];
     }
 
     /**