comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java @ 7267:a4b84ba6dc2e

Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 18 Dec 2012 15:33:55 +0100
parents
children 5e3d1a68664e
comparison
equal deleted inserted replaced
7259:494d99e07614 7267:a4b84ba6dc2e
1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.truffle.api.frame;
24
25 import com.oracle.truffle.api.*;
26
27 /**
28 * Represents a frame containing values of local variables of the guest language. Instances of this type must not be
29 * stored in a field or cast to {@link java.lang.Object}.
30 */
31 public interface Frame {
32
33 /**
34 * @return the arguments used when calling this method
35 */
36 Arguments getArguments();
37
38 /**
39 * Read access to a local variable of type {@link Object}.
40 *
41 * @param slot the slot of the local variable
42 * @return the current value of the local variable
43 */
44 Object getObject(FrameSlot slot);
45
46 /**
47 * Write access to a local variable of type {@link Object}.
48 *
49 * @param slot the slot of the local variable
50 * @param value the new value of the local variable
51 */
52 void setObject(FrameSlot slot, Object value);
53
54 /**
55 * Read access to a local variable of type boolean.
56 *
57 * @param slot the slot of the local variable
58 * @return the current value of the local variable
59 */
60 boolean getBoolean(FrameSlot slot);
61
62 /**
63 * Write access to a local variable of type boolean.
64 *
65 * @param slot the slot of the local variable
66 * @param value the new value of the local variable
67 */
68 void setBoolean(FrameSlot slot, boolean value);
69
70 /**
71 * Read access to a local variable of type int.
72 *
73 * @param slot the slot of the local variable
74 * @return the current value of the local variable
75 */
76 int getInt(FrameSlot slot);
77
78 /**
79 * Write access to a local variable of type int.
80 *
81 * @param slot the slot of the local variable
82 * @param value the new value of the local variable
83 */
84 void setInt(FrameSlot slot, int value);
85
86 /**
87 * Read access to a local variable of type long.
88 *
89 * @param slot the slot of the local variable
90 * @return the current value of the local variable
91 */
92 long getLong(FrameSlot slot);
93
94 /**
95 * Write access to a local variable of type long.
96 *
97 * @param slot the slot of the local variable
98 * @param value the new value of the local variable
99 */
100 void setLong(FrameSlot slot, long value);
101
102 /**
103 * Read access to a local variable of type float.
104 *
105 * @param slot the slot of the local variable
106 * @return the current value of the local variable
107 */
108 float getFloat(FrameSlot slot);
109
110 /**
111 * Write access to a local variable of type float.
112 *
113 * @param slot the slot of the local variable
114 * @param value the new value of the local variable
115 */
116 void setFloat(FrameSlot slot, float value);
117
118 /**
119 * Read access to a local variable of type double.
120 *
121 * @param slot the slot of the local variable
122 * @return the current value of the local variable
123 */
124 double getDouble(FrameSlot slot);
125
126 /**
127 * Write access to a local variable of type double.
128 *
129 * @param slot the slot of the local variable
130 * @param value the new value of the local variable
131 */
132 void setDouble(FrameSlot slot, double value);
133
134 void updateToLatestVersion();
135 }