Search in sources :

Example 1 with GetObjectAddressNode

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

the class GenericArrayCopyCallNode method objectAddress.

private ValueNode objectAddress(ValueNode obj) {
    GetObjectAddressNode result = graph().add(new GetObjectAddressNode(obj));
    graph().addBeforeFixed(this, result);
    return result;
}
Also used : GetObjectAddressNode(org.graalvm.compiler.nodes.GetObjectAddressNode)

Example 2 with GetObjectAddressNode

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

the class CheckcastArrayCopyCallNode method computeBase.

private ValueNode computeBase(LoweringTool tool, ValueNode base, ValueNode pos) {
    FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
    graph().addBeforeFixed(this, basePtr);
    int shift = CodeUtil.log2(tool.getMetaAccess().getArrayIndexScale(JavaKind.Object));
    ValueNode extendedPos = IntegerConvertNode.convert(pos, StampFactory.forKind(wordKind), graph(), NodeView.DEFAULT);
    ValueNode scaledIndex = graph().unique(new LeftShiftNode(extendedPos, ConstantNode.forInt(shift, graph())));
    ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forIntegerBits(PrimitiveStamp.getBits(scaledIndex.stamp(NodeView.DEFAULT)), tool.getMetaAccess().getArrayBaseOffset(JavaKind.Object), graph())));
    return graph().unique(new OffsetAddressNode(basePtr, offset));
}
Also used : FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) LeftShiftNode(org.graalvm.compiler.nodes.calc.LeftShiftNode) AddNode(org.graalvm.compiler.nodes.calc.AddNode) GetObjectAddressNode(org.graalvm.compiler.nodes.GetObjectAddressNode) AbstractMemoryCheckpoint(org.graalvm.compiler.nodes.memory.AbstractMemoryCheckpoint)

Example 3 with GetObjectAddressNode

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

the class DefaultJavaLoweringProvider method lowerComputeObjectAddressNode.

