Search in sources :

Example 6 with AbstractTestNode

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

the class CastExactPartialEvaluationTest method castExactCompilerDirective.

/**
 * Tests the effect of {@link CompilerDirectives#castExact} on method devirtualization.
 */
@Test
public void castExactCompilerDirective() {
    AbstractTestNode result = new CastExactTestNode(newBuffer().getClass());
    testCommon(result, "castExactCompilerDirective");
}
Also used : AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) Test(org.junit.Test)

Example 7 with AbstractTestNode

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

the class CompilationFinalPartialEvaluationTest method compilationFinalTest1.

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

Example 8 with AbstractTestNode

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

the class ControlFlowExceptionPartialEvaluationTest method catchControlFlowExceptionFromCall.

@Test
public void catchControlFlowExceptionFromCall() {
    Assume.assumeTrue(TruffleCompilerOptions.getValue(TruffleFunctionInlining));
    CallTarget callTarget = Truffle.getRuntime().createCallTarget(new RootTestNode(new FrameDescriptor(), "throwControlFlowException", new ThrowControlFlowExceptionTestNode()));
    AbstractTestNode result = new CatchControlFlowExceptionTestNode(new CallTestNode(callTarget));
    assertPartialEvalEquals("constant42", new RootTestNode(new FrameDescriptor(), "catchControlFlowExceptionFromCall", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) CallTarget(com.oracle.truffle.api.CallTarget) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 9 with AbstractTestNode

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

the class SimplePartialEvaluationTest method longSequenceConstants.

@Test
public void longSequenceConstants() {
    FrameDescriptor fd = new FrameDescriptor();
    int length = 40;
    AbstractTestNode[] children = new AbstractTestNode[length];
    for (int i = 0; i < children.length; ++i) {
        children[i] = new ConstantTestNode(42);
    }
    AbstractTestNode result = new BlockTestNode(children);
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "longSequenceConstants", 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) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 10 with AbstractTestNode

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

the class SimplePartialEvaluationTest method intrinsicStringHashCodeNonFinal.

@Test
public void intrinsicStringHashCodeNonFinal() {
    /*
         * The intrinsic for String.hashcode() does not trigger on non-constant strings, so the
         * method String.hashCode() must be inlined during partial evaluation (so there must not be
         * an invoke after partial evaluation).
         */
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new StringHashCodeNonFinalNode("*");
    assertPartialEvalNoInvokes(new RootTestNode(fd, "intrinsicStringHashCodeNonFinal", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) StringHashCodeNonFinalNode(org.graalvm.compiler.truffle.test.nodes.StringHashCodeNonFinalNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Aggregations

AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)46 Test (org.junit.Test)45 FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)43 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)43 ConstantTestNode (org.graalvm.compiler.truffle.test.nodes.ConstantTestNode)13 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)11 RootNode (com.oracle.truffle.api.nodes.RootNode)9 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 LoadLocalTestNode (org.graalvm.compiler.truffle.test.nodes.LoadLocalTestNode)4 NestedExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode)3 StoreLocalTestNode (org.graalvm.compiler.truffle.test.nodes.StoreLocalTestNode)3 Assumption (com.oracle.truffle.api.Assumption)2 CallTarget (com.oracle.truffle.api.CallTarget)2 WeakReference (java.lang.ref.WeakReference)2 IntSupplier (java.util.function.IntSupplier)2 LoopTestNode (org.graalvm.compiler.truffle.test.nodes.LoopTestNode)2 TwoMergesExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.TwoMergesExplodedLoopTestNode)2 Ignore (org.junit.Ignore)2