use of org.graalvm.compiler.nodes.virtual.VirtualArrayNode in project graal by oracle.
the class StoreIndexedNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(array());
if (alias instanceof VirtualObjectNode) {
ValueNode indexValue = tool.getAlias(index());
int idx = indexValue.isConstant() ? indexValue.asJavaConstant().asInt() : -1;
VirtualArrayNode virtual = (VirtualArrayNode) alias;
if (idx >= 0 && idx < virtual.entryCount()) {
ResolvedJavaType componentType = virtual.type().getComponentType();
if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null || (StampTool.typeReferenceOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) {
tool.setVirtualEntry(virtual, idx, value());
tool.delete();
}
}
}
}
Aggregations