private static void lowerComputeObjectAddressNode(ComputeObjectAddressNode n) {
    /*
         * Lower the node into a GetObjectAddressNode node and an Add but ensure that it's below any
         * potential safepoints and above it's uses.
         */
    for (Node use : n.usages().snapshot()) {
        FixedNode fixed;
        if (use instanceof FixedNode) {
            fixed = (FixedNode) use;
        } else if (use instanceof ValuePhiNode) {
            ValuePhiNode phi = (ValuePhiNode) use;
            int inputPosition = 0;
            while (inputPosition < phi.valueCount()) {
                if (phi.valueAt(inputPosition) == n) {
                    break;
                }
                inputPosition++;
            }
            GraalError.guarantee(inputPosition < phi.valueCount(), "Failed to find expected input");
            fixed = phi.merge().phiPredecessorAt(inputPosition);
        } else {
            throw GraalError.shouldNotReachHere("Unexpected floating use of ComputeObjectAddressNode " + n);
        }
        StructuredGraph graph = n.graph();
        GetObjectAddressNode address = graph.add(new GetObjectAddressNode(n.getObject()));
        graph.addBeforeFixed(fixed, address);
        AddNode add = graph.addOrUnique(new AddNode(address, n.getOffset()));
        use.replaceFirstInput(n, add);
    }
    GraphUtil.unlinkFixedNode(n);
    n.safeDelete();
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) RawLoadNode(org.graalvm.compiler.nodes.extended.RawLoadNode) LoweredAtomicReadAndAddNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndAddNode) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) GetObjectAddressNode(org.graalvm.compiler.nodes.GetObjectAddressNode) MonitorIdNode(org.graalvm.compiler.nodes.java.MonitorIdNode) ZeroExtendNode(org.graalvm.compiler.nodes.calc.ZeroExtendNode) RegisterFinalizerNode(org.graalvm.compiler.nodes.java.RegisterFinalizerNode) IndexAddressNode(org.graalvm.compiler.nodes.memory.address.IndexAddressNode) OrderedReadNode(org.graalvm.compiler.nodes.memory.OrderedReadNode) OrderedWriteNode(org.graalvm.compiler.nodes.memory.OrderedWriteNode) LoadHubOrNullNode(org.graalvm.compiler.nodes.extended.LoadHubOrNullNode) GuardingNode(org.graalvm.compiler.nodes.extended.GuardingNode) LeftShiftNode(org.graalvm.compiler.nodes.calc.LeftShiftNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) UnsafeMemoryStoreNode(org.graalvm.compiler.nodes.extended.UnsafeMemoryStoreNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) IntegerConvertNode(org.graalvm.compiler.nodes.calc.IntegerConvertNode) IntegerEqualsNode(org.graalvm.compiler.nodes.calc.IntegerEqualsNode) AtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode) MergeNode(org.graalvm.compiler.nodes.MergeNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) AbstractNewObjectNode(org.graalvm.compiler.nodes.java.AbstractNewObjectNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) IntegerBelowNode(org.graalvm.compiler.nodes.calc.IntegerBelowNode) ComputeObjectAddressNode(org.graalvm.compiler.nodes.ComputeObjectAddressNode) VirtualInstanceNode(org.graalvm.compiler.nodes.virtual.VirtualInstanceNode) VerifyHeapNode(org.graalvm.compiler.nodes.debug.VerifyHeapNode) ForeignCallNode(org.graalvm.compiler.nodes.extended.ForeignCallNode) NewInstanceNode(org.graalvm.compiler.nodes.java.NewInstanceNode) PhiNode(org.graalvm.compiler.nodes.PhiNode) LoadArrayComponentHubNode(org.graalvm.compiler.nodes.extended.LoadArrayComponentHubNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) NarrowNode(org.graalvm.compiler.nodes.calc.NarrowNode) AtomicReadAndAddNode(org.graalvm.compiler.nodes.java.AtomicReadAndAddNode) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode) ClassIsArrayNode(org.graalvm.compiler.nodes.extended.ClassIsArrayNode) JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) LoadIndexedNode(org.graalvm.compiler.nodes.java.LoadIndexedNode) BoxNode(org.graalvm.compiler.nodes.extended.BoxNode) BinaryMathIntrinsicNode(org.graalvm.compiler.replacements.nodes.BinaryMathIntrinsicNode) IfNode(org.graalvm.compiler.nodes.IfNode) VirtualObjectNode(org.graalvm.compiler.nodes.virtual.VirtualObjectNode) RawStoreNode(org.graalvm.compiler.nodes.extended.RawStoreNode) PiNode(org.graalvm.compiler.nodes.PiNode) LogicNode(org.graalvm.compiler.nodes.LogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) IsNullNode(org.graalvm.compiler.nodes.calc.IsNullNode) ObjectIsArrayNode(org.graalvm.compiler.nodes.extended.ObjectIsArrayNode) NewArrayNode(org.graalvm.compiler.nodes.java.NewArrayNode) VirtualArrayNode(org.graalvm.compiler.nodes.virtual.VirtualArrayNode) LogicCompareAndSwapNode(org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode) UnsafeCompareAndSwapNode(org.graalvm.compiler.nodes.java.UnsafeCompareAndSwapNode) LoadFieldNode(org.graalvm.compiler.nodes.java.LoadFieldNode) BranchProbabilityNode(org.graalvm.compiler.nodes.extended.BranchProbabilityNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) ReinterpretNode(org.graalvm.compiler.nodes.calc.ReinterpretNode) AllocatedObjectNode(org.graalvm.compiler.nodes.virtual.AllocatedObjectNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) InstanceOfDynamicNode(org.graalvm.compiler.nodes.java.InstanceOfDynamicNode) UnsafeCompareAndExchangeNode(org.graalvm.compiler.nodes.java.UnsafeCompareAndExchangeNode) AddNode(org.graalvm.compiler.nodes.calc.AddNode) LoadHubNode(org.graalvm.compiler.nodes.extended.LoadHubNode) InstanceOfNode(org.graalvm.compiler.nodes.java.InstanceOfNode) IdentityHashCodeNode(org.graalvm.compiler.replacements.nodes.IdentityHashCodeNode) RightShiftNode(org.graalvm.compiler.nodes.calc.RightShiftNode) AccessIndexedNode(org.graalvm.compiler.nodes.java.AccessIndexedNode) ValueCompareAndSwapNode(org.graalvm.compiler.nodes.java.ValueCompareAndSwapNode) ConditionalNode(org.graalvm.compiler.nodes.calc.ConditionalNode) GuardedUnsafeLoadNode(org.graalvm.compiler.nodes.extended.GuardedUnsafeLoadNode) UnsafeMemoryLoadNode(org.graalvm.compiler.nodes.extended.UnsafeMemoryLoadNode) UnpackEndianHalfNode(org.graalvm.compiler.nodes.calc.UnpackEndianHalfNode) UnaryMathIntrinsicNode(org.graalvm.compiler.replacements.nodes.UnaryMathIntrinsicNode) StoreIndexedNode(org.graalvm.compiler.nodes.java.StoreIndexedNode) SubNode(org.graalvm.compiler.nodes.calc.SubNode) CommitAllocationNode(org.graalvm.compiler.nodes.virtual.CommitAllocationNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) FixedValueAnchorNode(org.graalvm.compiler.nodes.extended.FixedValueAnchorNode) ArrayLengthNode(org.graalvm.compiler.nodes.java.ArrayLengthNode) MembarNode(org.graalvm.compiler.nodes.extended.MembarNode) MonitorEnterNode(org.graalvm.compiler.nodes.java.MonitorEnterNode) StoreFieldNode(org.graalvm.compiler.nodes.java.StoreFieldNode) Node(org.graalvm.compiler.graph.Node) EndNode(org.graalvm.compiler.nodes.EndNode) UnboxNode(org.graalvm.compiler.nodes.extended.UnboxNode) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) LoweredAtomicReadAndAddNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndAddNode) AtomicReadAndAddNode(org.graalvm.compiler.nodes.java.AtomicReadAndAddNode) AddNode(org.graalvm.compiler.nodes.calc.AddNode) GetObjectAddressNode(org.graalvm.compiler.nodes.GetObjectAddressNode)

