Search in sources :

Example 1 with WordCastNode

use of org.graalvm.compiler.word.WordCastNode in project graal by oracle.

the class PointerTest method assertRead.

private void assertRead(StructuredGraph graph, JavaKind kind, boolean indexConvert, LocationIdentity locationIdentity) {
    WordCastNode cast = (WordCastNode) graph.start().next();
    JavaReadNode read = (JavaReadNode) cast.next();
    Assert.assertEquals(kind.getStackKind(), read.stamp(NodeView.DEFAULT).getStackKind());
    OffsetAddressNode address = (OffsetAddressNode) read.getAddress();
    Assert.assertEquals(cast, address.getBase());
    Assert.assertEquals(graph.getParameter(0), cast.getInput());
    Assert.assertEquals(target.wordJavaKind, cast.stamp(NodeView.DEFAULT).getStackKind());
    Assert.assertEquals(locationIdentity, read.getLocationIdentity());
    if (indexConvert) {
        SignExtendNode convert = (SignExtendNode) address.getOffset();
        Assert.assertEquals(convert.getInputBits(), 32);
        Assert.assertEquals(convert.getResultBits(), 64);
        Assert.assertEquals(graph.getParameter(1), convert.getValue());
    } else {
        Assert.assertEquals(graph.getParameter(1), address.getOffset());
    }
    ReturnNode ret = (ReturnNode) read.next();
    Assert.assertEquals(read, ret.result());
}
Also used : JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) WordCastNode(org.graalvm.compiler.word.WordCastNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode)

Example 2 with WordCastNode

use of org.graalvm.compiler.word.WordCastNode in project graal by oracle.

the class PointerTest method assertWrite.

private void assertWrite(StructuredGraph graph, boolean indexConvert, LocationIdentity locationIdentity) {
    WordCastNode cast = (WordCastNode) graph.start().next();
    JavaWriteNode write = (JavaWriteNode) cast.next();
    Assert.assertEquals(graph.getParameter(2), write.value());
    Assert.assertEquals(BytecodeFrame.AFTER_BCI, write.stateAfter().bci);
    OffsetAddressNode address = (OffsetAddressNode) write.getAddress();
    Assert.assertEquals(cast, address.getBase());
    Assert.assertEquals(graph.getParameter(0), cast.getInput());
    Assert.assertEquals(target.wordJavaKind, cast.stamp(NodeView.DEFAULT).getStackKind());
    Assert.assertEquals(locationIdentity, write.getLocationIdentity());
    if (indexConvert) {
        SignExtendNode convert = (SignExtendNode) address.getOffset();
        Assert.assertEquals(convert.getInputBits(), 32);
        Assert.assertEquals(convert.getResultBits(), 64);
        Assert.assertEquals(graph.getParameter(1), convert.getValue());
    } else {
        Assert.assertEquals(graph.getParameter(1), address.getOffset());
    }
    ReturnNode ret = (ReturnNode) write.next();
    Assert.assertEquals(null, ret.result());
}
Also used : ReturnNode(org.graalvm.compiler.nodes.ReturnNode) WordCastNode(org.graalvm.compiler.word.WordCastNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) SignExtendNode(org.graalvm.compiler.nodes.calc.SignExtendNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode)

Aggregations

ReturnNode (org.graalvm.compiler.nodes.ReturnNode)2 SignExtendNode (org.graalvm.compiler.nodes.calc.SignExtendNode)2 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)2 WordCastNode (org.graalvm.compiler.word.WordCastNode)2 JavaReadNode (org.graalvm.compiler.nodes.extended.JavaReadNode)1 JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)1