Mercurial > hg > truffle
annotate graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java @ 7300:2912b72d840a
More complete and reusable Word type
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Fri, 04 Jan 2013 12:08:11 -0800 |
parents | f1f32b695d1e |
children | 5e3d1a68664e |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4182
de7b3e7ae528
Simplify CiValue
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
23 package com.oracle.graal.api.meta; |
5502
13aee5aba8cc
Moved RiConstant to cri.ri package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5501
diff
changeset
|
24 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 /** |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
26 * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, within the |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
27 * compiler and across the compiler/runtime interface. Exports a set of {@code Constant} instances that represent |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
28 * frequently used constant values, such as {@link #NULL_OBJECT}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 */ |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
30 public final class Constant extends Value { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
31 |
4182
de7b3e7ae528
Simplify CiValue
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4169
diff
changeset
|
32 private static final long serialVersionUID = -6355452536852663986L; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
34 private static final Constant[] INT_CONSTANT_CACHE = new Constant[100]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 static { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) { |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
37 INT_CONSTANT_CACHE[i] = new Constant(Kind.Int, null, i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
41 public static final Constant NULL_OBJECT = new Constant(Kind.Object, null, 0); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
42 public static final Constant INT_MINUS_1 = new Constant(Kind.Int, null, -1); |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
43 public static final Constant INT_0 = forInt(0); |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
44 public static final Constant INT_1 = forInt(1); |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
45 public static final Constant INT_2 = forInt(2); |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
46 public static final Constant INT_3 = forInt(3); |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
47 public static final Constant INT_4 = forInt(4); |
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
48 public static final Constant INT_5 = forInt(5); |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
49 public static final Constant LONG_0 = new Constant(Kind.Long, null, 0L); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
50 public static final Constant LONG_1 = new Constant(Kind.Long, null, 1L); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
51 public static final Constant FLOAT_0 = new Constant(Kind.Float, null, Float.floatToRawIntBits(0.0F)); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
52 public static final Constant FLOAT_1 = new Constant(Kind.Float, null, Float.floatToRawIntBits(1.0F)); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
53 public static final Constant FLOAT_2 = new Constant(Kind.Float, null, Float.floatToRawIntBits(2.0F)); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
54 public static final Constant DOUBLE_0 = new Constant(Kind.Double, null, Double.doubleToRawLongBits(0.0D)); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
55 public static final Constant DOUBLE_1 = new Constant(Kind.Double, null, Double.doubleToRawLongBits(1.0D)); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
56 public static final Constant TRUE = new Constant(Kind.Boolean, null, 1L); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
57 public static final Constant FALSE = new Constant(Kind.Boolean, null, 0L); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 static { |
5543
25d561cfdcfa
Clean up in api classes. Removed CiGenericCallback. Simplified Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
60 assert FLOAT_0 != forFloat(-0.0F) : "Constant for 0.0f must be different from -0.0f"; |
25d561cfdcfa
Clean up in api classes. Removed CiGenericCallback. Simplified Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
61 assert DOUBLE_0 != forDouble(-0.0d) : "Constant for 0.0d must be different from -0.0d"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 assert NULL_OBJECT.isNull(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 /** |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
66 * The boxed object value if {@code !kind.isObject()} otherwise the (possibly null) |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
67 * {@link #getPrimitiveAnnotation() annotation} for a primitive value. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 private final Object object; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 /** |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
72 * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. For {@code float} and |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
73 * {@code double} values, this value is the result of {@link Float#floatToRawIntBits(float)} and |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
74 * {@link Double#doubleToRawLongBits(double)} respectively. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 private final long primitive; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
78 private Constant(Kind kind, Object object, long primitive) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 super(kind); |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
80 this.object = object; |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
81 this.primitive = primitive; |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
82 } |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
83 |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
84 /** |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 * Checks whether this constant is non-null. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
86 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 * @return {@code true} if this constant is a primitive, or an object constant that is not null |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 public boolean isNonNull() { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6996
diff
changeset
|
90 return getKind() != Kind.Object || object != null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 * Checks whether this constant is null. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
95 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 * @return {@code true} if this constant is the null constant |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 public boolean isNull() { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6996
diff
changeset
|
99 return getKind() == Kind.Object && object == null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 |
6708
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
102 /** |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
103 * Checks whether this constant is the default value for its kind (null, 0, 0.0, false). |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
104 * |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
105 * @return {@code true} if this constant is the default value for its kind |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
106 */ |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
107 public boolean isDefaultForKind() { |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
108 return object == null && primitive == 0; |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
109 } |
a5156d39b622
add isDefaultForKind to Constant
Lukas Stadler <lukas.stadler@jku.at>
parents:
6539
diff
changeset
|
110 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 @Override |
4169
f5328dda9714
Initial commit of SSA-based spill-all register assignment
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
112 public String toString() { |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
113 String annotationSuffix = ""; |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6996
diff
changeset
|
114 if (getKind() != Kind.Object && getPrimitiveAnnotation() != null) { |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
115 annotationSuffix = "{" + getPrimitiveAnnotation() + "}"; |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
116 } |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
117 return getKind().getJavaName() + "[" + getKind().format(asBoxedValue()) + (getKind() != Kind.Object ? "|0x" + Long.toHexString(primitive) : "") + "]" + annotationSuffix; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 * Returns the value of this constant as a boxed Java value. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
122 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 * @return the value of this constant |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 */ |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
125 public Object asBoxedValue() { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6328
diff
changeset
|
126 switch (getKind()) { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
127 case Byte: |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
128 return (byte) asInt(); |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
129 case Boolean: |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
130 return asInt() == 0 ? Boolean.FALSE : Boolean.TRUE; |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
131 case Short: |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
132 return (short) primitive; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
133 case Char: |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
134 return (char) primitive; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
135 case Jsr: |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
136 return (int) primitive; |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
137 case Int: |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
138 return (int) primitive; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
139 case Long: |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
140 return primitive; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
141 case Float: |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
142 return asFloat(); |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
143 case Double: |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
144 return asDouble(); |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
145 case Object: |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
146 return object; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 throw new IllegalArgumentException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
151 private boolean valueEqual(Constant other, boolean ignoreKind) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 // must have equivalent kinds to be equal |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6328
diff
changeset
|
153 if (!ignoreKind && getKind() != other.getKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 } |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6996
diff
changeset
|
156 if (getKind() == Kind.Object) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 return object == other.object; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 } |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
159 return primitive == other.primitive && getPrimitiveAnnotation() == other.getPrimitiveAnnotation(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 /** |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
163 * Returns the primitive int value this constant represents. The constant must have a {@link Kind#getStackKind()} of |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
164 * {@link Kind#Int}, or kind {@link Kind#Jsr}. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
165 * |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
166 * @return the constant value |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 public int asInt() { |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
169 assert getKind().getStackKind() == Kind.Int || getKind() == Kind.Jsr; |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
170 return (int) primitive; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
173 /** |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
174 * Returns the primitive boolean value this constant represents. The constant must have kind {@link Kind#Boolean}. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
175 * |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
176 * @return the constant value |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
178 public boolean asBoolean() { |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
179 assert getKind() == Kind.Boolean; |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
180 return primitive != 0L; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
183 /** |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
184 * Returns the primitive long value this constant represents. The constant must have kind {@link Kind#Long}, a |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
185 * {@link Kind#getStackKind()} of {@link Kind#Int}, or kind {@link Kind#Jsr}. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
186 * |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
187 * @return the constant value |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 */ |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
189 public long asLong() { |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
190 assert getKind() == Kind.Long || getKind().getStackKind() == Kind.Int || getKind() == Kind.Jsr; |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
191 return primitive; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 /** |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
195 * Returns the primitive float value this constant represents. The constant must have kind {@link Kind#Float}. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
196 * |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
197 * @return the constant value |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 */ |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
199 public float asFloat() { |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
200 assert getKind() == Kind.Float; |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
201 return Float.intBitsToFloat((int) primitive); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 /** |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
205 * Returns the primitive double value this constant represents. The constant must have kind {@link Kind#Double}. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
206 * |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
207 * @return the constant value |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 */ |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
209 public double asDouble() { |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
210 assert getKind() == Kind.Double; |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
211 return Double.longBitsToDouble(primitive); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
213 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 /** |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
215 * Returns the object reference this constant represents. The constant must have kind {@link Kind#Object}. |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
216 * |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
217 * @return the constant value |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 */ |
7103
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
219 public Object asObject() { |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
220 assert getKind() == Kind.Object; |
0c59b76e6689
Eliminate bogus conversion that Constant.asLong() performed; simplify asXxx methods so that they do not have control flow.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
221 return object; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 /** |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
225 * Gets the annotation (if any) associated with this constant. |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
226 * |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
227 * @return null if this constant is not primitive or has no annotation |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
228 */ |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
229 public Object getPrimitiveAnnotation() { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6996
diff
changeset
|
230 return getKind() == Kind.Object ? null : object; |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
231 } |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
232 |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
233 /** |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 * Computes the hashcode of this constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
235 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 * @return a suitable hashcode for this constant |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 public int hashCode() { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6996
diff
changeset
|
240 if (getKind() == Kind.Object) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 return System.identityHashCode(object); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 return (int) primitive; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 /** |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
247 * Checks whether this constant equals another object. This is only true if the other object is a constant that has |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6994
diff
changeset
|
248 * the same {@linkplain #getKind() kind}, value and {@link #getPrimitiveAnnotation() annotation}. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
249 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 * @param o the object to compare equality |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
251 * @return {@code true} if this constant is equivalent to the specified object |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 public boolean equals(Object o) { |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
255 return o == this || o instanceof Constant && valueEqual((Constant) o, false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 * Creates a boxed double constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
260 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
261 * @param d the double value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
264 public static Constant forDouble(double d) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 if (Double.compare(0.0D, d) == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 return DOUBLE_0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 if (Double.compare(d, 1.0D) == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
269 return DOUBLE_1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
270 } |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
271 return new Constant(Kind.Double, null, Double.doubleToRawLongBits(d)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 * Creates a boxed float constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
276 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
277 * @param f the float value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
278 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
280 public static Constant forFloat(float f) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 if (Float.compare(f, 0.0F) == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 return FLOAT_0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
283 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 if (Float.compare(f, 1.0F) == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 return FLOAT_1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
287 if (Float.compare(f, 2.0F) == 0) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
288 return FLOAT_2; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 } |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
290 return new Constant(Kind.Float, null, Float.floatToRawIntBits(f)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 * Creates a boxed long constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
295 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 * @param i the long value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
299 public static Constant forLong(long i) { |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
300 return i == 0 ? LONG_0 : i == 1 ? LONG_1 : new Constant(Kind.Long, null, i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 * Creates a boxed integer constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
305 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 * @param i the integer value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
307 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
309 public static Constant forInt(int i) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 if (i == -1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 return INT_MINUS_1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
313 if (i >= 0 && i < INT_CONSTANT_CACHE.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 return INT_CONSTANT_CACHE[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 } |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
316 return new Constant(Kind.Int, null, i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
319 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 * Creates a boxed byte constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
321 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
322 * @param i the byte value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
324 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
325 public static Constant forByte(byte i) { |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
326 return new Constant(Kind.Byte, null, i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
330 * Creates a boxed boolean constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
331 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 * @param i the boolean value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
333 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
335 public static Constant forBoolean(boolean i) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
336 return i ? TRUE : FALSE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
337 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
338 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 * Creates a boxed char constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
341 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 * @param i the char value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
344 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
345 public static Constant forChar(char i) { |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
346 return new Constant(Kind.Char, null, i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
350 * Creates a boxed short constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
351 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 * @param i the short value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
355 public static Constant forShort(short i) { |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
356 return new Constant(Kind.Short, null, i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
359 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 * Creates a boxed address (jsr/ret address) constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
361 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 * @param i the address value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
363 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
365 public static Constant forJsr(int i) { |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
366 return new Constant(Kind.Jsr, null, i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
368 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 * Creates a boxed object constant. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
371 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
372 * @param o the object value to box |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
373 * @return a boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
374 */ |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
375 public static Constant forObject(Object o) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 if (o == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
377 return NULL_OBJECT; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
378 } |
7105
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
379 return new Constant(Kind.Object, o, 0L); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
380 } |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
381 |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
382 /** |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
383 * Creates an annotated int or long constant. An annotation enables a client to associate some extra semantic or |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
384 * debugging information with a primitive. An annotated primitive constant is never {@linkplain #equals(Object) |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
385 * equal} to a non-annotated constant. |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
386 * |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
387 * @param kind the type of this constant |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
388 * @param i the value of this constant |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
389 * @param annotation an arbitrary non-null object |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
390 */ |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
391 public static Constant forIntegerKind(Kind kind, long i, Object annotation) { |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
392 switch (kind) { |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
393 case Int: |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
394 return new Constant(kind, annotation, (int) i); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
395 case Long: |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
396 return new Constant(kind, annotation, i); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
397 default: |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
398 throw new IllegalArgumentException("not an integer kind: " + kind); |
f1f32b695d1e
Make constructors of Constant private to ensure proper encapuslation of the type-overloaded primitive field; reduce to one constructor that sets all fields.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7103
diff
changeset
|
399 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 /** |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
403 * Creates a boxed constant for the given kind from an Object. The object needs to be of the Java boxed type |
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
404 * corresponding to the kind. |
6994
fd1c171d9969
removed Kind parameter from Constant constructor for an object constant
Doug Simon <doug.simon@oracle.com>
parents:
6708
diff
changeset
|
405 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
406 * @param kind the kind of the constant to create |
5774
a1db0ea58b53
Removed left over Ci* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5711
diff
changeset
|
407 * @param value the Java boxed value: a {@link Byte} instance for {@link Kind#Byte}, etc. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 * @return the boxed copy of {@code value} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 */ |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
410 public static Constant forBoxed(Kind kind, Object value) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
411 switch (kind) { |
5428
6ec0857cdf46
added support for snippet templates which are snippet graphs specialized by binding a constant to at least one of the snippet's parameters
Doug Simon <doug.simon@oracle.com>
parents:
4199
diff
changeset
|
412 case Boolean: |
6ec0857cdf46
added support for snippet templates which are snippet graphs specialized by binding a constant to at least one of the snippet's parameters
Doug Simon <doug.simon@oracle.com>
parents:
4199
diff
changeset
|
413 return forBoolean((Boolean) value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 case Byte: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 return forByte((Byte) value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 case Char: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 return forChar((Character) value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 case Short: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
419 return forShort((Short) value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 return forInt((Integer) value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 case Long: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 return forLong((Long) value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
424 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
425 return forFloat((Float) value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
426 case Double: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 return forDouble((Double) value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 return forObject(value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 default: |
5572
8f9c9d372e31
small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5543
diff
changeset
|
431 throw new RuntimeException("cannot create Constant for boxed " + kind + " value"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
432 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 } |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
434 |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
435 /** |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
436 * Returns a constant with the default value for the given kind. |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
437 */ |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
438 public static Constant defaultForKind(Kind kind) { |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
439 switch(kind) { |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
440 case Boolean: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
441 return FALSE; |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
442 case Byte: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
443 return forByte((byte) 0); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
444 case Char: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
445 return forChar((char) 0); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
446 case Short: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
447 return forShort((short) 0); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
448 case Int: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
449 return INT_0; |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
450 case Double: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
451 return DOUBLE_0; |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
452 case Float: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
453 return FLOAT_0; |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
454 case Long: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
455 return LONG_0; |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
456 case Object: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
457 return NULL_OBJECT; |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
458 default: |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
459 throw new IllegalArgumentException(kind.toString()); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
460 } |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7105
diff
changeset
|
461 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 } |