changeset 17325:cd3d56423261

ValuePosition: restrict access.
author Josef Eisl <josef.eisl@jku.at>
date Fri, 03 Oct 2014 13:29:52 +0200
parents 012277a579ca
children 0b8483cd42c0
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValuePosition.java
diffstat 1 files changed, 13 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }