Search in sources :

Example 21 with AddressNode

use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerLoadIndexedNode.

protected void lowerLoadIndexedNode(LoadIndexedNode loadIndexed, LoweringTool tool) {
    StructuredGraph graph = loadIndexed.graph();
    ValueNode array = loadIndexed.array();
    array = createNullCheckedValue(array, loadIndexed, tool);
    JavaKind elementKind = loadIndexed.elementKind();
    Stamp loadStamp = loadStamp(loadIndexed.stamp(NodeView.DEFAULT), elementKind);
    GuardingNode boundsCheck = getBoundsCheck(loadIndexed, array, tool);
    AddressNode address = createArrayIndexAddress(graph, array, elementKind, loadIndexed.index(), boundsCheck);
    ReadNode memoryRead = graph.add(new ReadNode(address, NamedLocationIdentity.getArrayLocation(elementKind), loadStamp, BarrierType.NONE));
    memoryRead.setGuard(boundsCheck);
    ValueNode readValue = implicitLoadConvert(graph, elementKind, memoryRead);
    loadIndexed.replaceAtUsages(readValue);
    graph.replaceFixed(loadIndexed, memoryRead);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) GuardingNode(org.graalvm.compiler.nodes.extended.GuardingNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 22 with AddressNode

use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.

the class DefaultJavaLoweringProvider method createUnsafeRead.

protected ReadNode createUnsafeRead(StructuredGraph graph, RawLoadNode load, GuardingNode guard) {
    boolean compressible = load.accessKind() == JavaKind.Object;
    JavaKind readKind = load.accessKind();
    Stamp loadStamp = loadStamp(load.stamp(NodeView.DEFAULT), readKind, compressible);
    AddressNode address = createUnsafeAddress(graph, load.object(), load.offset());
    ReadNode memoryRead = graph.add(new ReadNode(address, load.getLocationIdentity(), loadStamp, BarrierType.NONE));
    if (guard == null) {
        // An unsafe read must not float otherwise it may float above
        // a test guaranteeing the read is safe.
        memoryRead.setForceFixed(true);
    } else {
        memoryRead.setGuard(guard);
    }
    ValueNode readValue = performBooleanCoercionIfNecessary(implicitLoadConvert(graph, readKind, memoryRead, compressible), readKind);
    load.replaceAtUsages(readValue);
    return memoryRead;
}
Also used : ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 23 with AddressNode

use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerUnsafeStoreNode.

protected void lowerUnsafeStoreNode(RawStoreNode store) {
    StructuredGraph graph = store.graph();
    boolean compressible = store.value().getStackKind() == JavaKind.Object;
    JavaKind valueKind = store.accessKind();
    ValueNode value = implicitStoreConvert(graph, valueKind, store.value(), compressible);
    AddressNode address = createUnsafeAddress(graph, store.object(), store.offset());
    WriteNode write = graph.add(new WriteNode(address, store.getLocationIdentity(), value, unsafeStoreBarrierType(store)));
    write.setStateAfter(store.stateAfter());
    graph.replaceFixedWithFixed(store, write);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) 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) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 24 with AddressNode

use of org.graalvm.compiler.nodes.memory.address.AddressNode 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 25 with AddressNode

use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerUnsafeMemoryLoadNode.

protected void lowerUnsafeMemoryLoadNode(UnsafeMemoryLoadNode load) {
    StructuredGraph graph = load.graph();
    JavaKind readKind = load.getKind();
    assert readKind != JavaKind.Object;
    Stamp loadStamp = loadStamp(load.stamp(NodeView.DEFAULT), readKind, false);
    AddressNode address = graph.addOrUniqueWithInputs(OffsetAddressNode.create(load.getAddress()));
    ReadNode memoryRead = graph.add(new ReadNode(address, load.getLocationIdentity(), loadStamp, BarrierType.NONE));
    // An unsafe read must not float otherwise it may float above
    // a test guaranteeing the read is safe.
    memoryRead.setForceFixed(true);
    ValueNode readValue = performBooleanCoercionIfNecessary(implicitLoadConvert(graph, readKind, memoryRead, false), readKind);
    load.replaceAtUsages(readValue);
    graph.replaceFixedWithFixed(load, memoryRead);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Aggregations

AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)43 ValueNode (org.graalvm.compiler.nodes.ValueNode)35 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)25 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)16 JavaKind (jdk.vm.ci.meta.JavaKind)13 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)12 Stamp (org.graalvm.compiler.core.common.type.Stamp)9 FloatingReadNode (org.graalvm.compiler.nodes.memory.FloatingReadNode)9 ComputeObjectAddressNode (org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode)8 GetObjectAddressNode (org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode)8 AMD64AddressNode (org.graalvm.compiler.core.amd64.AMD64AddressNode)7 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)7 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)7 JavaReadNode (org.graalvm.compiler.nodes.extended.JavaReadNode)7 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)7 Test (org.junit.Test)7 LeftShiftNode (org.graalvm.compiler.nodes.calc.LeftShiftNode)6 JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)6 AtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode)6 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)6