Search in sources :

Example 1 with JavaWriteNode

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);
    }
}
Also used : ConstantNode(org.graalvm.compiler.nodes.ConstantNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AbstractWriteNode(org.graalvm.compiler.nodes.memory.AbstractWriteNode) CInterfaceWriteNode(com.oracle.svm.core.graal.nodes.CInterfaceWriteNode)

Example 2 with JavaWriteNode

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());
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ValueNode(org.graalvm.compiler.nodes.ValueNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) AtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)

Example 3 with JavaWriteNode

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());
}
Also used : ReturnNode(org.graalvm.compiler.nodes.ReturnNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode)

Example 4 with JavaWriteNode

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));
}
Also used : JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) BarrierType(org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType)

Example 5 with JavaWriteNode

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());
}
Also used : ReturnNode(org.graalvm.compiler.nodes.ReturnNode) WordCastNode(org.graalvm.compiler.word.WordCastNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode)

Aggregations

JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)5 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)3 ReturnNode (org.graalvm.compiler.nodes.ReturnNode)2 SignExtendNode (org.graalvm.compiler.nodes.calc.SignExtendNode)2 CInterfaceWriteNode (com.oracle.svm.core.graal.nodes.CInterfaceWriteNode)1 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 AtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode)1 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)1 AbstractWriteNode (org.graalvm.compiler.nodes.memory.AbstractWriteNode)1 BarrierType (org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType)1 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)1 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)1 WordCastNode (org.graalvm.compiler.word.WordCastNode)1