Search in sources :

Example 1 with GetObjectAddressNode

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

the class ArrayCopyCallNode method computeBase.

private ValueNode computeBase(ValueNode base, ValueNode pos) {
    FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
    graph().addBeforeFixed(this, basePtr);
    Stamp wordStamp = StampFactory.forKind(runtime.getTarget().wordJavaKind);
    ValueNode wordPos = IntegerConvertNode.convert(pos, wordStamp, graph(), NodeView.DEFAULT);
    int shift = CodeUtil.log2(getArrayIndexScale(elementKind));
    ValueNode scaledIndex = graph().unique(new LeftShiftNode(wordPos, ConstantNode.forInt(shift, graph())));
    ValueNode offset = graph().unique(new AddNode(scaledIndex, ConstantNode.forIntegerStamp(wordStamp, 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.hotspot.nodes.GetObjectAddressNode) AbstractMemoryCheckpoint(org.graalvm.compiler.nodes.memory.AbstractMemoryCheckpoint) MemoryCheckpoint(org.graalvm.compiler.nodes.memory.MemoryCheckpoint)

Example 2 with GetObjectAddressNode

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

the class CheckcastArrayCopyCallNode method computeBase.

private ValueNode computeBase(ValueNode base, ValueNode pos) {
    FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
    graph().addBeforeFixed(this, basePtr);
    int shift = CodeUtil.log2(getArrayIndexScale(JavaKind.Object));
    ValueNode extendedPos = IntegerConvertNode.convert(pos, StampFactory.forKind(runtime.getTarget().wordJavaKind), 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)), 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.hotspot.nodes.GetObjectAddressNode) AbstractMemoryCheckpoint(org.graalvm.compiler.nodes.memory.AbstractMemoryCheckpoint) MemoryCheckpoint(org.graalvm.compiler.nodes.memory.MemoryCheckpoint)

Example 3 with GetObjectAddressNode

use of org.graalvm.compiler.hotspot.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.hotspot.nodes.GetObjectAddressNode)

Example 4 with GetObjectAddressNode

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

the class DefaultHotSpotLoweringProvider method lowerComputeObjectAddressNode.

private static void lowerComputeObjectAddressNode(ComputeObjectAddressNode n) {
    /*
         * Lower the node into a ComputeObjectAddress node and an Add but ensure that it's below any
         * potential safepoints and above it's uses.
         */
    for (Node use : n.usages().snapshot()) {
        if (use instanceof FixedNode) {
            FixedNode fixed = (FixedNode) use;
            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);
        } else {
            throw GraalError.shouldNotReachHere("Unexpected floating use of ComputeObjectAddressNode " + n);
        }
    }
    GraphUtil.unlinkFixedNode(n);
    n.safeDelete();
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) RawLoadNode(org.graalvm.compiler.nodes.extended.RawLoadNode) GetObjectAddressNode(org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode) MonitorIdNode(org.graalvm.compiler.nodes.java.MonitorIdNode) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) OSRLocalNode(org.graalvm.compiler.nodes.extended.OSRLocalNode) RawMonitorEnterNode(org.graalvm.compiler.nodes.java.RawMonitorEnterNode) AbstractDeoptimizeNode(org.graalvm.compiler.nodes.AbstractDeoptimizeNode) StringToBytesNode(org.graalvm.compiler.nodes.debug.StringToBytesNode) DynamicNewArrayNode(org.graalvm.compiler.nodes.java.DynamicNewArrayNode) LoadExceptionObjectNode(org.graalvm.compiler.nodes.java.LoadExceptionObjectNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) LoadMethodNode(org.graalvm.compiler.nodes.extended.LoadMethodNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) BeginLockScopeNode(org.graalvm.compiler.hotspot.nodes.BeginLockScopeNode) InitializeKlassNode(org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode) IdentityHashCodeNode(org.graalvm.compiler.hotspot.replacements.IdentityHashCodeNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) ResolveMethodAndLoadCountersNode(org.graalvm.compiler.hotspot.nodes.aot.ResolveMethodAndLoadCountersNode) OSRStartNode(org.graalvm.compiler.nodes.extended.OSRStartNode) HotSpotDirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode) SafepointNode(org.graalvm.compiler.nodes.SafepointNode) VerifyHeapNode(org.graalvm.compiler.nodes.debug.VerifyHeapNode) ForeignCallNode(org.graalvm.compiler.nodes.extended.ForeignCallNode) NewInstanceNode(org.graalvm.compiler.nodes.java.NewInstanceNode) DynamicNewInstanceNode(org.graalvm.compiler.nodes.java.DynamicNewInstanceNode) ArrayCopyWithSlowPathNode(org.graalvm.compiler.hotspot.replacements.arraycopy.ArrayCopyWithSlowPathNode) KlassLayoutHelperNode(org.graalvm.compiler.hotspot.replacements.KlassLayoutHelperNode) ClassGetHubNode(org.graalvm.compiler.hotspot.replacements.ClassGetHubNode) HotSpotCompressionNode(org.graalvm.compiler.hotspot.nodes.HotSpotCompressionNode) OSRLockNode(org.graalvm.compiler.nodes.extended.OSRLockNode) AssertionNode(org.graalvm.compiler.replacements.nodes.AssertionNode) IntegerDivRemNode(org.graalvm.compiler.nodes.calc.IntegerDivRemNode) NewMultiArrayNode(org.graalvm.compiler.nodes.java.NewMultiArrayNode) ResolveDynamicConstantNode(org.graalvm.compiler.hotspot.nodes.aot.ResolveDynamicConstantNode) ProfileNode(org.graalvm.compiler.hotspot.nodes.profiling.ProfileNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) LogicNode(org.graalvm.compiler.nodes.LogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) HotSpotIndirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotIndirectCallTargetNode) ArrayCopyNode(org.graalvm.compiler.hotspot.replacements.arraycopy.ArrayCopyNode) HubGetClassNode(org.graalvm.compiler.hotspot.replacements.HubGetClassNode) OSRMonitorEnterNode(org.graalvm.compiler.nodes.extended.OSRMonitorEnterNode) MonitorExitNode(org.graalvm.compiler.nodes.java.MonitorExitNode) IsNullNode(org.graalvm.compiler.nodes.calc.IsNullNode) StoreHubNode(org.graalvm.compiler.nodes.extended.StoreHubNode) NewArrayNode(org.graalvm.compiler.nodes.java.NewArrayNode) ResolveConstantNode(org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode) FloatingNode(org.graalvm.compiler.nodes.calc.FloatingNode) StartNode(org.graalvm.compiler.nodes.StartNode) RemNode(org.graalvm.compiler.nodes.calc.RemNode) ClassIsAssignableFromNode(org.graalvm.compiler.nodes.java.ClassIsAssignableFromNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) InstanceOfDynamicNode(org.graalvm.compiler.nodes.java.InstanceOfDynamicNode) AddNode(org.graalvm.compiler.nodes.calc.AddNode) LoadHubNode(org.graalvm.compiler.nodes.extended.LoadHubNode) ComputeObjectAddressNode(org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode) InstanceOfNode(org.graalvm.compiler.nodes.java.InstanceOfNode) LoweredCallTargetNode(org.graalvm.compiler.nodes.LoweredCallTargetNode) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) GuardedUnsafeLoadNode(org.graalvm.compiler.nodes.extended.GuardedUnsafeLoadNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) UnwindNode(org.graalvm.compiler.nodes.UnwindNode) GetClassNode(org.graalvm.compiler.nodes.extended.GetClassNode) BytecodeExceptionNode(org.graalvm.compiler.nodes.extended.BytecodeExceptionNode) Node(org.graalvm.compiler.graph.Node) FixedNode(org.graalvm.compiler.nodes.FixedNode) AddNode(org.graalvm.compiler.nodes.calc.AddNode) GetObjectAddressNode(org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode)

