Search in sources :

Example 1 with SubstrateVirtualArrayNode

use of com.oracle.svm.core.graal.nodes.SubstrateVirtualArrayNode in project graal by oracle.

the class SubstrateArraysCopyOfNode method virtualize.

@Override
public void virtualize(VirtualizerTool tool) {
    if (!newArrayType.isConstant()) {
        /*
             * This is an object array copy. If the new array type is not a constant then it cannot
             * be vitualized.
             */
        return;
    }
    /* from index is always 0 for Arrays.copyOf. */
    ValueNode from = ConstantNode.forInt(0);
    ResolvedJavaType newComponentType = tool.getConstantReflectionProvider().asJavaType(newArrayType.asConstant()).getComponentType();
    GraphUtil.virtualizeArrayCopy(tool, original, originalLength, newLength, from, newComponentType, JavaKind.Object, graph(), (componentType, length) -> new SubstrateVirtualArrayNode(componentType, length));
}
Also used : SubstrateVirtualArrayNode(com.oracle.svm.core.graal.nodes.SubstrateVirtualArrayNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType)

Aggregations

SubstrateVirtualArrayNode (com.oracle.svm.core.graal.nodes.SubstrateVirtualArrayNode)1 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1