Search in sources :

Example 6 with VirtualArrayNode

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();
            }
        }
    }
}
Also used : VirtualObjectNode(org.graalvm.compiler.nodes.virtual.VirtualObjectNode) VirtualArrayNode(org.graalvm.compiler.nodes.virtual.VirtualArrayNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType)

Aggregations

ValueNode (org.graalvm.compiler.nodes.ValueNode)6 VirtualArrayNode (org.graalvm.compiler.nodes.virtual.VirtualArrayNode)6 VirtualObjectNode (org.graalvm.compiler.nodes.virtual.VirtualObjectNode)5 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)2 LoadIndexedNode (org.graalvm.compiler.nodes.java.LoadIndexedNode)2 ArrayList (java.util.ArrayList)1 BitSet (java.util.BitSet)1 JavaKind (jdk.vm.ci.meta.JavaKind)1 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)1 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)1 AbstractNewObjectNode (org.graalvm.compiler.nodes.java.AbstractNewObjectNode)1 AtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode)1 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)1 AbstractMemoryCheckpoint (org.graalvm.compiler.nodes.memory.AbstractMemoryCheckpoint)1 BarrierType (org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType)1 MemoryCheckpoint (org.graalvm.compiler.nodes.memory.MemoryCheckpoint)1 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)1