Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java @ 12645:60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 30 Oct 2013 19:50:11 +0100 |
parents | 139b84d713bc |
children | 0046afcda972 |
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) { |
11638
269e6794e1ec
Truffle: Frame restructuring.
Andreas Woess <andreas.woess@jku.at>
parents:
11427
diff
changeset
|
38 frame.setObject(slot, value); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 } |
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 /** |
11427
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
42 * Write access to a local variable of type {@code byte}. |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
43 * |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
44 * Sets the frame slot type to {@code byte} if it isn't already. |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
45 * |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
46 * @param slot the slot of the local variable |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
47 * @param value the new value of the local variable |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
48 */ |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
49 public static void setByteSafe(Frame frame, FrameSlot slot, byte value) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
50 frame.setByte(slot, value); |
11427
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
51 } |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
52 |
51dcddfa25a6
Truffle: add Byte to Frame
Christian Wirth <christian.wirth@oracle.com>
parents:
11279
diff
changeset
|
53 /** |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 * 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
|
55 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 * 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
|
57 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 * @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
|
59 * @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
|
60 */ |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 public static void setBooleanSafe(Frame frame, FrameSlot slot, boolean value) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
62 frame.setBoolean(slot, value); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 } |
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 * 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
|
67 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 * 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
|
69 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 * @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
|
71 * @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
|
72 */ |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 public static void setIntSafe(Frame frame, FrameSlot slot, int value) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
74 frame.setInt(slot, value); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 /** |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 * 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
|
79 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 * 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
|
81 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 * @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
|
83 * @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
|
84 */ |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 public static void setLongSafe(Frame frame, FrameSlot slot, long value) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
86 frame.setLong(slot, value); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 } |
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 /** |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 * 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
|
91 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 * 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
|
93 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 * @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
|
95 * @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
|
96 */ |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 public static void setFloatSafe(Frame frame, FrameSlot slot, float value) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
98 frame.setFloat(slot, value); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 /** |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 * 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
|
103 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 * 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
|
105 * |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 * @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
|
107 * @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
|
108 */ |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 public static void setDoubleSafe(Frame frame, FrameSlot slot, double value) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11638
diff
changeset
|
110 frame.setDouble(slot, value); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 } |
12645
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
112 |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
113 /** |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
114 * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
115 * a guard or statically known). |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
116 * |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
117 * @param frameSlot the slot of the variable |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
118 * @throws IllegalStateException if the slot kind does not match |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
119 * @see Frame#getObject(FrameSlot) |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
120 */ |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
121 public static Object getObjectSafe(Frame frame, FrameSlot frameSlot) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
122 try { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
123 return frame.getObject(frameSlot); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
124 } catch (FrameSlotTypeException e) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
125 throw new IllegalStateException(); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
126 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
127 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
128 |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
129 /** |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
130 * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
131 * a guard or statically known). |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
132 * |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
133 * @param frameSlot the slot of the variable |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
134 * @throws IllegalStateException if the slot kind does not match |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
135 * @see Frame#getByte(FrameSlot) |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
136 */ |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
137 public static byte getByteSafe(Frame frame, FrameSlot frameSlot) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
138 try { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
139 return frame.getByte(frameSlot); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
140 } catch (FrameSlotTypeException e) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
141 throw new IllegalStateException(); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
142 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
143 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
144 |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
145 /** |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
146 * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
147 * a guard or statically known). |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
148 * |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
149 * @param frameSlot the slot of the variable |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
150 * @throws IllegalStateException if the slot kind does not match |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
151 * @see Frame#getBoolean(FrameSlot) |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
152 */ |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
153 public static boolean getBooleanSafe(Frame frame, FrameSlot frameSlot) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
154 try { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
155 return frame.getBoolean(frameSlot); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
156 } catch (FrameSlotTypeException e) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
157 throw new IllegalStateException(); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
158 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
159 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
160 |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
161 /** |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
162 * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
163 * a guard or statically known). |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
164 * |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
165 * @param frameSlot the slot of the variable |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
166 * @throws IllegalStateException if the slot kind does not match |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
167 * @see Frame#getInt(FrameSlot) |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
168 */ |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
169 public static int getIntSafe(Frame frame, FrameSlot frameSlot) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
170 try { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
171 return frame.getInt(frameSlot); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
172 } catch (FrameSlotTypeException e) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
173 throw new IllegalStateException(); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
174 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
175 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
176 |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
177 /** |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
178 * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
179 * a guard or statically known). |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
180 * |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
181 * @param frameSlot the slot of the variable |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
182 * @throws IllegalStateException if the slot kind does not match |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
183 * @see Frame#getLong(FrameSlot) |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
184 */ |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
185 public static long getLongSafe(Frame frame, FrameSlot frameSlot) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
186 try { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
187 return frame.getLong(frameSlot); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
188 } catch (FrameSlotTypeException e) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
189 throw new IllegalStateException(); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
190 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
191 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
192 |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
193 /** |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
194 * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
195 * a guard or statically known). |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
196 * |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
197 * @param frameSlot the slot of the variable |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
198 * @throws IllegalStateException if the slot kind does not match |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
199 * @see Frame#getDouble(FrameSlot) |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
200 */ |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
201 public static double getDoubleSafe(Frame frame, FrameSlot frameSlot) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
202 try { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
203 return frame.getDouble(frameSlot); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
204 } catch (FrameSlotTypeException e) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
205 throw new IllegalStateException(); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
206 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
207 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
208 |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
209 /** |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
210 * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
211 * a guard or statically known). |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
212 * |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
213 * @param frameSlot the slot of the variable |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
214 * @throws IllegalStateException if the slot kind does not match |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
215 * @see Frame#getFloat(FrameSlot) |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
216 */ |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
217 public static float getFloatSafe(Frame frame, FrameSlot frameSlot) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
218 try { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
219 return frame.getFloat(frameSlot); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
220 } catch (FrameSlotTypeException e) { |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
221 throw new IllegalStateException(); |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
222 } |
60c32ab6eb39
add FrameUtil.get<Type>Safe methods that do not throw checked exceptions.
Andreas Woess <andreas.woess@jku.at>
parents:
12405
diff
changeset
|
223 } |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 } |