# HG changeset patch # User Josef Eisl # Date 1412335792 -7200 # Node ID cd3d5642326126f3b0702b60e1cf410b45805111 # Parent 012277a579ca90cbf3587fd0561d306fb775d07b ValuePosition: restrict access. diff -r 012277a579ca -r cd3d56423261 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 Fri Oct 03 13:29:32 2014 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java Fri Oct 03 13:29:52 2014 +0200 @@ -41,7 +41,7 @@ public static final int NO_SUBINDEX = -1; public static final ValuePosition ROOT_VALUE_POSITION = null; - public ValuePosition(Values values, int index, int subIndex, ValuePosition outerPosition) { + ValuePosition(Values values, int index, int subIndex, ValuePosition outerPosition) { this.values = values; this.index = index; this.subIndex = subIndex; @@ -52,12 +52,15 @@ return outerPosition != ROOT_VALUE_POSITION; } - public Value get(Object inst) { + public Value get(LIRInstruction inst) { if (isCompositePosition()) { CompositeValue compValue = (CompositeValue) outerPosition.get(inst); return compValue.getValueClass().getValue(compValue, this); } - return getValue(inst); + if (index < values.getDirectCount()) { + return values.getValue(inst, index); + } + return values.getValueArray(inst, index)[subIndex]; } public void set(LIRInstruction inst, Value value) { @@ -66,15 +69,19 @@ CompositeValue newCompValue = compValue.getValueClass().createUpdatedValue(compValue, this, value); outerPosition.set(inst, newCompValue); } else { - setValue(inst, value); + if (index < values.getDirectCount()) { + values.setValue(inst, index, value); + } else { + values.getValueArray(inst, index)[subIndex] = value; + } } } - public int getSubIndex() { + int getSubIndex() { return subIndex; } - public int getIndex() { + int getIndex() { return index; } @@ -82,21 +89,6 @@ return values.getFlags(index); } - public Value getValue(Object obj) { - if (index < values.getDirectCount()) { - return values.getValue(obj, index); - } - return values.getValueArray(obj, index)[subIndex]; - } - - public void setValue(Object obj, Value value) { - if (index < values.getDirectCount()) { - values.setValue(obj, index, value); - } else { - values.getValueArray(obj, index)[subIndex] = value; - } - } - public ValuePosition getSuperPosition() { return outerPosition; }