Aggregations

GetObjectAddressNode (org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode)4 ValueNode (org.graalvm.compiler.nodes.ValueNode)3 AddNode (org.graalvm.compiler.nodes.calc.AddNode)3 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)2 LeftShiftNode (org.graalvm.compiler.nodes.calc.LeftShiftNode)2 Stamp (org.graalvm.compiler.core.common.type.Stamp)1 Node (org.graalvm.compiler.graph.Node)1 BeginLockScopeNode (org.graalvm.compiler.hotspot.nodes.BeginLockScopeNode)1 ComputeObjectAddressNode (org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode)1 HotSpotCompressionNode (org.graalvm.compiler.hotspot.nodes.HotSpotCompressionNode)1 HotSpotDirectCallTargetNode (org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode)1 HotSpotIndirectCallTargetNode (org.graalvm.compiler.hotspot.nodes.HotSpotIndirectCallTargetNode)1 InitializeKlassNode (org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode)1 ResolveConstantNode (org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode)1 ResolveDynamicConstantNode (org.graalvm.compiler.hotspot.nodes.aot.ResolveDynamicConstantNode)1 ResolveMethodAndLoadCountersNode (org.graalvm.compiler.hotspot.nodes.aot.ResolveMethodAndLoadCountersNode)1 ProfileNode (org.graalvm.compiler.hotspot.nodes.profiling.ProfileNode)1 ClassGetHubNode (org.graalvm.compiler.hotspot.replacements.ClassGetHubNode)1 HubGetClassNode (org.graalvm.compiler.hotspot.replacements.HubGetClassNode)1 IdentityHashCodeNode (org.graalvm.compiler.hotspot.replacements.IdentityHashCodeNode)1