changeset 17602:ad52f96395bb

ValuePosition: refactor set(LIRInstruction, Value).
author Josef Eisl <josef.eisl@jku.at>
date Wed, 15 Oct 2014 17:24:59 +0200
parents a9dc2307146f
children a2ad508b8723
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, 7 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Wed Oct 15 17:13:37 2014 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Wed Oct 15 17:24:59 2014 +0200
@@ -121,12 +121,6 @@
         return result.toString();
     }
 
-    CompositeValue createUpdatedValue(CompositeValue compValue, ValuePosition pos, Value value) {
-        CompositeValue newCompValue = compValue.clone();
-        setValueForPosition(newCompValue, values, pos, value);
-        return newCompValue;
-    }
-
     EnumSet<OperandFlag> getFlags(ValuePosition pos) {
         return values.getFlags(pos.getIndex());
     }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Wed Oct 15 17:13:37 2014 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Wed Oct 15 17:24:59 2014 +0200
@@ -311,14 +311,6 @@
         }
     }
 
-    protected static void setValueForPosition(Object obj, Values values, ValuePosition pos, Value value) {
-        if (pos.getIndex() < values.getDirectCount()) {
-            values.setValue(obj, pos.getIndex(), value);
-        } else {
-            values.getValueArray(obj, pos.getIndex())[pos.getSubIndex()] = value;
-        }
-    }
-
     protected void appendValues(StringBuilder sb, Object obj, String start, String end, String startMultiple, String endMultiple, String[] prefix, Fields... fieldsList) {
         int total = 0;
         for (Fields fields : fieldsList) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java	Wed Oct 15 17:13:37 2014 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java	Wed Oct 15 17:24:59 2014 +0200
@@ -96,16 +96,17 @@
      * @param inst The instruction this {@linkplain ValuePosition position} belongs to.
      */
     public void set(LIRInstruction inst, Value value) {
+        Object obj = inst;
         if (isCompositePosition()) {
             CompositeValue compValue = (CompositeValue) outerPosition.get(inst);
-            CompositeValue newCompValue = compValue.getValueClass().createUpdatedValue(compValue, this, value);
+            CompositeValue newCompValue = compValue.clone();
             outerPosition.set(inst, newCompValue);
+            obj = newCompValue;
+        }
+        if (index < values.getDirectCount()) {
+            values.setValue(obj, index, value);
         } else {
-            if (index < values.getDirectCount()) {
-                values.setValue(inst, index, value);
-            } else {
-                values.getValueArray(inst, index)[subIndex] = value;
-            }
+            values.getValueArray(obj, index)[subIndex] = value;
         }
     }