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;
}
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));
}
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();
}
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));
}
Aggregations