Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.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 |
---|---|
47 @Test | 47 @Test |
48 public void test() { | 48 public void test() { |
49 TruffleRuntime runtime = Truffle.getRuntime(); | 49 TruffleRuntime runtime = Truffle.getRuntime(); |
50 FrameDescriptor frameDescriptor = new FrameDescriptor(); | 50 FrameDescriptor frameDescriptor = new FrameDescriptor(); |
51 FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int); | 51 FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int); |
52 TestRootNode rootNode = new TestRootNode(new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot)); | 52 TestRootNode rootNode = new TestRootNode(frameDescriptor, new IntAssignLocal(slot, new StringTestChildNode()), new IntReadLocal(slot)); |
53 CallTarget target = runtime.createCallTarget(rootNode, frameDescriptor); | 53 CallTarget target = runtime.createCallTarget(rootNode); |
54 Assert.assertEquals(FrameSlotKind.Int, slot.getKind()); | 54 Assert.assertEquals(FrameSlotKind.Int, slot.getKind()); |
55 Object result = target.call(); | 55 Object result = target.call(); |
56 Assert.assertEquals("42", result); | 56 Assert.assertEquals("42", result); |
57 Assert.assertEquals(FrameSlotKind.Object, slot.getKind()); | 57 Assert.assertEquals(FrameSlotKind.Object, slot.getKind()); |
58 } | 58 } |
60 class TestRootNode extends RootNode { | 60 class TestRootNode extends RootNode { |
61 | 61 |
62 @Child TestChildNode left; | 62 @Child TestChildNode left; |
63 @Child TestChildNode right; | 63 @Child TestChildNode right; |
64 | 64 |
65 public TestRootNode(TestChildNode left, TestChildNode right) { | 65 public TestRootNode(FrameDescriptor descriptor, TestChildNode left, TestChildNode right) { |
66 super(null); | 66 super(null, descriptor); |
67 this.left = adoptChild(left); | 67 this.left = adoptChild(left); |
68 this.right = adoptChild(right); | 68 this.right = adoptChild(right); |
69 } | 69 } |
70 | 70 |
71 @Override | 71 @Override |