src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/util/IndexedValueMap.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/util

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/util/IndexedValueMap.java

Print this page




  32 import org.graalvm.compiler.lir.LIRInstruction.OperandMode;
  33 
  34 import jdk.vm.ci.meta.Value;
  35 
  36 public final class IndexedValueMap {
  37     private Value[] values;
  38 
  39     public IndexedValueMap() {
  40         values = Value.NO_VALUES;
  41     }
  42 
  43     public IndexedValueMap(IndexedValueMap other) {
  44         int limit = other.values.length;
  45         while (limit > 0) {
  46             if (other.values[limit - 1] == null) {
  47                 limit--;
  48                 continue;
  49             }
  50             break;
  51         }



  52         values = new Value[limit];
  53         System.arraycopy(other.values, 0, values, 0, values.length);
  54     }

  55 
  56     public Value get(int index) {
  57         return values[index];
  58     }
  59 
  60     public void put(int index, Value value) {
  61         if (values.length <= index) {
  62             if (value == null) {
  63                 return;
  64             }
  65             Value[] newValues = new Value[index + 1];

  66             System.arraycopy(values, 0, newValues, 0, values.length);

  67             values = newValues;
  68             values[index] = value;
  69         } else {
  70             values[index] = value;
  71         }
  72     }
  73 
  74     public void putAll(IndexedValueMap stack) {
  75         Value[] otherValues = stack.values;
  76         int limit = otherValues.length;
  77         if (limit > values.length) {
  78             while (limit > 0) {
  79                 if (otherValues[limit - 1] == null) {
  80                     limit--;
  81                     continue;
  82                 }
  83                 break;
  84             }
  85             if (limit > values.length) {
  86                 Value[] newValues = new Value[limit];




  32 import org.graalvm.compiler.lir.LIRInstruction.OperandMode;
  33 
  34 import jdk.vm.ci.meta.Value;
  35 
  36 public final class IndexedValueMap {
  37     private Value[] values;
  38 
  39     public IndexedValueMap() {
  40         values = Value.NO_VALUES;
  41     }
  42 
  43     public IndexedValueMap(IndexedValueMap other) {
  44         int limit = other.values.length;
  45         while (limit > 0) {
  46             if (other.values[limit - 1] == null) {
  47                 limit--;
  48                 continue;
  49             }
  50             break;
  51         }
  52         if (limit == 0) {
  53             values = Value.NO_VALUES;
  54         } else {
  55             values = new Value[limit];
  56             System.arraycopy(other.values, 0, values, 0, values.length);
  57         }
  58     }
  59 
  60     public Value get(int index) {
  61         return values[index];
  62     }
  63 
  64     public void put(int index, Value value) {
  65         if (values.length <= index) {
  66             if (value == null) {
  67                 return;
  68             }
  69             Value[] newValues = new Value[index + 1];
  70             if (values.length > 0) {
  71                 System.arraycopy(values, 0, newValues, 0, values.length);
  72             }
  73             values = newValues;
  74             values[index] = value;
  75         } else {
  76             values[index] = value;
  77         }
  78     }
  79 
  80     public void putAll(IndexedValueMap stack) {
  81         Value[] otherValues = stack.values;
  82         int limit = otherValues.length;
  83         if (limit > values.length) {
  84             while (limit > 0) {
  85                 if (otherValues[limit - 1] == null) {
  86                     limit--;
  87                     continue;
  88                 }
  89                 break;
  90             }
  91             if (limit > values.length) {
  92                 Value[] newValues = new Value[limit];


src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/util/IndexedValueMap.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File