use of org.graalvm.compiler.truffle.test.nodes.ObjectHashCodeNode in project graal by oracle.
the class SimplePartialEvaluationTest method intrinsicHashCode.
@Test
public void intrinsicHashCode() {
/*
* The intrinsic for Object.hashCode() is inlined late during Truffle partial evaluation,
* because we call hashCode() on a value whose exact type Object is only known during
* partial evaluation.
*/
FrameDescriptor fd = new FrameDescriptor();
Object testObject = new Object();
AbstractTestNode result = new ObjectHashCodeNode(testObject);
RootNode rootNode = new RootTestNode(fd, "intrinsicHashCode", result);
OptimizedCallTarget compilable = compileHelper("intrinsicHashCode", rootNode, new Object[0]);
int actual = (Integer) compilable.call(new Object[0]);
int expected = testObject.hashCode();
Assert.assertEquals(expected, actual);
}
Aggregations