Search in sources :

Example 26 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method explodeLoopUntilReturn.

@Test
public void explodeLoopUntilReturn() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new ExplodeLoopUntilReturnNode();
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "explodeLoopUntilReturn", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) ExplodeLoopUntilReturnNode(org.graalvm.compiler.truffle.test.nodes.ExplodeLoopUntilReturnNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 27 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method mixLocalAndAdd.

@Test
public void mixLocalAndAdd() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new BlockTestNode(new AbstractTestNode[] { new StoreLocalTestNode("x", fd, new ConstantTestNode(40)), new StoreLocalTestNode("x", fd, new AddTestNode(new LoadLocalTestNode("x", fd), new ConstantTestNode(2))), new LoadLocalTestNode("x", fd) });
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "mixLocalAndAdd", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) BlockTestNode(org.graalvm.compiler.truffle.test.nodes.BlockTestNode) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) ConstantTestNode(org.graalvm.compiler.truffle.test.nodes.ConstantTestNode) StoreLocalTestNode(org.graalvm.compiler.truffle.test.nodes.StoreLocalTestNode) LoadLocalTestNode(org.graalvm.compiler.truffle.test.nodes.LoadLocalTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) AddTestNode(org.graalvm.compiler.truffle.test.nodes.AddTestNode) Test(org.junit.Test)

Example 28 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class PhiStampInferencePartialEvaluationTest method ifPhiStamp.

@Test
public void ifPhiStamp() {
    /*
         * The stamp of a phi should be inferred during partial evaluation so that its type
         * information can be used to devirtualize method calls.
         */
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new IfPhiStampTestNode();
    RootNode rootNode = new RootTestNode(fd, "ifPhiStamp", result);
    RootCallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode);
    callTarget.call(new Object[] { true });
    callTarget.call(new Object[] { false });
    // ensure method cannot be statically bound without receiver type info
    new D().get();
    assertPartialEvalNoInvokes(callTarget, new Object[] { true });
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) RootNode(com.oracle.truffle.api.nodes.RootNode) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) RootCallTarget(com.oracle.truffle.api.RootCallTarget) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 29 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class ReadOnlyArrayListPartialEvaluationTest method constantValue.

@Test
public void constantValue() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new ReadOnlyArrayListConstantNode(42);
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "constantValue", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) ReadOnlyArrayListConstantNode(org.graalvm.compiler.truffle.test.nodes.ReadOnlyArrayListConstantNode) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 30 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method longAddConstants.

@Test
public void longAddConstants() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new ConstantTestNode(2);
    for (int i = 0; i < 20; ++i) {
        result = new AddTestNode(result, new ConstantTestNode(2));
    }
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "longAddConstants", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) ConstantTestNode(org.graalvm.compiler.truffle.test.nodes.ConstantTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) AddTestNode(org.graalvm.compiler.truffle.test.nodes.AddTestNode) Test(org.junit.Test)

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)50 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)50 Test (org.junit.Test)48 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)43 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)14 ConstantTestNode (org.graalvm.compiler.truffle.test.nodes.ConstantTestNode)14 RootNode (com.oracle.truffle.api.nodes.RootNode)10 AddTestNode (org.graalvm.compiler.truffle.test.nodes.AddTestNode)7 BlockTestNode (org.graalvm.compiler.truffle.test.nodes.BlockTestNode)6 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)5 Assumption (com.oracle.truffle.api.Assumption)3 LoadLocalTestNode (org.graalvm.compiler.truffle.test.nodes.LoadLocalTestNode)3 NestedExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode)3 StoreLocalTestNode (org.graalvm.compiler.truffle.test.nodes.StoreLocalTestNode)3 CallTarget (com.oracle.truffle.api.CallTarget)2 RootCallTarget (com.oracle.truffle.api.RootCallTarget)2 WeakReference (java.lang.ref.WeakReference)2 IntSupplier (java.util.function.IntSupplier)2 BailoutException (jdk.vm.ci.code.BailoutException)2 InstrumentPhase (org.graalvm.compiler.truffle.compiler.phases.InstrumentPhase)2