Search in sources :

Example 1 with ObjectWriteBarrier

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

the class WriteBarrierVerificationPhase method validateWrite.

private void validateWrite(Node write) {
    /*
         * The currently validated write is checked in order to discover if it has an appropriate
         * attached write barrier.
         */
    if (hasAttachedBarrier((FixedWithNextNode) write)) {
        return;
    }
    NodeFlood frontier = write.graph().createNodeFlood();
    expandFrontier(frontier, write);
    Iterator<Node> iterator = frontier.iterator();
    while (iterator.hasNext()) {
        Node currentNode = iterator.next();
        if (isSafepoint(currentNode)) {
            throw new AssertionError("Write barrier must be present " + write.toString(Verbosity.All) + " / " + write.inputs());
        }
        if (useG1GC()) {
            if (!(currentNode instanceof G1PostWriteBarrier) || (!validateBarrier((FixedAccessNode) write, (ObjectWriteBarrier) currentNode))) {
                expandFrontier(frontier, currentNode);
            }
        } else {
            if (!(currentNode instanceof SerialWriteBarrier) || (!validateBarrier((FixedAccessNode) write, (ObjectWriteBarrier) currentNode)) || ((currentNode instanceof SerialWriteBarrier) && !validateBarrier((FixedAccessNode) write, (ObjectWriteBarrier) currentNode))) {
                expandFrontier(frontier, currentNode);
            }
        }
    }
}
Also used : FixedAccessNode(org.graalvm.compiler.nodes.memory.FixedAccessNode) ObjectWriteBarrier(org.graalvm.compiler.hotspot.nodes.ObjectWriteBarrier) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) FixedAccessNode(org.graalvm.compiler.nodes.memory.FixedAccessNode) LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) Node(org.graalvm.compiler.graph.Node) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) LogicCompareAndSwapNode(org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode) G1PostWriteBarrier(org.graalvm.compiler.hotspot.nodes.G1PostWriteBarrier) SerialWriteBarrier(org.graalvm.compiler.hotspot.nodes.SerialWriteBarrier) NodeFlood(org.graalvm.compiler.graph.NodeFlood)

Aggregations

Node (org.graalvm.compiler.graph.Node)1 NodeFlood (org.graalvm.compiler.graph.NodeFlood)1 G1PostWriteBarrier (org.graalvm.compiler.hotspot.nodes.G1PostWriteBarrier)1 ObjectWriteBarrier (org.graalvm.compiler.hotspot.nodes.ObjectWriteBarrier)1 SerialWriteBarrier (org.graalvm.compiler.hotspot.nodes.SerialWriteBarrier)1 DeoptimizingNode (org.graalvm.compiler.nodes.DeoptimizingNode)1 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)1 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 LogicCompareAndSwapNode (org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode)1 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)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