comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiConstant.java @ 4142:bc8527f3071c

Adjust code base to new level of warnings.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 18 Dec 2011 05:24:06 +0100
parents e233f5660da4
children f5328dda9714
comparison
equal deleted inserted replaced
4141:04d21be7a24f 4142:bc8527f3071c
27 * within the compiler and across the compiler/runtime interface. Exports a set of {@code CiConstant} 27 * within the compiler and across the compiler/runtime interface. Exports a set of {@code CiConstant}
28 * instances that represent frequently used constant values, such as {@link #ZERO}. 28 * instances that represent frequently used constant values, such as {@link #ZERO}.
29 */ 29 */
30 public final class CiConstant extends CiValue { 30 public final class CiConstant extends CiValue {
31 31
32 /**
33 *
34 */
35 private static final long serialVersionUID = -6355452536852663986L;
32 private static final CiConstant[] INT_CONSTANT_CACHE = new CiConstant[100]; 36 private static final CiConstant[] INT_CONSTANT_CACHE = new CiConstant[100];
33 static { 37 static {
34 for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) { 38 for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) {
35 INT_CONSTANT_CACHE[i] = new CiConstant(CiKind.Int, i); 39 INT_CONSTANT_CACHE[i] = new CiConstant(CiKind.Int, i);
36 } 40 }
155 /** 159 /**
156 * Returns the value of this constant as a boxed Java value. 160 * Returns the value of this constant as a boxed Java value.
157 * @return the value of this constant 161 * @return the value of this constant
158 */ 162 */
159 public Object boxedValue() { 163 public Object boxedValue() {
160 return boxedValue(kind);
161 }
162
163 /**
164 * Returns the value of this constant as a boxed Java value.
165 *
166 * @param kind the kind of the boxed value to be returned
167 * @return the value of this constant
168 */
169 public Object boxedValue(CiKind kind) {
170 // Checkstyle: stop 164 // Checkstyle: stop
171 switch (kind) { 165 switch (kind) {
172 case Byte: return (byte) asInt(); 166 case Byte: return (byte) asInt();
173 case Boolean: return asInt() == 0 ? Boolean.FALSE : Boolean.TRUE; 167 case Boolean: return asInt() == 0 ? Boolean.FALSE : Boolean.TRUE;
174 case Short: return (short) asInt(); 168 case Short: return (short) asInt();