# HG changeset patch # User Josef Eisl # Date 1413386699 -7200 # Node ID ad52f96395bba4a87fa1194041e4fc1330f2ce41 # Parent a9dc2307146f56e409433e6c4a20517130d3e935 ValuePosition: refactor set(LIRInstruction, Value). diff -r a9dc2307146f -r ad52f96395bb graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java --- 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 getFlags(ValuePosition pos) { return values.getFlags(pos.getIndex()); } diff -r a9dc2307146f -r ad52f96395bb graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java --- 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) { diff -r a9dc2307146f -r ad52f96395bb graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java --- 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; } }