Search in sources :

Example 1 with GuardedUnsafeLoadNode

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

the class DefaultJavaLoweringProvider method lowerUnsafeLoadNode.

/**
 * @param tool utility for performing the lowering
 */
protected void lowerUnsafeLoadNode(RawLoadNode load, LoweringTool tool) {
    StructuredGraph graph = load.graph();
    if (load instanceof GuardedUnsafeLoadNode) {
        GuardedUnsafeLoadNode guardedLoad = (GuardedUnsafeLoadNode) load;
        GuardingNode guard = guardedLoad.getGuard();
        if (guard == null) {
            // can float freely if the guard folded away
            ReadNode memoryRead = createUnsafeRead(graph, load, null);
            memoryRead.setForceFixed(false);
            graph.replaceFixedWithFixed(load, memoryRead);
        } else {
            // must be guarded, but flows below the guard
            ReadNode memoryRead = createUnsafeRead(graph, load, guard);
            graph.replaceFixedWithFixed(load, memoryRead);
        }
    } else {
        // never had a guarding condition so it must be fixed, creation of the read will force
        // it to be fixed
        ReadNode memoryRead = createUnsafeRead(graph, load, null);
        graph.replaceFixedWithFixed(load, memoryRead);
    }
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) GuardedUnsafeLoadNode(org.graalvm.compiler.nodes.extended.GuardedUnsafeLoadNode) JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) GuardingNode(org.graalvm.compiler.nodes.extended.GuardingNode)

Aggregations

StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 GuardedUnsafeLoadNode (org.graalvm.compiler.nodes.extended.GuardedUnsafeLoadNode)1 GuardingNode (org.graalvm.compiler.nodes.extended.GuardingNode)1 JavaReadNode (org.graalvm.compiler.nodes.extended.JavaReadNode)1 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)1