Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java @ 13705:ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 17 Jan 2014 17:06:08 +0100 |
parents | 139b84d713bc |
children | a08b8694f556 |
comparison
equal
deleted
inserted
replaced
13704:10a2d66262ae | 13705:ac5b0f31f7a2 |
---|---|
46 @Test | 46 @Test |
47 public void test() { | 47 public void test() { |
48 TruffleRuntime runtime = Truffle.getRuntime(); | 48 TruffleRuntime runtime = Truffle.getRuntime(); |
49 FrameDescriptor frameDescriptor = new FrameDescriptor(); | 49 FrameDescriptor frameDescriptor = new FrameDescriptor(); |
50 FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int); | 50 FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int); |
51 TestRootNode rootNode = new TestRootNode(new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot)); | 51 TestRootNode rootNode = new TestRootNode(frameDescriptor, new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot)); |
52 CallTarget target = runtime.createCallTarget(rootNode, frameDescriptor); | 52 CallTarget target = runtime.createCallTarget(rootNode); |
53 Assert.assertEquals(FrameSlotKind.Int, slot.getKind()); | 53 Assert.assertEquals(FrameSlotKind.Int, slot.getKind()); |
54 Object result = target.call(); | 54 Object result = target.call(); |
55 Assert.assertEquals("42", result); | 55 Assert.assertEquals("42", result); |
56 Assert.assertEquals(FrameSlotKind.Object, slot.getKind()); | 56 Assert.assertEquals(FrameSlotKind.Object, slot.getKind()); |
57 } | 57 } |
59 class TestRootNode extends RootNode { | 59 class TestRootNode extends RootNode { |
60 | 60 |
61 @Child TestChildNode left; | 61 @Child TestChildNode left; |
62 @Child TestChildNode right; | 62 @Child TestChildNode right; |
63 | 63 |
64 public TestRootNode(TestChildNode left, TestChildNode right) { | 64 public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) { |
65 super(null); | 65 super(null, descriptor); |
66 this.left = adoptChild(left); | 66 this.left = adoptChild(left); |
67 this.right = adoptChild(right); | 67 this.right = adoptChild(right); |
68 } | 68 } |
69 | 69 |
70 @Override | 70 @Override |