annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java @ 11343:75d9b7aedcfd

Truffle: added some missing javadoc.
author Andreas Woess <andreas.woess@jku.at>
date Sat, 17 Aug 2013 14:03:28 +0200
parents 494b818b527c
children 51dcddfa25a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
11279
494b818b527c Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9321
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
494b818b527c Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9321
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
494b818b527c Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9321
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * This code is distributed in the hope that it will be useful, but WITHOUT
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 * version 2 for more details (a copy is included in the LICENSE file that
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * accompanied this code).
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License version
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 * 2 along with this work; if not, write to the Free Software Foundation,
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 * or visit www.oracle.com if you need additional information or have any
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23 * questions.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24 */
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 package com.oracle.truffle.api.frame;
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 public final class FrameUtil {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 /**
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30 * Write access to a local variable of type {@link Object}.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 * Sets the frame slot type to {@link Object} if it isn't already.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 * @param slot the slot of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 * @param value the new value of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 */
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 public static void setObjectSafe(Frame frame, FrameSlot slot, Object value) {
9321
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
38 if (slot.getKind() != FrameSlotKind.Object) {
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
39 slot.setKind(FrameSlotKind.Object);
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 try {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 frame.setObject(slot, value);
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 } catch (FrameSlotTypeException e) {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 throw new IllegalStateException();
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 /**
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 * Write access to a local variable of type {@code boolean}.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 * Sets the frame slot type to {@code boolean} if it isn't already.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 * @param slot the slot of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 * @param value the new value of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 */
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 public static void setBooleanSafe(Frame frame, FrameSlot slot, boolean value) {
9321
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
57 if (slot.getKind() != FrameSlotKind.Boolean) {
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
58 slot.setKind(FrameSlotKind.Boolean);
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 try {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 frame.setBoolean(slot, value);
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 } catch (FrameSlotTypeException e) {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 throw new IllegalStateException();
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 /**
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 * Write access to a local variable of type {@code int}.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
70 * Sets the frame slot type to {@code int} if it isn't already.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 * @param slot the slot of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 * @param value the new value of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74 */
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 public static void setIntSafe(Frame frame, FrameSlot slot, int value) {
9321
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
76 if (slot.getKind() != FrameSlotKind.Int) {
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
77 slot.setKind(FrameSlotKind.Int);
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 try {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 frame.setInt(slot, value);
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 } catch (FrameSlotTypeException e) {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 throw new IllegalStateException();
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 /**
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 * Write access to a local variable of type {@code long}.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 * Sets the frame slot type to {@code long} if it isn't already.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 * @param slot the slot of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 * @param value the new value of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 */
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 public static void setLongSafe(Frame frame, FrameSlot slot, long value) {
9321
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
95 if (slot.getKind() != FrameSlotKind.Long) {
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
96 slot.setKind(FrameSlotKind.Long);
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98 try {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 frame.setLong(slot, value);
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 } catch (FrameSlotTypeException e) {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 throw new IllegalStateException();
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 /**
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 * Write access to a local variable of type {@code float}.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 * Sets the frame slot type to {@code float} if it isn't already.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110 * @param slot the slot of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
111 * @param value the new value of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
112 */
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
113 public static void setFloatSafe(Frame frame, FrameSlot slot, float value) {
9321
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
114 if (slot.getKind() != FrameSlotKind.Float) {
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
115 slot.setKind(FrameSlotKind.Float);
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117 try {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 frame.setFloat(slot, value);
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 } catch (FrameSlotTypeException e) {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 throw new IllegalStateException();
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 /**
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125 * Write access to a local variable of type {@code double}.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127 * Sets the frame slot type to {@code double} if it isn't already.
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128 *
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 * @param slot the slot of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 * @param value the new value of the local variable
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 */
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 public static void setDoubleSafe(Frame frame, FrameSlot slot, double value) {
9321
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
133 if (slot.getKind() != FrameSlotKind.Double) {
cd1a1d92b3e3 Frame API: Introduce FrameSlotKind.
Andreas Woess <andreas.woess@jku.at>
parents: 9258
diff changeset
134 slot.setKind(FrameSlotKind.Double);
9258
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 try {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 frame.setDouble(slot, value);
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138 } catch (FrameSlotTypeException e) {
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 throw new IllegalStateException();
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 }
07f8d136a05e Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 }