Search in sources :

Example 1 with ArrayRangeWrite

use of org.graalvm.compiler.nodes.extended.ArrayRangeWrite in project graal by oracle.

the class WriteBarrierVerificationPhase method hasAttachedBarrier.

private boolean hasAttachedBarrier(FixedWithNextNode node) {
    final Node next = node.next();
    final Node previous = node.predecessor();
    boolean validatePreBarrier = useG1GC() && (isObjectWrite(node) || !((ArrayRangeWrite) node).isInitialization());
    if (node instanceof WriteNode) {
        WriteNode writeNode = (WriteNode) node;
        if (writeNode.getLocationIdentity().isInit()) {
            validatePreBarrier = false;
        }
    }
    if (isObjectWrite(node)) {
        return (isObjectBarrier(node, next) || StampTool.isPointerAlwaysNull(getValueWritten(node))) && (!validatePreBarrier || isObjectBarrier(node, previous));
    } else if (isObjectArrayRangeWrite(node)) {
        return (isArrayBarrier(node, next) || StampTool.isPointerAlwaysNull(getValueWritten(node))) && (!validatePreBarrier || isArrayBarrier(node, previous));
    } else {
        return true;
    }
}
Also used : ArrayRangeWrite(org.graalvm.compiler.nodes.extended.ArrayRangeWrite) 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) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)

Example 2 with ArrayRangeWrite

use of org.graalvm.compiler.nodes.extended.ArrayRangeWrite 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

Node (org.graalvm.compiler.graph.Node)2 ValueNode (org.graalvm.compiler.nodes.ValueNode)2 ArrayRangeWrite (org.graalvm.compiler.nodes.extended.ArrayRangeWrite)2 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)2 FixedAccessNode (org.graalvm.compiler.nodes.memory.FixedAccessNode)2 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)2 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)2 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1 DeoptimizingNode (org.graalvm.compiler.nodes.DeoptimizingNode)1 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)1 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)1 AbstractCompareAndSwapNode (org.graalvm.compiler.nodes.java.AbstractCompareAndSwapNode)1 LogicCompareAndSwapNode (org.graalvm.compiler.nodes.java.LogicCompareAndSwapNode)1 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)1 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)1