Example 4 with GetObjectAddressNode

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

the class ArrayCopyCallNode method computeBase.

private ValueNode computeBase(LoweringTool tool, ValueNode base, ValueNode pos) {
    FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
    graph().addBeforeFixed(this, basePtr);
    Stamp wordStamp = StampFactory.forKind(wordJavaKind);
    ValueNode wordPos = IntegerConvertNode.convert(pos, wordStamp, graph(), NodeView.DEFAULT);
    int shift = CodeUtil.log2(tool.getMetaAccess().getArrayIndexScale(elementKind));
    ValueNode scaledIndex = graph().unique(new LeftShiftNode(wordPos, ConstantNode.forInt(shift, graph())));
    ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forIntegerStamp(wordStamp, tool.getMetaAccess().getArrayBaseOffset(elementKind), graph())));
    return graph().unique(new OffsetAddressNode(basePtr, offset));
}
Also used : FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) Stamp(org.graalvm.compiler.core.common.type.Stamp) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) LeftShiftNode(org.graalvm.compiler.nodes.calc.LeftShiftNode) AddNode(org.graalvm.compiler.nodes.calc.AddNode) GetObjectAddressNode(org.graalvm.compiler.nodes.GetObjectAddressNode) AbstractMemoryCheckpoint(org.graalvm.compiler.nodes.memory.AbstractMemoryCheckpoint)

Aggregations

GetObjectAddressNode (org.graalvm.compiler.nodes.GetObjectAddressNode)4 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)3 ValueNode (org.graalvm.compiler.nodes.ValueNode)3 AddNode (org.graalvm.compiler.nodes.calc.AddNode)3 LeftShiftNode (org.graalvm.compiler.nodes.calc.LeftShiftNode)3 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)3 AbstractMemoryCheckpoint (org.graalvm.compiler.nodes.memory.AbstractMemoryCheckpoint)2 Stamp (org.graalvm.compiler.core.common.type.Stamp)1 Node (org.graalvm.compiler.graph.Node)1 ComputeObjectAddressNode (org.graalvm.compiler.nodes.ComputeObjectAddressNode)1 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)1 EndNode (org.graalvm.compiler.nodes.EndNode)1 FixedNode (org.graalvm.compiler.nodes.FixedNode)1 IfNode (org.graalvm.compiler.nodes.IfNode)1 LogicNode (org.graalvm.compiler.nodes.LogicNode)1 MergeNode (org.graalvm.compiler.nodes.MergeNode)1 PhiNode (org.graalvm.compiler.nodes.PhiNode)1 PiNode (org.graalvm.compiler.nodes.PiNode)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 ValuePhiNode (org.graalvm.compiler.nodes.ValuePhiNode)1