Search in sources :

Example 1 with StringHashCodeFinalNode

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

the class SimplePartialEvaluationTest method intrinsicStringHashCodeFinal.

@Test
public void intrinsicStringHashCodeFinal() {
    /* The intrinsic for String.hashcode() triggers on constant strings. */
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new StringHashCodeFinalNode("*");
    /* The hash code of "*" is 42. */
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "intrinsicStringHashCodeFinal", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) StringHashCodeFinalNode(org.graalvm.compiler.truffle.test.nodes.StringHashCodeFinalNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)1 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)1 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)1 StringHashCodeFinalNode (org.graalvm.compiler.truffle.test.nodes.StringHashCodeFinalNode)1 Test (org.junit.Test)1