Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java @ 9321:cd1a1d92b3e3
Frame API: Introduce FrameSlotKind.
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Thu, 25 Apr 2013 18:14:08 +0200 |
parents | 07f8d136a05e |
children | df1d665ca846 |
comparison
equal
deleted
inserted
replaced
9320:3ef5689248b0 | 9321:cd1a1d92b3e3 |
---|---|
33 * | 33 * |
34 * <p> | 34 * <p> |
35 * The frame is the preferred data structure for passing values between nodes. It can in particular | 35 * The frame is the preferred data structure for passing values between nodes. It can in particular |
36 * be used for storing the values of local variables of the guest language. The | 36 * be used for storing the values of local variables of the guest language. The |
37 * {@link FrameDescriptor} represents the current structure of the frame. The method | 37 * {@link FrameDescriptor} represents the current structure of the frame. The method |
38 * {@link FrameDescriptor#addFrameSlot(Object, Class)} can be used to create predefined frame slots. | 38 * {@link FrameDescriptor#addFrameSlot(Object, FrameSlotKind)} can be used to create predefined |
39 * The setter and getter methods in the {@link Frame} class can be used to access the current value | 39 * frame slots. The setter and getter methods in the {@link Frame} class can be used to access the |
40 * of a particular frame slot. | 40 * current value of a particular frame slot. |
41 * </p> | 41 * </p> |
42 * | 42 * |
43 * <p> | 43 * <p> |
44 * There are five primitive types for slots available: {@link java.lang.Boolean}, | 44 * There are five primitive types for slots available: {@link java.lang.Boolean}, |
45 * {@link java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and | 45 * {@link java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and |
62 | 62 |
63 @Test | 63 @Test |
64 public void test() { | 64 public void test() { |
65 TruffleRuntime runtime = Truffle.getRuntime(); | 65 TruffleRuntime runtime = Truffle.getRuntime(); |
66 FrameDescriptor frameDescriptor = new FrameDescriptor(); | 66 FrameDescriptor frameDescriptor = new FrameDescriptor(); |
67 FrameSlot slot = frameDescriptor.addFrameSlot("localVar", int.class); | 67 FrameSlot slot = frameDescriptor.addFrameSlot("localVar", FrameSlotKind.Int); |
68 TestRootNode rootNode = new TestRootNode(new AssignLocal(slot), new ReadLocal(slot)); | 68 TestRootNode rootNode = new TestRootNode(new AssignLocal(slot), new ReadLocal(slot)); |
69 CallTarget target = runtime.createCallTarget(rootNode, frameDescriptor); | 69 CallTarget target = runtime.createCallTarget(rootNode, frameDescriptor); |
70 Object result = target.call(); | 70 Object result = target.call(); |
71 Assert.assertEquals(42, result); | 71 Assert.assertEquals(42, result); |
72 } | 72 } |