Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.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 | 494b818b527c |
comparison
equal
deleted
inserted
replaced
9320:3ef5689248b0 | 9321:cd1a1d92b3e3 |
---|---|
31 * | 31 * |
32 * @param slot the slot of the local variable | 32 * @param slot the slot of the local variable |
33 * @param value the new value of the local variable | 33 * @param value the new value of the local variable |
34 */ | 34 */ |
35 public static void setObjectSafe(Frame frame, FrameSlot slot, Object value) { | 35 public static void setObjectSafe(Frame frame, FrameSlot slot, Object value) { |
36 if (slot.getType() != Object.class) { | 36 if (slot.getKind() != FrameSlotKind.Object) { |
37 slot.setType(Object.class); | 37 slot.setKind(FrameSlotKind.Object); |
38 } | 38 } |
39 try { | 39 try { |
40 frame.setObject(slot, value); | 40 frame.setObject(slot, value); |
41 } catch (FrameSlotTypeException e) { | 41 } catch (FrameSlotTypeException e) { |
42 throw new IllegalStateException(); | 42 throw new IllegalStateException(); |
50 * | 50 * |
51 * @param slot the slot of the local variable | 51 * @param slot the slot of the local variable |
52 * @param value the new value of the local variable | 52 * @param value the new value of the local variable |
53 */ | 53 */ |
54 public static void setBooleanSafe(Frame frame, FrameSlot slot, boolean value) { | 54 public static void setBooleanSafe(Frame frame, FrameSlot slot, boolean value) { |
55 if (slot.getType() != boolean.class) { | 55 if (slot.getKind() != FrameSlotKind.Boolean) { |
56 slot.setType(boolean.class); | 56 slot.setKind(FrameSlotKind.Boolean); |
57 } | 57 } |
58 try { | 58 try { |
59 frame.setBoolean(slot, value); | 59 frame.setBoolean(slot, value); |
60 } catch (FrameSlotTypeException e) { | 60 } catch (FrameSlotTypeException e) { |
61 throw new IllegalStateException(); | 61 throw new IllegalStateException(); |
69 * | 69 * |
70 * @param slot the slot of the local variable | 70 * @param slot the slot of the local variable |
71 * @param value the new value of the local variable | 71 * @param value the new value of the local variable |
72 */ | 72 */ |
73 public static void setIntSafe(Frame frame, FrameSlot slot, int value) { | 73 public static void setIntSafe(Frame frame, FrameSlot slot, int value) { |
74 if (slot.getType() != int.class) { | 74 if (slot.getKind() != FrameSlotKind.Int) { |
75 slot.setType(int.class); | 75 slot.setKind(FrameSlotKind.Int); |
76 } | 76 } |
77 try { | 77 try { |
78 frame.setInt(slot, value); | 78 frame.setInt(slot, value); |
79 } catch (FrameSlotTypeException e) { | 79 } catch (FrameSlotTypeException e) { |
80 throw new IllegalStateException(); | 80 throw new IllegalStateException(); |
88 * | 88 * |
89 * @param slot the slot of the local variable | 89 * @param slot the slot of the local variable |
90 * @param value the new value of the local variable | 90 * @param value the new value of the local variable |
91 */ | 91 */ |
92 public static void setLongSafe(Frame frame, FrameSlot slot, long value) { | 92 public static void setLongSafe(Frame frame, FrameSlot slot, long value) { |
93 if (slot.getType() != long.class) { | 93 if (slot.getKind() != FrameSlotKind.Long) { |
94 slot.setType(long.class); | 94 slot.setKind(FrameSlotKind.Long); |
95 } | 95 } |
96 try { | 96 try { |
97 frame.setLong(slot, value); | 97 frame.setLong(slot, value); |
98 } catch (FrameSlotTypeException e) { | 98 } catch (FrameSlotTypeException e) { |
99 throw new IllegalStateException(); | 99 throw new IllegalStateException(); |
107 * | 107 * |
108 * @param slot the slot of the local variable | 108 * @param slot the slot of the local variable |
109 * @param value the new value of the local variable | 109 * @param value the new value of the local variable |
110 */ | 110 */ |
111 public static void setFloatSafe(Frame frame, FrameSlot slot, float value) { | 111 public static void setFloatSafe(Frame frame, FrameSlot slot, float value) { |
112 if (slot.getType() != float.class) { | 112 if (slot.getKind() != FrameSlotKind.Float) { |
113 slot.setType(float.class); | 113 slot.setKind(FrameSlotKind.Float); |
114 } | 114 } |
115 try { | 115 try { |
116 frame.setFloat(slot, value); | 116 frame.setFloat(slot, value); |
117 } catch (FrameSlotTypeException e) { | 117 } catch (FrameSlotTypeException e) { |
118 throw new IllegalStateException(); | 118 throw new IllegalStateException(); |
126 * | 126 * |
127 * @param slot the slot of the local variable | 127 * @param slot the slot of the local variable |
128 * @param value the new value of the local variable | 128 * @param value the new value of the local variable |
129 */ | 129 */ |
130 public static void setDoubleSafe(Frame frame, FrameSlot slot, double value) { | 130 public static void setDoubleSafe(Frame frame, FrameSlot slot, double value) { |
131 if (slot.getType() != double.class) { | 131 if (slot.getKind() != FrameSlotKind.Double) { |
132 slot.setType(double.class); | 132 slot.setKind(FrameSlotKind.Double); |
133 } | 133 } |
134 try { | 134 try { |
135 frame.setDouble(slot, value); | 135 frame.setDouble(slot, value); |
136 } catch (FrameSlotTypeException e) { | 136 } catch (FrameSlotTypeException e) { |
137 throw new IllegalStateException(); | 137 throw new IllegalStateException(); |