Search in sources :

Example 1 with LoweredAtomicReadAndWriteNode

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

the class DefaultJavaLoweringProvider method lowerAtomicReadAndWriteNode.

protected void lowerAtomicReadAndWriteNode(AtomicReadAndWriteNode n) {
    StructuredGraph graph = n.graph();
    JavaKind valueKind = n.getValueKind();
    ValueNode newValue = implicitStoreConvert(graph, valueKind, n.newValue());
    AddressNode address = graph.unique(new OffsetAddressNode(n.object(), n.offset()));
    LoweredAtomicReadAndWriteNode memoryRead = graph.add(new LoweredAtomicReadAndWriteNode(address, n.getLocationIdentity(), newValue, atomicReadAndWriteBarrierType(n)));
    memoryRead.setStateAfter(n.stateAfter());
    ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead);
    n.stateAfter().replaceFirstInput(n, memoryRead);
    n.replaceAtUsages(readValue);
    graph.replaceFixedWithFixed(n, memoryRead);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 2 with LoweredAtomicReadAndWriteNode

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

the class WriteBarrierAdditionPhase method run.

@SuppressWarnings("try")
@Override
protected void run(StructuredGraph graph) {
    for (Node n : graph.getNodes()) {
        try (DebugCloseable scope = n.graph().withNodeSourcePosition(n)) {
            if (n instanceof ReadNode) {
                addReadNodeBarriers((ReadNode) n, graph);
            } else if (n instanceof WriteNode) {
                addWriteNodeBarriers((WriteNode) n, graph);
            } else if (n instanceof LoweredAtomicReadAndWriteNode) {
                LoweredAtomicReadAndWriteNode loweredAtomicReadAndWriteNode = (LoweredAtomicReadAndWriteNode) n;
                addAtomicReadWriteNodeBarriers(loweredAtomicReadAndWriteNode, graph);
            } else if (n instanceof AbstractCompareAndSwapNode) {
                addCASBarriers((AbstractCompareAndSwapNode) n, graph);
            } else if (n instanceof ArrayRangeWrite) {
                ArrayRangeWrite node = (ArrayRangeWrite) n;
                if (node.writesObjectArray()) {
                    addArrayRangeBarriers(node, graph);
                }
            }
        }
    }
}
Also used : ArrayRangeWrite(org.graalvm.compiler.nodes.extended.ArrayRangeWrite) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) AbstractCompareAndSwapNode(org.graalvm.compiler.nodes.java.AbstractCompareAndSwapNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) FixedAccessNode(org.graalvm.compiler.nodes.memory.FixedAccessNode) Node(org.graalvm.compiler.graph.Node) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) DebugCloseable(org.graalvm.compiler.debug.DebugCloseable) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) AbstractCompareAndSwapNode(org.graalvm.compiler.nodes.java.AbstractCompareAndSwapNode)

Aggregations

ValueNode (org.graalvm.compiler.nodes.ValueNode)2 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)2 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)2 JavaKind (jdk.vm.ci.meta.JavaKind)1 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1 Node (org.graalvm.compiler.graph.Node)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 ArrayRangeWrite (org.graalvm.compiler.nodes.extended.ArrayRangeWrite)1 AbstractCompareAndSwapNode (org.graalvm.compiler.nodes.java.AbstractCompareAndSwapNode)1 FixedAccessNode (org.graalvm.compiler.nodes.memory.FixedAccessNode)1 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)1 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)1 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)1