use of org.graalvm.compiler.nodes.extended.JavaWriteNode in project graal by oracle.
the class StoreVMThreadLocalNode method lower.
@Override
public void lower(LoweringTool tool) {
assert threadLocalInfo.offset >= 0;
ConstantNode offset = ConstantNode.forIntegerKind(FrameAccess.getWordKind(), threadLocalInfo.offset, graph());
AddressNode address = graph().unique(new OffsetAddressNode(holder, offset));
AbstractWriteNode write;
if (SubstrateOptions.MultiThreaded.getValue()) {
write = new CInterfaceWriteNode(address, threadLocalInfo.locationIdentity, value, barrierType, threadLocalInfo.name);
} else {
write = new JavaWriteNode(threadLocalInfo.storageKind, address, threadLocalInfo.locationIdentity, value, barrierType, true);
}
write = graph().add(write);
write.setStateAfter(stateAfter());
graph().replaceFixedWithFixed(this, write);
if (!SubstrateOptions.MultiThreaded.getValue()) {
tool.getLowerer().lower(write, tool);
}
}
use of org.graalvm.compiler.nodes.extended.JavaWriteNode in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerJavaWriteNode.
protected void lowerJavaWriteNode(JavaWriteNode write) {
StructuredGraph graph = write.graph();
ValueNode value = implicitStoreConvert(graph, write.getWriteKind(), write.value(), write.isCompressible());
WriteNode memoryWrite = graph.add(new WriteNode(write.getAddress(), write.getLocationIdentity(), value, write.getBarrierType()));
memoryWrite.setStateAfter(write.stateAfter());
graph.replaceFixedWithFixed(write, memoryWrite);
memoryWrite.setGuard(write.getGuard());
}
use of org.graalvm.compiler.nodes.extended.JavaWriteNode in project graal by oracle.
the class ObjectAccessTest method assertWrite.
private static void assertWrite(StructuredGraph graph, boolean indexConvert, LocationIdentity locationIdentity) {
JavaWriteNode write = (JavaWriteNode) graph.start().next();
Assert.assertEquals(graph.getParameter(2), write.value());
OffsetAddressNode address = (OffsetAddressNode) write.getAddress();
Assert.assertEquals(graph.getParameter(0), address.getBase());
Assert.assertEquals(BytecodeFrame.AFTER_BCI, write.stateAfter().bci);
Assert.assertEquals(locationIdentity, write.getLocationIdentity());
if (indexConvert) {
SignExtendNode convert = (SignExtendNode) address.getOffset();
Assert.assertEquals(convert.getInputBits(), 32);
Assert.assertEquals(convert.getResultBits(), 64);
Assert.assertEquals(graph.getParameter(1), convert.getValue());
} else {
Assert.assertEquals(graph.getParameter(1), address.getOffset());
}
ReturnNode ret = (ReturnNode) write.next();
Assert.assertEquals(null, ret.result());
}
use of org.graalvm.compiler.nodes.extended.JavaWriteNode in project graal by oracle.
the class WordOperationPlugin method writeOp.
protected void writeOp(GraphBuilderContext b, JavaKind writeKind, AddressNode address, LocationIdentity location, ValueNode value, Opcode op) {
assert op == Opcode.WRITE_POINTER || op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED || op == Opcode.INITIALIZE;
final BarrierType barrier = (op == Opcode.WRITE_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE);
final boolean compressible = (op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED);
assert op != Opcode.INITIALIZE || location.isInit() : "must use init location for initializing";
b.add(new JavaWriteNode(writeKind, address, location, value, barrier, compressible));
}
use of org.graalvm.compiler.nodes.extended.JavaWriteNode in project graal by oracle.
the class PointerTest method assertWrite.
private void assertWrite(StructuredGraph graph, boolean indexConvert, LocationIdentity locationIdentity) {
WordCastNode cast = (WordCastNode) graph.start().next();
JavaWriteNode write = (JavaWriteNode) cast.next();
Assert.assertEquals(graph.getParameter(2), write.value());
Assert.assertEquals(BytecodeFrame.AFTER_BCI, write.stateAfter().bci);
OffsetAddressNode address = (OffsetAddressNode) write.getAddress();
Assert.assertEquals(cast, address.getBase());
Assert.assertEquals(graph.getParameter(0), cast.getInput());
Assert.assertEquals(target.wordJavaKind, cast.stamp(NodeView.DEFAULT).getStackKind());
Assert.assertEquals(locationIdentity, write.getLocationIdentity());
if (indexConvert) {
SignExtendNode convert = (SignExtendNode) address.getOffset();
Assert.assertEquals(convert.getInputBits(), 32);
Assert.assertEquals(convert.getResultBits(), 64);
Assert.assertEquals(graph.getParameter(1), convert.getValue());
} else {
Assert.assertEquals(graph.getParameter(1), address.getOffset());
}
ReturnNode ret = (ReturnNode) write.next();
Assert.assertEquals(null, ret.result());
}
Aggregations