# HG changeset patch # User Josef Eisl # Date 1413386017 -7200 # Node ID a9dc2307146f56e409433e6c4a20517130d3e935 # Parent 6388d789b1d03bc8bad5b88419a0383d5c83fa70 ValuePosition: refactor get(LIRInstruction). diff -r 6388d789b1d0 -r a9dc2307146f 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 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); diff -r 6388d789b1d0 -r a9dc2307146f 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 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); diff -r 6388d789b1d0 -r a9dc2307146f 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 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]; } /**