< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java

Print this page




  72     public ValueNode value() {
  73         return value;
  74     }
  75 
  76     public StoreIndexedNode(ValueNode array, ValueNode index, JavaKind elementKind, ValueNode value) {
  77         super(TYPE, StampFactory.forVoid(), array, index, elementKind);
  78         this.value = value;
  79     }
  80 
  81     @Override
  82     public void virtualize(VirtualizerTool tool) {
  83         ValueNode alias = tool.getAlias(array());
  84         if (alias instanceof VirtualObjectNode) {
  85             ValueNode indexValue = tool.getAlias(index());
  86             int idx = indexValue.isConstant() ? indexValue.asJavaConstant().asInt() : -1;
  87             VirtualArrayNode virtual = (VirtualArrayNode) alias;
  88             if (idx >= 0 && idx < virtual.entryCount()) {
  89                 ResolvedJavaType componentType = virtual.type().getComponentType();
  90                 if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null ||
  91                                 (StampTool.typeReferenceOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) {
  92                     tool.setVirtualEntry(virtual, idx, value(), false);
  93                     tool.delete();
  94                 }
  95             }
  96         }
  97     }
  98 
  99     public FrameState getState() {
 100         return stateAfter;
 101     }
 102 }


  72     public ValueNode value() {
  73         return value;
  74     }
  75 
  76     public StoreIndexedNode(ValueNode array, ValueNode index, JavaKind elementKind, ValueNode value) {
  77         super(TYPE, StampFactory.forVoid(), array, index, elementKind);
  78         this.value = value;
  79     }
  80 
  81     @Override
  82     public void virtualize(VirtualizerTool tool) {
  83         ValueNode alias = tool.getAlias(array());
  84         if (alias instanceof VirtualObjectNode) {
  85             ValueNode indexValue = tool.getAlias(index());
  86             int idx = indexValue.isConstant() ? indexValue.asJavaConstant().asInt() : -1;
  87             VirtualArrayNode virtual = (VirtualArrayNode) alias;
  88             if (idx >= 0 && idx < virtual.entryCount()) {
  89                 ResolvedJavaType componentType = virtual.type().getComponentType();
  90                 if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null ||
  91                                 (StampTool.typeReferenceOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) {
  92                     tool.setVirtualEntry(virtual, idx, value());
  93                     tool.delete();
  94                 }
  95             }
  96         }
  97     }
  98 
  99     public FrameState getState() {
 100         return stateAfter;
 101     }
 102 }
< prev index next >