Mercurial > hg > graal-compiler
comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiConstant.java @ 4182:de7b3e7ae528
Simplify CiValue
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Mon, 02 Jan 2012 14:38:17 -0800 |
parents | f5328dda9714 |
children |
comparison
equal
deleted
inserted
replaced
4181:319860ae697a | 4182:de7b3e7ae528 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
26 * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, | 26 * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, |
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 | |
32 /** | |
33 * | |
34 */ | |
35 private static final long serialVersionUID = -6355452536852663986L; | 31 private static final long serialVersionUID = -6355452536852663986L; |
32 | |
36 private static final CiConstant[] INT_CONSTANT_CACHE = new CiConstant[100]; | 33 private static final CiConstant[] INT_CONSTANT_CACHE = new CiConstant[100]; |
37 static { | 34 static { |
38 for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) { | 35 for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) { |
39 INT_CONSTANT_CACHE[i] = new CiConstant(CiKind.Int, i); | 36 INT_CONSTANT_CACHE[i] = new CiConstant(CiKind.Int, i); |
40 } | 37 } |
305 * @return {@code true} if this constant is equivalent to the specified object | 302 * @return {@code true} if this constant is equivalent to the specified object |
306 */ | 303 */ |
307 @Override | 304 @Override |
308 public boolean equals(Object o) { | 305 public boolean equals(Object o) { |
309 return o == this || o instanceof CiConstant && valueEqual((CiConstant) o, false); | 306 return o == this || o instanceof CiConstant && valueEqual((CiConstant) o, false); |
310 } | |
311 | |
312 @Override | |
313 public boolean equalsIgnoringKind(CiValue o) { | |
314 return o == this || o instanceof CiConstant && valueEqual((CiConstant) o, true); | |
315 } | 307 } |
316 | 308 |
317 /** | 309 /** |
318 * Checks whether this constant is identical to another constant or has the same value as it. | 310 * Checks whether this constant is identical to another constant or has the same value as it. |
319 * @param other the constant to compare for equality against this constant | 311 * @param other the constant to compare for equality against this constant |