Search in sources :

Example 6 with VirtualInstanceNode

use of org.graalvm.compiler.nodes.virtual.VirtualInstanceNode in project graal by oracle.

the class NewInstanceNode method virtualize.

@Override
public void virtualize(VirtualizerTool tool) {
    /*
         * Reference objects can escape into their ReferenceQueue at any safepoint, therefore
         * they're excluded from escape analysis.
         */
    if (!tool.getMetaAccessProvider().lookupJavaType(Reference.class).isAssignableFrom(instanceClass)) {
        VirtualInstanceNode virtualObject = createVirtualInstanceNode(true);
        ResolvedJavaField[] fields = virtualObject.getFields();
        ValueNode[] state = new ValueNode[fields.length];
        for (int i = 0; i < state.length; i++) {
            state[i] = defaultFieldValue(fields[i]);
        }
        tool.createVirtualObject(virtualObject, state, Collections.<MonitorIdNode>emptyList(), false);
        tool.replaceWithVirtual(virtualObject);
    }
}
Also used : ValueNode(org.graalvm.compiler.nodes.ValueNode) VirtualInstanceNode(org.graalvm.compiler.nodes.virtual.VirtualInstanceNode) ResolvedJavaField(jdk.vm.ci.meta.ResolvedJavaField)

Aggregations

VirtualInstanceNode (org.graalvm.compiler.nodes.virtual.VirtualInstanceNode)6 ValueNode (org.graalvm.compiler.nodes.ValueNode)5 VirtualObjectNode (org.graalvm.compiler.nodes.virtual.VirtualObjectNode)4 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)3 JavaKind (jdk.vm.ci.meta.JavaKind)2 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)2 ArrayList (java.util.ArrayList)1 BitSet (java.util.BitSet)1 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)1 InlineInfo (org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo)1 InlineInfo.createStandardInlineInfo (org.graalvm.compiler.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo.createStandardInlineInfo)1 AbstractNewObjectNode (org.graalvm.compiler.nodes.java.AbstractNewObjectNode)1 AtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode)1 LoadFieldNode (org.graalvm.compiler.nodes.java.LoadFieldNode)1 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)1 MethodCallTargetNode (org.graalvm.compiler.nodes.java.MethodCallTargetNode)1 BarrierType (org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType)1 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)1