annotate src/share/vm/c1/c1_ValueType.hpp @ 2607:008adfd6d850

Fixed the stateBefore of invokes and monitorenter instructions to include the arguments of the instruction. This is necessary to ensure correct continuation in the interpreter when the stateBefore is used as a deoptimization point.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Fri, 06 May 2011 17:47:17 +0200
parents f95d63e2154a
children 1d7922586cf6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
25 #ifndef SHARE_VM_C1_C1_VALUETYPE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
26 #define SHARE_VM_C1_C1_VALUETYPE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
28 #include "c1/c1_Compilation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
29 #include "ci/ciConstant.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
30
0
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // type hierarchy
a61af66fc99e Initial load
duke
parents:
diff changeset
32 class ValueType;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 class VoidType;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class IntType;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class IntConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class IntInterval;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 class LongType;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class LongConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 class FloatType;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 class FloatConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 class DoubleType;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 class DoubleConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 class ObjectType;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 class ObjectConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 class ArrayType;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 class ArrayConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 class InstanceType;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 class InstanceConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 class ClassType;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 class ClassConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 class AddressType;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 class AddressConstant;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 class IllegalType;
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // predefined types
a61af66fc99e Initial load
duke
parents:
diff changeset
57 extern VoidType* voidType;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 extern IntType* intType;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 extern LongType* longType;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 extern FloatType* floatType;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 extern DoubleType* doubleType;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 extern ObjectType* objectType;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 extern ArrayType* arrayType;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 extern InstanceType* instanceType;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 extern ClassType* classType;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 extern AddressType* addressType;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 extern IllegalType* illegalType;
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // predefined constants
a61af66fc99e Initial load
duke
parents:
diff changeset
71 extern IntConstant* intZero;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 extern IntConstant* intOne;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 extern ObjectConstant* objectNull;
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // tags
a61af66fc99e Initial load
duke
parents:
diff changeset
77 enum ValueTag {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // all legal tags must come first
a61af66fc99e Initial load
duke
parents:
diff changeset
79 intTag,
a61af66fc99e Initial load
duke
parents:
diff changeset
80 longTag,
a61af66fc99e Initial load
duke
parents:
diff changeset
81 floatTag,
a61af66fc99e Initial load
duke
parents:
diff changeset
82 doubleTag,
a61af66fc99e Initial load
duke
parents:
diff changeset
83 objectTag,
a61af66fc99e Initial load
duke
parents:
diff changeset
84 addressTag,
a61af66fc99e Initial load
duke
parents:
diff changeset
85 number_of_legal_tags,
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // all other tags must follow afterwards
a61af66fc99e Initial load
duke
parents:
diff changeset
87 voidTag = number_of_legal_tags,
a61af66fc99e Initial load
duke
parents:
diff changeset
88 illegalTag,
a61af66fc99e Initial load
duke
parents:
diff changeset
89 number_of_tags
a61af66fc99e Initial load
duke
parents:
diff changeset
90 };
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 class ValueType: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
95 const int _size;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 const ValueTag _tag;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 ValueType();
a61af66fc99e Initial load
duke
parents:
diff changeset
98 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
99 ValueType(ValueTag tag, int size): _tag(tag), _size(size) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // initialization
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
103 static void initialize(Arena* arena);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
106 virtual ValueType* base() const = 0; // the 'canonical' type (e.g., intType for an IntConstant)
a61af66fc99e Initial load
duke
parents:
diff changeset
107 ValueTag tag() const { return _tag; } // the 'canonical' tag (useful for type matching)
a61af66fc99e Initial load
duke
parents:
diff changeset
108 int size() const { // the size of an object of the type in words
a61af66fc99e Initial load
duke
parents:
diff changeset
109 assert(_size > -1, "shouldn't be asking for size");
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return _size;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112 virtual const char tchar() const = 0; // the type 'character' for printing
a61af66fc99e Initial load
duke
parents:
diff changeset
113 virtual const char* name() const = 0; // the type name for printing
a61af66fc99e Initial load
duke
parents:
diff changeset
114 virtual bool is_constant() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // testers
a61af66fc99e Initial load
duke
parents:
diff changeset
117 bool is_void() { return tag() == voidTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 bool is_int() { return tag() == intTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 bool is_long() { return tag() == longTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 bool is_float() { return tag() == floatTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
121 bool is_double() { return tag() == doubleTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
122 bool is_object() { return as_ObjectType() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
123 bool is_array() { return as_ArrayType() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 bool is_instance() { return as_InstanceType() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 bool is_class() { return as_ClassType() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 bool is_address() { return as_AddressType() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 bool is_illegal() { return tag() == illegalTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 bool is_int_kind() const { return tag() == intTag || tag() == longTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 bool is_float_kind() const { return tag() == floatTag || tag() == doubleTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
131 bool is_object_kind() const { return tag() == objectTag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 bool is_single_word() const { return _size == 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 bool is_double_word() const { return _size == 2; }
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // casting
a61af66fc99e Initial load
duke
parents:
diff changeset
137 virtual VoidType* as_VoidType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
138 virtual IntType* as_IntType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
139 virtual LongType* as_LongType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 virtual FloatType* as_FloatType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 virtual DoubleType* as_DoubleType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
142 virtual ObjectType* as_ObjectType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
143 virtual ArrayType* as_ArrayType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
144 virtual InstanceType* as_InstanceType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
145 virtual ClassType* as_ClassType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
146 virtual AddressType* as_AddressType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
147 virtual IllegalType* as_IllegalType() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 virtual IntConstant* as_IntConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
150 virtual LongConstant* as_LongConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
151 virtual FloatConstant* as_FloatConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
152 virtual DoubleConstant* as_DoubleConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
153 virtual ObjectConstant* as_ObjectConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
154 virtual InstanceConstant* as_InstanceConstant(){ return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
155 virtual ClassConstant* as_ClassConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 virtual ArrayConstant* as_ArrayConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
157 virtual AddressConstant* as_AddressConstant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // type operations
a61af66fc99e Initial load
duke
parents:
diff changeset
160 ValueType* meet(ValueType* y) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
161 ValueType* join(ValueType* y) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 // debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
164 void print(outputStream* s = tty) { s->print(name()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
165 };
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 class VoidType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
169 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
170 VoidType(): ValueType(voidTag, 0) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
171 virtual ValueType* base() const { return voidType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
172 virtual const char tchar() const { return 'v'; }
a61af66fc99e Initial load
duke
parents:
diff changeset
173 virtual const char* name() const { return "void"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 virtual VoidType* as_VoidType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 };
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 class IntType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
179 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
180 IntType(): ValueType(intTag, 1) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
181 virtual ValueType* base() const { return intType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
182 virtual const char tchar() const { return 'i'; }
a61af66fc99e Initial load
duke
parents:
diff changeset
183 virtual const char* name() const { return "int"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
184 virtual IntType* as_IntType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
185 };
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187
a61af66fc99e Initial load
duke
parents:
diff changeset
188 class IntConstant: public IntType {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
190 jint _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
193 IntConstant(jint value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 jint value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
198 virtual IntConstant* as_IntConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
199 };
a61af66fc99e Initial load
duke
parents:
diff changeset
200
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202 class IntInterval: public IntType {
a61af66fc99e Initial load
duke
parents:
diff changeset
203 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
204 jint _beg;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 jint _end;
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
208 IntInterval(jint beg, jint end) {
a61af66fc99e Initial load
duke
parents:
diff changeset
209 assert(beg <= end, "illegal interval");
a61af66fc99e Initial load
duke
parents:
diff changeset
210 _beg = beg;
a61af66fc99e Initial load
duke
parents:
diff changeset
211 _end = end;
a61af66fc99e Initial load
duke
parents:
diff changeset
212 }
a61af66fc99e Initial load
duke
parents:
diff changeset
213
a61af66fc99e Initial load
duke
parents:
diff changeset
214 jint beg() const { return _beg; }
a61af66fc99e Initial load
duke
parents:
diff changeset
215 jint end() const { return _end; }
a61af66fc99e Initial load
duke
parents:
diff changeset
216
a61af66fc99e Initial load
duke
parents:
diff changeset
217 virtual bool is_interval() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
218 };
a61af66fc99e Initial load
duke
parents:
diff changeset
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221 class LongType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
222 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
223 LongType(): ValueType(longTag, 2) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
224 virtual ValueType* base() const { return longType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
225 virtual const char tchar() const { return 'l'; }
a61af66fc99e Initial load
duke
parents:
diff changeset
226 virtual const char* name() const { return "long"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
227 virtual LongType* as_LongType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
228 };
a61af66fc99e Initial load
duke
parents:
diff changeset
229
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 class LongConstant: public LongType {
a61af66fc99e Initial load
duke
parents:
diff changeset
232 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
233 jlong _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
234
a61af66fc99e Initial load
duke
parents:
diff changeset
235 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
236 LongConstant(jlong value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 jlong value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 virtual LongConstant* as_LongConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
242 };
a61af66fc99e Initial load
duke
parents:
diff changeset
243
a61af66fc99e Initial load
duke
parents:
diff changeset
244
a61af66fc99e Initial load
duke
parents:
diff changeset
245 class FloatType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
246 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
247 FloatType(): ValueType(floatTag, 1) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
248 virtual ValueType* base() const { return floatType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
249 virtual const char tchar() const { return 'f'; }
a61af66fc99e Initial load
duke
parents:
diff changeset
250 virtual const char* name() const { return "float"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
251 virtual FloatType* as_FloatType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
252 };
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 class FloatConstant: public FloatType {
a61af66fc99e Initial load
duke
parents:
diff changeset
256 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
257 jfloat _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
258
a61af66fc99e Initial load
duke
parents:
diff changeset
259 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
260 FloatConstant(jfloat value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
261
a61af66fc99e Initial load
duke
parents:
diff changeset
262 jfloat value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 virtual FloatConstant* as_FloatConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
266 };
a61af66fc99e Initial load
duke
parents:
diff changeset
267
a61af66fc99e Initial load
duke
parents:
diff changeset
268
a61af66fc99e Initial load
duke
parents:
diff changeset
269 class DoubleType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
270 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
271 DoubleType(): ValueType(doubleTag, 2) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
272 virtual ValueType* base() const { return doubleType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
273 virtual const char tchar() const { return 'd'; }
a61af66fc99e Initial load
duke
parents:
diff changeset
274 virtual const char* name() const { return "double"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
275 virtual DoubleType* as_DoubleType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 };
a61af66fc99e Initial load
duke
parents:
diff changeset
277
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279 class DoubleConstant: public DoubleType {
a61af66fc99e Initial load
duke
parents:
diff changeset
280 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
281 jdouble _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
284 DoubleConstant(jdouble value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
285
a61af66fc99e Initial load
duke
parents:
diff changeset
286 jdouble value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
289 virtual DoubleConstant* as_DoubleConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
290 };
a61af66fc99e Initial load
duke
parents:
diff changeset
291
a61af66fc99e Initial load
duke
parents:
diff changeset
292
a61af66fc99e Initial load
duke
parents:
diff changeset
293 class ObjectType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
294 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
295 ObjectType(): ValueType(objectTag, 1) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
296 virtual ValueType* base() const { return objectType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
297 virtual const char tchar() const { return 'a'; }
a61af66fc99e Initial load
duke
parents:
diff changeset
298 virtual const char* name() const { return "object"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
299 virtual ObjectType* as_ObjectType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
300 virtual ciObject* constant_value() const { ShouldNotReachHere(); return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
301 bool is_loaded() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
302 jobject encoding() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
303 };
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 class ObjectConstant: public ObjectType {
a61af66fc99e Initial load
duke
parents:
diff changeset
307 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
308 ciObject* _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
309
a61af66fc99e Initial load
duke
parents:
diff changeset
310 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
311 ObjectConstant(ciObject* value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
312
a61af66fc99e Initial load
duke
parents:
diff changeset
313 ciObject* value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
316 virtual ObjectConstant* as_ObjectConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
317 virtual ciObject* constant_value() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
318 };
a61af66fc99e Initial load
duke
parents:
diff changeset
319
a61af66fc99e Initial load
duke
parents:
diff changeset
320
a61af66fc99e Initial load
duke
parents:
diff changeset
321 class ArrayType: public ObjectType {
a61af66fc99e Initial load
duke
parents:
diff changeset
322 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
323 virtual ArrayType* as_ArrayType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
324 };
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326
a61af66fc99e Initial load
duke
parents:
diff changeset
327 class ArrayConstant: public ArrayType {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
329 ciArray* _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
330
a61af66fc99e Initial load
duke
parents:
diff changeset
331 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
332 ArrayConstant(ciArray* value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
333
a61af66fc99e Initial load
duke
parents:
diff changeset
334 ciArray* value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
335
a61af66fc99e Initial load
duke
parents:
diff changeset
336 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 virtual ArrayConstant* as_ArrayConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
339 virtual ciObject* constant_value() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
340 };
a61af66fc99e Initial load
duke
parents:
diff changeset
341
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 class InstanceType: public ObjectType {
a61af66fc99e Initial load
duke
parents:
diff changeset
344 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
345 virtual InstanceType* as_InstanceType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
346 };
a61af66fc99e Initial load
duke
parents:
diff changeset
347
a61af66fc99e Initial load
duke
parents:
diff changeset
348
a61af66fc99e Initial load
duke
parents:
diff changeset
349 class InstanceConstant: public InstanceType {
a61af66fc99e Initial load
duke
parents:
diff changeset
350 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
351 ciInstance* _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
352
a61af66fc99e Initial load
duke
parents:
diff changeset
353 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
354 InstanceConstant(ciInstance* value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
355
a61af66fc99e Initial load
duke
parents:
diff changeset
356 ciInstance* value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
357
a61af66fc99e Initial load
duke
parents:
diff changeset
358 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 virtual InstanceConstant* as_InstanceConstant(){ return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
361 virtual ciObject* constant_value() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
362 };
a61af66fc99e Initial load
duke
parents:
diff changeset
363
a61af66fc99e Initial load
duke
parents:
diff changeset
364
a61af66fc99e Initial load
duke
parents:
diff changeset
365 class ClassType: public ObjectType {
a61af66fc99e Initial load
duke
parents:
diff changeset
366 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
367 virtual ClassType* as_ClassType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
368 };
a61af66fc99e Initial load
duke
parents:
diff changeset
369
a61af66fc99e Initial load
duke
parents:
diff changeset
370
a61af66fc99e Initial load
duke
parents:
diff changeset
371 class ClassConstant: public ClassType {
a61af66fc99e Initial load
duke
parents:
diff changeset
372 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
373 ciInstanceKlass* _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
374
a61af66fc99e Initial load
duke
parents:
diff changeset
375 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
376 ClassConstant(ciInstanceKlass* value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
377
a61af66fc99e Initial load
duke
parents:
diff changeset
378 ciInstanceKlass* value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
379
a61af66fc99e Initial load
duke
parents:
diff changeset
380 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
381
a61af66fc99e Initial load
duke
parents:
diff changeset
382 virtual ClassConstant* as_ClassConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
383 virtual ciObject* constant_value() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
384 };
a61af66fc99e Initial load
duke
parents:
diff changeset
385
a61af66fc99e Initial load
duke
parents:
diff changeset
386
a61af66fc99e Initial load
duke
parents:
diff changeset
387 class AddressType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
388 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
389 AddressType(): ValueType(addressTag, 1) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
390 virtual ValueType* base() const { return addressType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
391 virtual const char tchar() const { return 'r'; }
a61af66fc99e Initial load
duke
parents:
diff changeset
392 virtual const char* name() const { return "address"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
393 virtual AddressType* as_AddressType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
394 };
a61af66fc99e Initial load
duke
parents:
diff changeset
395
a61af66fc99e Initial load
duke
parents:
diff changeset
396
a61af66fc99e Initial load
duke
parents:
diff changeset
397 class AddressConstant: public AddressType {
a61af66fc99e Initial load
duke
parents:
diff changeset
398 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
399 jint _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
400
a61af66fc99e Initial load
duke
parents:
diff changeset
401 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
402 AddressConstant(jint value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
403
a61af66fc99e Initial load
duke
parents:
diff changeset
404 jint value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
405
a61af66fc99e Initial load
duke
parents:
diff changeset
406 virtual bool is_constant() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
407
a61af66fc99e Initial load
duke
parents:
diff changeset
408 virtual AddressConstant* as_AddressConstant() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
409 };
a61af66fc99e Initial load
duke
parents:
diff changeset
410
a61af66fc99e Initial load
duke
parents:
diff changeset
411
a61af66fc99e Initial load
duke
parents:
diff changeset
412 class IllegalType: public ValueType {
a61af66fc99e Initial load
duke
parents:
diff changeset
413 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
414 IllegalType(): ValueType(illegalTag, -1) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
415 virtual ValueType* base() const { return illegalType; }
a61af66fc99e Initial load
duke
parents:
diff changeset
416 virtual const char tchar() const { return ' '; }
a61af66fc99e Initial load
duke
parents:
diff changeset
417 virtual const char* name() const { return "illegal"; }
a61af66fc99e Initial load
duke
parents:
diff changeset
418 virtual IllegalType* as_IllegalType() { return this; }
a61af66fc99e Initial load
duke
parents:
diff changeset
419 };
a61af66fc99e Initial load
duke
parents:
diff changeset
420
a61af66fc99e Initial load
duke
parents:
diff changeset
421
a61af66fc99e Initial load
duke
parents:
diff changeset
422 // conversion between ValueTypes, BasicTypes, and ciConstants
a61af66fc99e Initial load
duke
parents:
diff changeset
423 ValueType* as_ValueType(BasicType type);
a61af66fc99e Initial load
duke
parents:
diff changeset
424 ValueType* as_ValueType(ciConstant value);
a61af66fc99e Initial load
duke
parents:
diff changeset
425 BasicType as_BasicType(ValueType* type);
a61af66fc99e Initial load
duke
parents:
diff changeset
426
a61af66fc99e Initial load
duke
parents:
diff changeset
427 inline ValueType* as_ValueType(ciType* type) { return as_ValueType(type->basic_type()); }
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
428
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1584
diff changeset
429 #endif // SHARE_VM_C1_C1_VALUETYPE_HPP