Mercurial > hg > truffle
annotate src/share/vm/opto/type.hpp @ 12966:b2ee5dc63353
8024070: C2 needs some form of type speculation
Summary: record unused type profile information with type system, propagate and use it.
Reviewed-by: kvn, twisti
author | roland |
---|---|
date | Wed, 23 Oct 2013 12:40:23 +0200 |
parents | c9ccd7b85f20 |
children | 59e8ad757e19 |
rev | line source |
---|---|
0 | 1 /* |
12146
9758d9f36299
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
10278
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1080
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1080
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:
1080
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_OPTO_TYPE_HPP |
26 #define SHARE_VM_OPTO_TYPE_HPP | |
27 | |
28 #include "libadt/port.hpp" | |
29 #include "opto/adlcVMDeps.hpp" | |
30 #include "runtime/handles.hpp" | |
31 | |
0 | 32 // Portions of code courtesy of Clifford Click |
33 | |
34 // Optimization - Graph Style | |
35 | |
36 | |
37 // This class defines a Type lattice. The lattice is used in the constant | |
38 // propagation algorithms, and for some type-checking of the iloc code. | |
39 // Basic types include RSD's (lower bound, upper bound, stride for integers), | |
40 // float & double precision constants, sets of data-labels and code-labels. | |
41 // The complete lattice is described below. Subtypes have no relationship to | |
42 // up or down in the lattice; that is entirely determined by the behavior of | |
43 // the MEET/JOIN functions. | |
44 | |
45 class Dict; | |
46 class Type; | |
47 class TypeD; | |
48 class TypeF; | |
49 class TypeInt; | |
50 class TypeLong; | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
51 class TypeNarrowPtr; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
52 class TypeNarrowOop; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
53 class TypeNarrowKlass; |
0 | 54 class TypeAry; |
55 class TypeTuple; | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
56 class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
57 class TypeVectS; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
58 class TypeVectD; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
59 class TypeVectX; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
60 class TypeVectY; |
0 | 61 class TypePtr; |
62 class TypeRawPtr; | |
63 class TypeOopPtr; | |
64 class TypeInstPtr; | |
65 class TypeAryPtr; | |
66 class TypeKlassPtr; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
67 class TypeMetadataPtr; |
0 | 68 |
69 //------------------------------Type------------------------------------------- | |
70 // Basic Type object, represents a set of primitive Values. | |
71 // Types are hash-cons'd into a private class dictionary, so only one of each | |
72 // different kind of Type exists. Types are never modified after creation, so | |
73 // all their interesting fields are constant. | |
74 class Type { | |
3939 | 75 friend class VMStructs; |
76 | |
0 | 77 public: |
78 enum TYPES { | |
79 Bad=0, // Type check | |
80 Control, // Control of code (not in lattice) | |
81 Top, // Top of the lattice | |
82 Int, // Integer range (lo-hi) | |
83 Long, // Long integer range (lo-hi) | |
84 Half, // Placeholder half of doubleword | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
85 NarrowOop, // Compressed oop pointer |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
86 NarrowKlass, // Compressed klass pointer |
0 | 87 |
88 Tuple, // Method signature or object layout | |
89 Array, // Array types | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
90 VectorS, // 32bit Vector types |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
91 VectorD, // 64bit Vector types |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
92 VectorX, // 128bit Vector types |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
93 VectorY, // 256bit Vector types |
0 | 94 |
95 AnyPtr, // Any old raw, klass, inst, or array pointer | |
96 RawPtr, // Raw (non-oop) pointers | |
97 OopPtr, // Any and all Java heap entities | |
98 InstPtr, // Instance pointers (non-array objects) | |
99 AryPtr, // Array pointers | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
100 // (Ptr order matters: See is_ptr, isa_ptr, is_oopptr, isa_oopptr.) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
101 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
102 MetadataPtr, // Generic metadata |
0 | 103 KlassPtr, // Klass pointers |
104 | |
105 Function, // Function signature | |
106 Abio, // Abstract I/O | |
107 Return_Address, // Subroutine return address | |
108 Memory, // Abstract store | |
109 FloatTop, // No float value | |
110 FloatCon, // Floating point constant | |
111 FloatBot, // Any float value | |
112 DoubleTop, // No double value | |
113 DoubleCon, // Double precision constant | |
114 DoubleBot, // Any double value | |
115 Bottom, // Bottom of lattice | |
116 lastype // Bogus ending type (not in lattice) | |
117 }; | |
118 | |
119 // Signal values for offsets from a base pointer | |
120 enum OFFSET_SIGNALS { | |
121 OffsetTop = -2000000000, // undefined offset | |
122 OffsetBot = -2000000001 // any possible offset | |
123 }; | |
124 | |
125 // Min and max WIDEN values. | |
126 enum WIDEN { | |
127 WidenMin = 0, | |
128 WidenMax = 3 | |
129 }; | |
130 | |
131 private: | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
132 typedef struct { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
133 const TYPES dual_type; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
134 const BasicType basic_type; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
135 const char* msg; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
136 const bool isa_oop; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
137 const int ideal_reg; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
138 const relocInfo::relocType reloc; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
139 } TypeInfo; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
140 |
0 | 141 // Dictionary of types shared among compilations. |
142 static Dict* _shared_type_dict; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
143 static TypeInfo _type_info[]; |
0 | 144 |
145 static int uhash( const Type *const t ); | |
146 // Structural equality check. Assumes that cmp() has already compared | |
147 // the _base types and thus knows it can cast 't' appropriately. | |
148 virtual bool eq( const Type *t ) const; | |
149 | |
150 // Top-level hash-table of types | |
151 static Dict *type_dict() { | |
152 return Compile::current()->type_dict(); | |
153 } | |
154 | |
155 // DUAL operation: reflect around lattice centerline. Used instead of | |
156 // join to ensure my lattice is symmetric up and down. Dual is computed | |
157 // lazily, on demand, and cached in _dual. | |
158 const Type *_dual; // Cached dual value | |
159 // Table for efficient dualing of base types | |
160 static const TYPES dual_type[lastype]; | |
161 | |
12966 | 162 #ifdef ASSERT |
163 // One type is interface, the other is oop | |
164 virtual bool interface_vs_oop_helper(const Type *t) const; | |
165 #endif | |
166 | |
0 | 167 protected: |
168 // Each class of type is also identified by its base. | |
169 const TYPES _base; // Enum of Types type | |
170 | |
171 Type( TYPES t ) : _dual(NULL), _base(t) {} // Simple types | |
172 // ~Type(); // Use fast deallocation | |
173 const Type *hashcons(); // Hash-cons the type | |
174 | |
175 public: | |
176 | |
12146
9758d9f36299
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
10278
diff
changeset
|
177 inline void* operator new( size_t x ) throw() { |
0 | 178 Compile* compile = Compile::current(); |
179 compile->set_type_last_size(x); | |
180 void *temp = compile->type_arena()->Amalloc_D(x); | |
181 compile->set_type_hwm(temp); | |
182 return temp; | |
183 } | |
184 inline void operator delete( void* ptr ) { | |
185 Compile* compile = Compile::current(); | |
186 compile->type_arena()->Afree(ptr,compile->type_last_size()); | |
187 } | |
188 | |
189 // Initialize the type system for a particular compilation. | |
190 static void Initialize(Compile* compile); | |
191 | |
192 // Initialize the types shared by all compilations. | |
193 static void Initialize_shared(Compile* compile); | |
194 | |
195 TYPES base() const { | |
196 assert(_base > Bad && _base < lastype, "sanity"); | |
197 return _base; | |
198 } | |
199 | |
200 // Create a new hash-consd type | |
201 static const Type *make(enum TYPES); | |
202 // Test for equivalence of types | |
203 static int cmp( const Type *const t1, const Type *const t2 ); | |
204 // Test for higher or equal in lattice | |
205 int higher_equal( const Type *t ) const { return !cmp(meet(t),t); } | |
206 | |
207 // MEET operation; lower in lattice. | |
208 const Type *meet( const Type *t ) const; | |
209 // WIDEN: 'widens' for Ints and other range types | |
1009
03b336640699
6885584: A particular class structure causes large allocation spike for jit
never
parents:
992
diff
changeset
|
210 virtual const Type *widen( const Type *old, const Type* limit ) const { return this; } |
0 | 211 // NARROW: complement for widen, used by pessimistic phases |
212 virtual const Type *narrow( const Type *old ) const { return this; } | |
213 | |
214 // DUAL operation: reflect around lattice centerline. Used instead of | |
215 // join to ensure my lattice is symmetric up and down. | |
216 const Type *dual() const { return _dual; } | |
217 | |
218 // Compute meet dependent on base type | |
219 virtual const Type *xmeet( const Type *t ) const; | |
220 virtual const Type *xdual() const; // Compute dual right now. | |
221 | |
222 // JOIN operation; higher in lattice. Done by finding the dual of the | |
223 // meet of the dual of the 2 inputs. | |
224 const Type *join( const Type *t ) const { | |
225 return dual()->meet(t->dual())->dual(); } | |
226 | |
227 // Modified version of JOIN adapted to the needs Node::Value. | |
228 // Normalizes all empty values to TOP. Does not kill _widen bits. | |
229 // Currently, it also works around limitations involving interface types. | |
230 virtual const Type *filter( const Type *kills ) const; | |
231 | |
820
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
232 #ifdef ASSERT |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
233 // One type is interface, the other is oop |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
234 virtual bool interface_vs_oop(const Type *t) const; |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
235 #endif |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
236 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
237 // Returns true if this pointer points at memory which contains a |
163 | 238 // compressed oop references. |
239 bool is_ptr_to_narrowoop() const; | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
240 bool is_ptr_to_narrowklass() const; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
241 |
10278 | 242 bool is_ptr_to_boxing_obj() const; |
243 | |
244 | |
0 | 245 // Convenience access |
246 float getf() const; | |
247 double getd() const; | |
248 | |
249 const TypeInt *is_int() const; | |
250 const TypeInt *isa_int() const; // Returns NULL if not an Int | |
251 const TypeLong *is_long() const; | |
252 const TypeLong *isa_long() const; // Returns NULL if not a Long | |
7194
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
253 const TypeD *isa_double() const; // Returns NULL if not a Double{Top,Con,Bot} |
0 | 254 const TypeD *is_double_constant() const; // Asserts it is a DoubleCon |
255 const TypeD *isa_double_constant() const; // Returns NULL if not a DoubleCon | |
7194
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
256 const TypeF *isa_float() const; // Returns NULL if not a Float{Top,Con,Bot} |
0 | 257 const TypeF *is_float_constant() const; // Asserts it is a FloatCon |
258 const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon | |
259 const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer | |
260 const TypeAry *is_ary() const; // Array, NOT array pointer | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
261 const TypeVect *is_vect() const; // Vector |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
262 const TypeVect *isa_vect() const; // Returns NULL if not a Vector |
0 | 263 const TypePtr *is_ptr() const; // Asserts it is a ptr type |
264 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
265 const TypeRawPtr *isa_rawptr() const; // NOT Java oop |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
266 const TypeRawPtr *is_rawptr() const; // Asserts is rawptr |
163 | 267 const TypeNarrowOop *is_narrowoop() const; // Java-style GC'd pointer |
268 const TypeNarrowOop *isa_narrowoop() const; // Returns NULL if not oop ptr type | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
269 const TypeNarrowKlass *is_narrowklass() const; // compressed klass pointer |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
270 const TypeNarrowKlass *isa_narrowklass() const;// Returns NULL if not oop ptr type |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
271 const TypeOopPtr *isa_oopptr() const; // Returns NULL if not oop ptr type |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
272 const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
273 const TypeInstPtr *isa_instptr() const; // Returns NULL if not InstPtr |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
274 const TypeInstPtr *is_instptr() const; // Instance |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
275 const TypeAryPtr *isa_aryptr() const; // Returns NULL if not AryPtr |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
276 const TypeAryPtr *is_aryptr() const; // Array oop |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
277 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
278 const TypeMetadataPtr *isa_metadataptr() const; // Returns NULL if not oop ptr type |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
279 const TypeMetadataPtr *is_metadataptr() const; // Java-style GC'd pointer |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
280 const TypeKlassPtr *isa_klassptr() const; // Returns NULL if not KlassPtr |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
281 const TypeKlassPtr *is_klassptr() const; // assert if not KlassPtr |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
282 |
0 | 283 virtual bool is_finite() const; // Has a finite value |
284 virtual bool is_nan() const; // Is not a number (NaN) | |
285 | |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
286 // Returns this ptr type or the equivalent ptr type for this compressed pointer. |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
287 const TypePtr* make_ptr() const; |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
288 |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
289 // Returns this oopptr type or the equivalent oopptr type for this compressed pointer. |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
290 // Asserts if the underlying type is not an oopptr or narrowoop. |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
291 const TypeOopPtr* make_oopptr() const; |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
292 |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
293 // Returns this compressed pointer or the equivalent compressed version |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
294 // of this pointer type. |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
295 const TypeNarrowOop* make_narrowoop() const; |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
296 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
297 // Returns this compressed klass pointer or the equivalent |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
298 // compressed version of this pointer type. |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
299 const TypeNarrowKlass* make_narrowklass() const; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
300 |
0 | 301 // Special test for register pressure heuristic |
302 bool is_floatingpoint() const; // True if Float or Double base type | |
303 | |
304 // Do you have memory, directly or through a tuple? | |
305 bool has_memory( ) const; | |
306 | |
307 // TRUE if type is a singleton | |
308 virtual bool singleton(void) const; | |
309 | |
310 // TRUE if type is above the lattice centerline, and is therefore vacuous | |
311 virtual bool empty(void) const; | |
312 | |
313 // Return a hash for this type. The hash function is public so ConNode | |
314 // (constants) can hash on their constant, which is represented by a Type. | |
315 virtual int hash() const; | |
316 | |
317 // Map ideal registers (machine types) to ideal types | |
318 static const Type *mreg2type[]; | |
319 | |
320 // Printing, statistics | |
321 #ifndef PRODUCT | |
322 void dump_on(outputStream *st) const; | |
323 void dump() const { | |
324 dump_on(tty); | |
325 } | |
326 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
327 static void dump_stats(); | |
328 #endif | |
329 void typerr(const Type *t) const; // Mixing types error | |
330 | |
331 // Create basic type | |
332 static const Type* get_const_basic_type(BasicType type) { | |
333 assert((uint)type <= T_CONFLICT && _const_basic_type[type] != NULL, "bad type"); | |
334 return _const_basic_type[type]; | |
335 } | |
336 | |
337 // Mapping to the array element's basic type. | |
338 BasicType array_element_basic_type() const; | |
339 | |
340 // Create standard type for a ciType: | |
341 static const Type* get_const_type(ciType* type); | |
342 | |
343 // Create standard zero value: | |
344 static const Type* get_zero_type(BasicType type) { | |
345 assert((uint)type <= T_CONFLICT && _zero_type[type] != NULL, "bad type"); | |
346 return _zero_type[type]; | |
347 } | |
348 | |
349 // Report if this is a zero value (not top). | |
350 bool is_zero_type() const { | |
351 BasicType type = basic_type(); | |
352 if (type == T_VOID || type >= T_CONFLICT) | |
353 return false; | |
354 else | |
355 return (this == _zero_type[type]); | |
356 } | |
357 | |
358 // Convenience common pre-built types. | |
359 static const Type *ABIO; | |
360 static const Type *BOTTOM; | |
361 static const Type *CONTROL; | |
362 static const Type *DOUBLE; | |
363 static const Type *FLOAT; | |
364 static const Type *HALF; | |
365 static const Type *MEMORY; | |
366 static const Type *MULTI; | |
367 static const Type *RETURN_ADDRESS; | |
368 static const Type *TOP; | |
369 | |
370 // Mapping from compiler type to VM BasicType | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
371 BasicType basic_type() const { return _type_info[_base].basic_type; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
372 int ideal_reg() const { return _type_info[_base].ideal_reg; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
373 const char* msg() const { return _type_info[_base].msg; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
374 bool isa_oop_ptr() const { return _type_info[_base].isa_oop; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
375 relocInfo::relocType reloc() const { return _type_info[_base].reloc; } |
0 | 376 |
377 // Mapping from CI type system to compiler type: | |
378 static const Type* get_typeflow_type(ciType* type); | |
379 | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
380 static const Type* make_from_constant(ciConstant constant, |
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
381 bool require_constant = false, |
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
382 bool is_autobox_cache = false); |
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
383 |
12966 | 384 // Speculative type. See TypeInstPtr |
385 virtual ciKlass* speculative_type() const { return NULL; } | |
386 | |
0 | 387 private: |
388 // support arrays | |
389 static const BasicType _basic_type[]; | |
390 static const Type* _zero_type[T_CONFLICT+1]; | |
391 static const Type* _const_basic_type[T_CONFLICT+1]; | |
392 }; | |
393 | |
394 //------------------------------TypeF------------------------------------------ | |
395 // Class of Float-Constant Types. | |
396 class TypeF : public Type { | |
397 TypeF( float f ) : Type(FloatCon), _f(f) {}; | |
398 public: | |
399 virtual bool eq( const Type *t ) const; | |
400 virtual int hash() const; // Type specific hashing | |
401 virtual bool singleton(void) const; // TRUE if type is a singleton | |
402 virtual bool empty(void) const; // TRUE if type is vacuous | |
403 public: | |
404 const float _f; // Float constant | |
405 | |
406 static const TypeF *make(float f); | |
407 | |
408 virtual bool is_finite() const; // Has a finite value | |
409 virtual bool is_nan() const; // Is not a number (NaN) | |
410 | |
411 virtual const Type *xmeet( const Type *t ) const; | |
412 virtual const Type *xdual() const; // Compute dual right now. | |
413 // Convenience common pre-built types. | |
414 static const TypeF *ZERO; // positive zero only | |
415 static const TypeF *ONE; | |
416 #ifndef PRODUCT | |
417 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
418 #endif | |
419 }; | |
420 | |
421 //------------------------------TypeD------------------------------------------ | |
422 // Class of Double-Constant Types. | |
423 class TypeD : public Type { | |
424 TypeD( double d ) : Type(DoubleCon), _d(d) {}; | |
425 public: | |
426 virtual bool eq( const Type *t ) const; | |
427 virtual int hash() const; // Type specific hashing | |
428 virtual bool singleton(void) const; // TRUE if type is a singleton | |
429 virtual bool empty(void) const; // TRUE if type is vacuous | |
430 public: | |
431 const double _d; // Double constant | |
432 | |
433 static const TypeD *make(double d); | |
434 | |
435 virtual bool is_finite() const; // Has a finite value | |
436 virtual bool is_nan() const; // Is not a number (NaN) | |
437 | |
438 virtual const Type *xmeet( const Type *t ) const; | |
439 virtual const Type *xdual() const; // Compute dual right now. | |
440 // Convenience common pre-built types. | |
441 static const TypeD *ZERO; // positive zero only | |
442 static const TypeD *ONE; | |
443 #ifndef PRODUCT | |
444 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
445 #endif | |
446 }; | |
447 | |
448 //------------------------------TypeInt---------------------------------------- | |
449 // Class of integer ranges, the set of integers between a lower bound and an | |
450 // upper bound, inclusive. | |
451 class TypeInt : public Type { | |
452 TypeInt( jint lo, jint hi, int w ); | |
453 public: | |
454 virtual bool eq( const Type *t ) const; | |
455 virtual int hash() const; // Type specific hashing | |
456 virtual bool singleton(void) const; // TRUE if type is a singleton | |
457 virtual bool empty(void) const; // TRUE if type is vacuous | |
458 public: | |
459 const jint _lo, _hi; // Lower bound, upper bound | |
460 const short _widen; // Limit on times we widen this sucker | |
461 | |
462 static const TypeInt *make(jint lo); | |
463 // must always specify w | |
464 static const TypeInt *make(jint lo, jint hi, int w); | |
465 | |
466 // Check for single integer | |
467 int is_con() const { return _lo==_hi; } | |
468 bool is_con(int i) const { return is_con() && _lo == i; } | |
469 jint get_con() const { assert( is_con(), "" ); return _lo; } | |
470 | |
471 virtual bool is_finite() const; // Has a finite value | |
472 | |
473 virtual const Type *xmeet( const Type *t ) const; | |
474 virtual const Type *xdual() const; // Compute dual right now. | |
1009
03b336640699
6885584: A particular class structure causes large allocation spike for jit
never
parents:
992
diff
changeset
|
475 virtual const Type *widen( const Type *t, const Type* limit_type ) const; |
0 | 476 virtual const Type *narrow( const Type *t ) const; |
477 // Do not kill _widen bits. | |
478 virtual const Type *filter( const Type *kills ) const; | |
479 // Convenience common pre-built types. | |
480 static const TypeInt *MINUS_1; | |
481 static const TypeInt *ZERO; | |
482 static const TypeInt *ONE; | |
483 static const TypeInt *BOOL; | |
484 static const TypeInt *CC; | |
485 static const TypeInt *CC_LT; // [-1] == MINUS_1 | |
486 static const TypeInt *CC_GT; // [1] == ONE | |
487 static const TypeInt *CC_EQ; // [0] == ZERO | |
488 static const TypeInt *CC_LE; // [-1,0] | |
489 static const TypeInt *CC_GE; // [0,1] == BOOL (!) | |
490 static const TypeInt *BYTE; | |
624 | 491 static const TypeInt *UBYTE; |
0 | 492 static const TypeInt *CHAR; |
493 static const TypeInt *SHORT; | |
494 static const TypeInt *POS; | |
495 static const TypeInt *POS1; | |
496 static const TypeInt *INT; | |
497 static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint] | |
498 #ifndef PRODUCT | |
499 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
500 #endif | |
501 }; | |
502 | |
503 | |
504 //------------------------------TypeLong--------------------------------------- | |
505 // Class of long integer ranges, the set of integers between a lower bound and | |
506 // an upper bound, inclusive. | |
507 class TypeLong : public Type { | |
508 TypeLong( jlong lo, jlong hi, int w ); | |
509 public: | |
510 virtual bool eq( const Type *t ) const; | |
511 virtual int hash() const; // Type specific hashing | |
512 virtual bool singleton(void) const; // TRUE if type is a singleton | |
513 virtual bool empty(void) const; // TRUE if type is vacuous | |
514 public: | |
515 const jlong _lo, _hi; // Lower bound, upper bound | |
516 const short _widen; // Limit on times we widen this sucker | |
517 | |
518 static const TypeLong *make(jlong lo); | |
519 // must always specify w | |
520 static const TypeLong *make(jlong lo, jlong hi, int w); | |
521 | |
522 // Check for single integer | |
523 int is_con() const { return _lo==_hi; } | |
145 | 524 bool is_con(int i) const { return is_con() && _lo == i; } |
0 | 525 jlong get_con() const { assert( is_con(), "" ); return _lo; } |
526 | |
527 virtual bool is_finite() const; // Has a finite value | |
528 | |
529 virtual const Type *xmeet( const Type *t ) const; | |
530 virtual const Type *xdual() const; // Compute dual right now. | |
1009
03b336640699
6885584: A particular class structure causes large allocation spike for jit
never
parents:
992
diff
changeset
|
531 virtual const Type *widen( const Type *t, const Type* limit_type ) const; |
0 | 532 virtual const Type *narrow( const Type *t ) const; |
533 // Do not kill _widen bits. | |
534 virtual const Type *filter( const Type *kills ) const; | |
535 // Convenience common pre-built types. | |
536 static const TypeLong *MINUS_1; | |
537 static const TypeLong *ZERO; | |
538 static const TypeLong *ONE; | |
539 static const TypeLong *POS; | |
540 static const TypeLong *LONG; | |
541 static const TypeLong *INT; // 32-bit subrange [min_jint..max_jint] | |
542 static const TypeLong *UINT; // 32-bit unsigned [0..max_juint] | |
543 #ifndef PRODUCT | |
544 virtual void dump2( Dict &d, uint, outputStream *st ) const;// Specialized per-Type dumping | |
545 #endif | |
546 }; | |
547 | |
548 //------------------------------TypeTuple-------------------------------------- | |
549 // Class of Tuple Types, essentially type collections for function signatures | |
550 // and class layouts. It happens to also be a fast cache for the HotSpot | |
551 // signature types. | |
552 class TypeTuple : public Type { | |
553 TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { } | |
554 public: | |
555 virtual bool eq( const Type *t ) const; | |
556 virtual int hash() const; // Type specific hashing | |
557 virtual bool singleton(void) const; // TRUE if type is a singleton | |
558 virtual bool empty(void) const; // TRUE if type is vacuous | |
559 | |
560 public: | |
561 const uint _cnt; // Count of fields | |
562 const Type ** const _fields; // Array of field types | |
563 | |
564 // Accessors: | |
565 uint cnt() const { return _cnt; } | |
566 const Type* field_at(uint i) const { | |
567 assert(i < _cnt, "oob"); | |
568 return _fields[i]; | |
569 } | |
570 void set_field_at(uint i, const Type* t) { | |
571 assert(i < _cnt, "oob"); | |
572 _fields[i] = t; | |
573 } | |
574 | |
575 static const TypeTuple *make( uint cnt, const Type **fields ); | |
576 static const TypeTuple *make_range(ciSignature *sig); | |
577 static const TypeTuple *make_domain(ciInstanceKlass* recv, ciSignature *sig); | |
578 | |
579 // Subroutine call type with space allocated for argument types | |
580 static const Type **fields( uint arg_cnt ); | |
581 | |
582 virtual const Type *xmeet( const Type *t ) const; | |
583 virtual const Type *xdual() const; // Compute dual right now. | |
584 // Convenience common pre-built types. | |
585 static const TypeTuple *IFBOTH; | |
586 static const TypeTuple *IFFALSE; | |
587 static const TypeTuple *IFTRUE; | |
588 static const TypeTuple *IFNEITHER; | |
589 static const TypeTuple *LOOPBODY; | |
590 static const TypeTuple *MEMBAR; | |
591 static const TypeTuple *STORECONDITIONAL; | |
592 static const TypeTuple *START_I2C; | |
593 static const TypeTuple *INT_PAIR; | |
594 static const TypeTuple *LONG_PAIR; | |
12323 | 595 static const TypeTuple *INT_CC_PAIR; |
0 | 596 #ifndef PRODUCT |
597 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping | |
598 #endif | |
599 }; | |
600 | |
601 //------------------------------TypeAry---------------------------------------- | |
602 // Class of Array Types | |
603 class TypeAry : public Type { | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
604 TypeAry(const Type* elem, const TypeInt* size, bool stable) : Type(Array), |
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
605 _elem(elem), _size(size), _stable(stable) {} |
0 | 606 public: |
607 virtual bool eq( const Type *t ) const; | |
608 virtual int hash() const; // Type specific hashing | |
609 virtual bool singleton(void) const; // TRUE if type is a singleton | |
610 virtual bool empty(void) const; // TRUE if type is vacuous | |
611 | |
612 private: | |
613 const Type *_elem; // Element type of array | |
614 const TypeInt *_size; // Elements in array | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
615 const bool _stable; // Are elements @Stable? |
0 | 616 friend class TypeAryPtr; |
617 | |
618 public: | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
619 static const TypeAry* make(const Type* elem, const TypeInt* size, bool stable = false); |
0 | 620 |
621 virtual const Type *xmeet( const Type *t ) const; | |
622 virtual const Type *xdual() const; // Compute dual right now. | |
623 bool ary_must_be_exact() const; // true if arrays of such are never generic | |
820
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
624 #ifdef ASSERT |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
625 // One type is interface, the other is oop |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
626 virtual bool interface_vs_oop(const Type *t) const; |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
627 #endif |
0 | 628 #ifndef PRODUCT |
629 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping | |
630 #endif | |
631 }; | |
632 | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
633 //------------------------------TypeVect--------------------------------------- |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
634 // Class of Vector Types |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
635 class TypeVect : public Type { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
636 const Type* _elem; // Vector's element type |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
637 const uint _length; // Elements in vector (power of 2) |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
638 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
639 protected: |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
640 TypeVect(TYPES t, const Type* elem, uint length) : Type(t), |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
641 _elem(elem), _length(length) {} |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
642 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
643 public: |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
644 const Type* element_type() const { return _elem; } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
645 BasicType element_basic_type() const { return _elem->array_element_basic_type(); } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
646 uint length() const { return _length; } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
647 uint length_in_bytes() const { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
648 return _length * type2aelembytes(element_basic_type()); |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
649 } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
650 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
651 virtual bool eq(const Type *t) const; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
652 virtual int hash() const; // Type specific hashing |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
653 virtual bool singleton(void) const; // TRUE if type is a singleton |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
654 virtual bool empty(void) const; // TRUE if type is vacuous |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
655 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
656 static const TypeVect *make(const BasicType elem_bt, uint length) { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
657 // Use bottom primitive type. |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
658 return make(get_const_basic_type(elem_bt), length); |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
659 } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
660 // Used directly by Replicate nodes to construct singleton vector. |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
661 static const TypeVect *make(const Type* elem, uint length); |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
662 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
663 virtual const Type *xmeet( const Type *t) const; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
664 virtual const Type *xdual() const; // Compute dual right now. |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
665 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
666 static const TypeVect *VECTS; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
667 static const TypeVect *VECTD; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
668 static const TypeVect *VECTX; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
669 static const TypeVect *VECTY; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
670 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
671 #ifndef PRODUCT |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
672 virtual void dump2(Dict &d, uint, outputStream *st) const; // Specialized per-Type dumping |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
673 #endif |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
674 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
675 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
676 class TypeVectS : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
677 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
678 TypeVectS(const Type* elem, uint length) : TypeVect(VectorS, elem, length) {} |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
679 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
680 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
681 class TypeVectD : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
682 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
683 TypeVectD(const Type* elem, uint length) : TypeVect(VectorD, elem, length) {} |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
684 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
685 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
686 class TypeVectX : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
687 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
688 TypeVectX(const Type* elem, uint length) : TypeVect(VectorX, elem, length) {} |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
689 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
690 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
691 class TypeVectY : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
692 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
693 TypeVectY(const Type* elem, uint length) : TypeVect(VectorY, elem, length) {} |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
694 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
695 |
0 | 696 //------------------------------TypePtr---------------------------------------- |
697 // Class of machine Pointer Types: raw data, instances or arrays. | |
698 // If the _base enum is AnyPtr, then this refers to all of the above. | |
699 // Otherwise the _base will indicate which subset of pointers is affected, | |
700 // and the class will be inherited from. | |
701 class TypePtr : public Type { | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
702 friend class TypeNarrowPtr; |
0 | 703 public: |
704 enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR }; | |
705 protected: | |
706 TypePtr( TYPES t, PTR ptr, int offset ) : Type(t), _ptr(ptr), _offset(offset) {} | |
707 virtual bool eq( const Type *t ) const; | |
708 virtual int hash() const; // Type specific hashing | |
709 static const PTR ptr_meet[lastPTR][lastPTR]; | |
710 static const PTR ptr_dual[lastPTR]; | |
711 static const char * const ptr_msg[lastPTR]; | |
712 | |
713 public: | |
714 const int _offset; // Offset into oop, with TOP & BOT | |
715 const PTR _ptr; // Pointer equivalence class | |
716 | |
717 const int offset() const { return _offset; } | |
718 const PTR ptr() const { return _ptr; } | |
719 | |
720 static const TypePtr *make( TYPES t, PTR ptr, int offset ); | |
721 | |
722 // Return a 'ptr' version of this type | |
723 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
724 | |
725 virtual intptr_t get_con() const; | |
726 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
727 int xadd_offset( intptr_t offset ) const; |
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
728 virtual const TypePtr *add_offset( intptr_t offset ) const; |
0 | 729 |
730 virtual bool singleton(void) const; // TRUE if type is a singleton | |
731 virtual bool empty(void) const; // TRUE if type is vacuous | |
732 virtual const Type *xmeet( const Type *t ) const; | |
733 int meet_offset( int offset ) const; | |
734 int dual_offset( ) const; | |
735 virtual const Type *xdual() const; // Compute dual right now. | |
736 | |
737 // meet, dual and join over pointer equivalence sets | |
738 PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; } | |
739 PTR dual_ptr() const { return ptr_dual[ptr()]; } | |
740 | |
741 // This is textually confusing unless one recalls that | |
742 // join(t) == dual()->meet(t->dual())->dual(). | |
743 PTR join_ptr( const PTR in_ptr ) const { | |
744 return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ]; | |
745 } | |
746 | |
747 // Tests for relation to centerline of type lattice: | |
748 static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); } | |
749 static bool below_centerline(PTR ptr) { return (ptr >= NotNull); } | |
750 // Convenience common pre-built types. | |
751 static const TypePtr *NULL_PTR; | |
752 static const TypePtr *NOTNULL; | |
753 static const TypePtr *BOTTOM; | |
754 #ifndef PRODUCT | |
755 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
756 #endif | |
757 }; | |
758 | |
759 //------------------------------TypeRawPtr------------------------------------- | |
760 // Class of raw pointers, pointers to things other than Oops. Examples | |
761 // include the stack pointer, top of heap, card-marking area, handles, etc. | |
762 class TypeRawPtr : public TypePtr { | |
763 protected: | |
764 TypeRawPtr( PTR ptr, address bits ) : TypePtr(RawPtr,ptr,0), _bits(bits){} | |
765 public: | |
766 virtual bool eq( const Type *t ) const; | |
767 virtual int hash() const; // Type specific hashing | |
768 | |
769 const address _bits; // Constant value, if applicable | |
770 | |
771 static const TypeRawPtr *make( PTR ptr ); | |
772 static const TypeRawPtr *make( address bits ); | |
773 | |
774 // Return a 'ptr' version of this type | |
775 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
776 | |
777 virtual intptr_t get_con() const; | |
778 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
779 virtual const TypePtr *add_offset( intptr_t offset ) const; |
0 | 780 |
781 virtual const Type *xmeet( const Type *t ) const; | |
782 virtual const Type *xdual() const; // Compute dual right now. | |
783 // Convenience common pre-built types. | |
784 static const TypeRawPtr *BOTTOM; | |
785 static const TypeRawPtr *NOTNULL; | |
786 #ifndef PRODUCT | |
787 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
788 #endif | |
789 }; | |
790 | |
791 //------------------------------TypeOopPtr------------------------------------- | |
792 // Some kind of oop (Java pointer), either klass or instance or array. | |
793 class TypeOopPtr : public TypePtr { | |
794 protected: | |
12966 | 795 TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id, const TypeOopPtr* speculative); |
0 | 796 public: |
797 virtual bool eq( const Type *t ) const; | |
798 virtual int hash() const; // Type specific hashing | |
799 virtual bool singleton(void) const; // TRUE if type is a singleton | |
800 enum { | |
223 | 801 InstanceTop = -1, // undefined instance |
802 InstanceBot = 0 // any possible instance | |
0 | 803 }; |
804 protected: | |
805 | |
806 // Oop is NULL, unless this is a constant oop. | |
807 ciObject* _const_oop; // Constant oop | |
808 // If _klass is NULL, then so is _sig. This is an unloaded klass. | |
809 ciKlass* _klass; // Klass object | |
810 // Does the type exclude subclasses of the klass? (Inexact == polymorphic.) | |
811 bool _klass_is_exact; | |
163 | 812 bool _is_ptr_to_narrowoop; |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
813 bool _is_ptr_to_narrowklass; |
10278 | 814 bool _is_ptr_to_boxed_value; |
0 | 815 |
223 | 816 // If not InstanceTop or InstanceBot, indicates that this is |
817 // a particular instance of this type which is distinct. | |
818 // This is the the node index of the allocation node creating this instance. | |
819 int _instance_id; | |
0 | 820 |
12966 | 821 // Extra type information profiling gave us. We propagate it the |
822 // same way the rest of the type info is propagated. If we want to | |
823 // use it, then we have to emit a guard: this part of the type is | |
824 // not something we know but something we speculate about the type. | |
825 const TypeOopPtr* _speculative; | |
826 | |
0 | 827 static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact); |
828 | |
223 | 829 int dual_instance_id() const; |
830 int meet_instance_id(int uid) const; | |
0 | 831 |
12966 | 832 // utility methods to work on the speculative part of the type |
833 const TypeOopPtr* dual_speculative() const; | |
834 const TypeOopPtr* meet_speculative(const TypeOopPtr* other) const; | |
835 bool eq_speculative(const TypeOopPtr* other) const; | |
836 int hash_speculative() const; | |
837 const TypeOopPtr* add_offset_speculative(intptr_t offset) const; | |
838 #ifndef PRODUCT | |
839 void dump_speculative(outputStream *st) const; | |
840 #endif | |
841 | |
0 | 842 public: |
843 // Creates a type given a klass. Correctly handles multi-dimensional arrays | |
844 // Respects UseUniqueSubclasses. | |
845 // If the klass is final, the resulting type will be exact. | |
846 static const TypeOopPtr* make_from_klass(ciKlass* klass) { | |
847 return make_from_klass_common(klass, true, false); | |
848 } | |
849 // Same as before, but will produce an exact type, even if | |
850 // the klass is not final, as long as it has exactly one implementation. | |
851 static const TypeOopPtr* make_from_klass_unique(ciKlass* klass) { | |
852 return make_from_klass_common(klass, true, true); | |
853 } | |
854 // Same as before, but does not respects UseUniqueSubclasses. | |
855 // Use this only for creating array element types. | |
856 static const TypeOopPtr* make_from_klass_raw(ciKlass* klass) { | |
857 return make_from_klass_common(klass, false, false); | |
858 } | |
859 // Creates a singleton type given an object. | |
989
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
958
diff
changeset
|
860 // If the object cannot be rendered as a constant, |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
958
diff
changeset
|
861 // may return a non-singleton type. |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
958
diff
changeset
|
862 // If require_constant, produce a NULL if a singleton is not possible. |
10278 | 863 static const TypeOopPtr* make_from_constant(ciObject* o, |
864 bool require_constant = false, | |
865 bool not_null_elements = false); | |
0 | 866 |
867 // Make a generic (unclassed) pointer to an oop. | |
12966 | 868 static const TypeOopPtr* make(PTR ptr, int offset, int instance_id, const TypeOopPtr* speculative); |
0 | 869 |
870 ciObject* const_oop() const { return _const_oop; } | |
871 virtual ciKlass* klass() const { return _klass; } | |
872 bool klass_is_exact() const { return _klass_is_exact; } | |
163 | 873 |
874 // Returns true if this pointer points at memory which contains a | |
875 // compressed oop references. | |
876 bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; } | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
877 bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; } |
10278 | 878 bool is_ptr_to_boxed_value() const { return _is_ptr_to_boxed_value; } |
223 | 879 bool is_known_instance() const { return _instance_id > 0; } |
880 int instance_id() const { return _instance_id; } | |
881 bool is_known_instance_field() const { return is_known_instance() && _offset >= 0; } | |
12966 | 882 const TypeOopPtr* speculative() const { return _speculative; } |
0 | 883 |
884 virtual intptr_t get_con() const; | |
885 | |
886 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
887 | |
888 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
889 | |
223 | 890 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; |
0 | 891 |
892 // corresponding pointer to klass, for a given instance | |
893 const TypeKlassPtr* as_klass_type() const; | |
894 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
895 virtual const TypePtr *add_offset( intptr_t offset ) const; |
12966 | 896 // Return same type without a speculative part |
897 virtual const TypeOopPtr* remove_speculative() const; | |
0 | 898 |
12966 | 899 virtual const Type *xmeet(const Type *t) const; |
0 | 900 virtual const Type *xdual() const; // Compute dual right now. |
12966 | 901 // the core of the computation of the meet for TypeOopPtr and for its subclasses |
902 virtual const Type *xmeet_helper(const Type *t) const; | |
0 | 903 |
904 // Do not allow interface-vs.-noninterface joins to collapse to top. | |
905 virtual const Type *filter( const Type *kills ) const; | |
906 | |
907 // Convenience common pre-built type. | |
908 static const TypeOopPtr *BOTTOM; | |
909 #ifndef PRODUCT | |
910 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
911 #endif | |
12966 | 912 |
913 // Return the speculative type if any | |
914 ciKlass* speculative_type() const { | |
915 if (_speculative != NULL) { | |
916 const TypeOopPtr* speculative = _speculative->join(this)->is_oopptr(); | |
917 if (speculative->klass_is_exact()) { | |
918 return speculative->klass(); | |
919 } | |
920 } | |
921 return NULL; | |
922 } | |
0 | 923 }; |
924 | |
925 //------------------------------TypeInstPtr------------------------------------ | |
926 // Class of Java object pointers, pointing either to non-array Java instances | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
927 // or to a Klass* (including array klasses). |
0 | 928 class TypeInstPtr : public TypeOopPtr { |
12966 | 929 TypeInstPtr(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id, const TypeOopPtr* speculative); |
0 | 930 virtual bool eq( const Type *t ) const; |
931 virtual int hash() const; // Type specific hashing | |
932 | |
933 ciSymbol* _name; // class name | |
934 | |
935 public: | |
936 ciSymbol* name() const { return _name; } | |
937 | |
938 bool is_loaded() const { return _klass->is_loaded(); } | |
939 | |
940 // Make a pointer to a constant oop. | |
941 static const TypeInstPtr *make(ciObject* o) { | |
12966 | 942 return make(TypePtr::Constant, o->klass(), true, o, 0, InstanceBot); |
0 | 943 } |
944 // Make a pointer to a constant oop with offset. | |
945 static const TypeInstPtr *make(ciObject* o, int offset) { | |
12966 | 946 return make(TypePtr::Constant, o->klass(), true, o, offset, InstanceBot); |
0 | 947 } |
948 | |
949 // Make a pointer to some value of type klass. | |
950 static const TypeInstPtr *make(PTR ptr, ciKlass* klass) { | |
12966 | 951 return make(ptr, klass, false, NULL, 0, InstanceBot); |
0 | 952 } |
953 | |
954 // Make a pointer to some non-polymorphic value of exactly type klass. | |
955 static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) { | |
12966 | 956 return make(ptr, klass, true, NULL, 0, InstanceBot); |
0 | 957 } |
958 | |
959 // Make a pointer to some value of type klass with offset. | |
960 static const TypeInstPtr *make(PTR ptr, ciKlass* klass, int offset) { | |
12966 | 961 return make(ptr, klass, false, NULL, offset, InstanceBot); |
0 | 962 } |
963 | |
964 // Make a pointer to an oop. | |
12966 | 965 static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL); |
0 | 966 |
10278 | 967 /** Create constant type for a constant boxed value */ |
968 const Type* get_const_boxed_value() const; | |
969 | |
0 | 970 // If this is a java.lang.Class constant, return the type for it or NULL. |
971 // Pass to Type::get_const_type to turn it to a type, which will usually | |
972 // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc. | |
973 ciType* java_mirror_type() const; | |
974 | |
975 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
976 | |
977 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
978 | |
223 | 979 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; |
0 | 980 |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
981 virtual const TypePtr *add_offset( intptr_t offset ) const; |
12966 | 982 // Return same type without a speculative part |
983 virtual const TypeOopPtr* remove_speculative() const; | |
0 | 984 |
12966 | 985 // the core of the computation of the meet of 2 types |
986 virtual const Type *xmeet_helper(const Type *t) const; | |
0 | 987 virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const; |
988 virtual const Type *xdual() const; // Compute dual right now. | |
989 | |
990 // Convenience common pre-built types. | |
991 static const TypeInstPtr *NOTNULL; | |
992 static const TypeInstPtr *BOTTOM; | |
993 static const TypeInstPtr *MIRROR; | |
994 static const TypeInstPtr *MARK; | |
995 static const TypeInstPtr *KLASS; | |
996 #ifndef PRODUCT | |
997 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
998 #endif | |
999 }; | |
1000 | |
1001 //------------------------------TypeAryPtr------------------------------------- | |
1002 // Class of Java array pointers | |
1003 class TypeAryPtr : public TypeOopPtr { | |
10278 | 1004 TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, |
12966 | 1005 int offset, int instance_id, bool is_autobox_cache, const TypeOopPtr* speculative) |
1006 : TypeOopPtr(AryPtr,ptr,k,xk,o,offset, instance_id, speculative), | |
10278 | 1007 _ary(ary), |
1008 _is_autobox_cache(is_autobox_cache) | |
1009 { | |
1761 | 1010 #ifdef ASSERT |
1011 if (k != NULL) { | |
1012 // Verify that specified klass and TypeAryPtr::klass() follow the same rules. | |
1013 ciKlass* ck = compute_klass(true); | |
1792 | 1014 if (k != ck) { |
1761 | 1015 this->dump(); tty->cr(); |
1016 tty->print(" k: "); | |
1017 k->print(); tty->cr(); | |
1018 tty->print("ck: "); | |
1019 if (ck != NULL) ck->print(); | |
1020 else tty->print("<NULL>"); | |
1021 tty->cr(); | |
1022 assert(false, "unexpected TypeAryPtr::_klass"); | |
1023 } | |
1024 } | |
1025 #endif | |
1026 } | |
0 | 1027 virtual bool eq( const Type *t ) const; |
1028 virtual int hash() const; // Type specific hashing | |
1029 const TypeAry *_ary; // Array we point into | |
10278 | 1030 const bool _is_autobox_cache; |
0 | 1031 |
1761 | 1032 ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const; |
1033 | |
0 | 1034 public: |
1035 // Accessors | |
1036 ciKlass* klass() const; | |
1037 const TypeAry* ary() const { return _ary; } | |
1038 const Type* elem() const { return _ary->_elem; } | |
1039 const TypeInt* size() const { return _ary->_size; } | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
1040 bool is_stable() const { return _ary->_stable; } |
0 | 1041 |
10278 | 1042 bool is_autobox_cache() const { return _is_autobox_cache; } |
1043 | |
12966 | 1044 static const TypeAryPtr *make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL); |
0 | 1045 // Constant pointer to array |
12966 | 1046 static const TypeAryPtr *make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL, bool is_autobox_cache = false); |
0 | 1047 |
1048 // Return a 'ptr' version of this type | |
1049 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
1050 | |
1051 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
1052 | |
223 | 1053 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; |
0 | 1054 |
1055 virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const; | |
366
8261ee795323
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
306
diff
changeset
|
1056 virtual const TypeInt* narrow_size_type(const TypeInt* size) const; |
0 | 1057 |
1058 virtual bool empty(void) const; // TRUE if type is vacuous | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
1059 virtual const TypePtr *add_offset( intptr_t offset ) const; |
12966 | 1060 // Return same type without a speculative part |
1061 virtual const TypeOopPtr* remove_speculative() const; | |
0 | 1062 |
12966 | 1063 // the core of the computation of the meet of 2 types |
1064 virtual const Type *xmeet_helper(const Type *t) const; | |
0 | 1065 virtual const Type *xdual() const; // Compute dual right now. |
1066 | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
1067 const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const; |
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
1068 int stable_dimension() const; |
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
1069 |
0 | 1070 // Convenience common pre-built types. |
1071 static const TypeAryPtr *RANGE; | |
1072 static const TypeAryPtr *OOPS; | |
163 | 1073 static const TypeAryPtr *NARROWOOPS; |
0 | 1074 static const TypeAryPtr *BYTES; |
1075 static const TypeAryPtr *SHORTS; | |
1076 static const TypeAryPtr *CHARS; | |
1077 static const TypeAryPtr *INTS; | |
1078 static const TypeAryPtr *LONGS; | |
1079 static const TypeAryPtr *FLOATS; | |
1080 static const TypeAryPtr *DOUBLES; | |
1081 // selects one of the above: | |
1082 static const TypeAryPtr *get_array_body_type(BasicType elem) { | |
1083 assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != NULL, "bad elem type"); | |
1084 return _array_body_type[elem]; | |
1085 } | |
1086 static const TypeAryPtr *_array_body_type[T_CONFLICT+1]; | |
1087 // sharpen the type of an int which is used as an array size | |
820
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
1088 #ifdef ASSERT |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
1089 // One type is interface, the other is oop |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
1090 virtual bool interface_vs_oop(const Type *t) const; |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
1091 #endif |
0 | 1092 #ifndef PRODUCT |
1093 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
1094 #endif | |
1095 }; | |
1096 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1097 //------------------------------TypeMetadataPtr------------------------------------- |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1098 // Some kind of metadata, either Method*, MethodData* or CPCacheOop |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1099 class TypeMetadataPtr : public TypePtr { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1100 protected: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1101 TypeMetadataPtr(PTR ptr, ciMetadata* metadata, int offset); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1102 public: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1103 virtual bool eq( const Type *t ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1104 virtual int hash() const; // Type specific hashing |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1105 virtual bool singleton(void) const; // TRUE if type is a singleton |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1106 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1107 private: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1108 ciMetadata* _metadata; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1109 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1110 public: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1111 static const TypeMetadataPtr* make(PTR ptr, ciMetadata* m, int offset); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1112 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1113 static const TypeMetadataPtr* make(ciMethod* m); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1114 static const TypeMetadataPtr* make(ciMethodData* m); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1115 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1116 ciMetadata* metadata() const { return _metadata; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1117 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1118 virtual const Type *cast_to_ptr_type(PTR ptr) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1119 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1120 virtual const TypePtr *add_offset( intptr_t offset ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1121 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1122 virtual const Type *xmeet( const Type *t ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1123 virtual const Type *xdual() const; // Compute dual right now. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1124 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1125 virtual intptr_t get_con() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1126 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1127 // Do not allow interface-vs.-noninterface joins to collapse to top. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1128 virtual const Type *filter( const Type *kills ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1129 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1130 // Convenience common pre-built types. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1131 static const TypeMetadataPtr *BOTTOM; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1132 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1133 #ifndef PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1134 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1135 #endif |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1136 }; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1137 |
0 | 1138 //------------------------------TypeKlassPtr----------------------------------- |
1139 // Class of Java Klass pointers | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1140 class TypeKlassPtr : public TypePtr { |
0 | 1141 TypeKlassPtr( PTR ptr, ciKlass* klass, int offset ); |
1142 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1143 public: |
0 | 1144 virtual bool eq( const Type *t ) const; |
1145 virtual int hash() const; // Type specific hashing | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1146 virtual bool singleton(void) const; // TRUE if type is a singleton |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1147 private: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1148 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1149 static const TypeKlassPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1150 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1151 ciKlass* _klass; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1152 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1153 // Does the type exclude subclasses of the klass? (Inexact == polymorphic.) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1154 bool _klass_is_exact; |
0 | 1155 |
1156 public: | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1157 ciSymbol* name() const { return klass()->name(); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1158 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1159 ciKlass* klass() const { return _klass; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1160 bool klass_is_exact() const { return _klass_is_exact; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1161 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1162 bool is_loaded() const { return klass()->is_loaded(); } |
0 | 1163 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1164 // Creates a type given a klass. Correctly handles multi-dimensional arrays |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1165 // Respects UseUniqueSubclasses. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1166 // If the klass is final, the resulting type will be exact. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1167 static const TypeKlassPtr* make_from_klass(ciKlass* klass) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1168 return make_from_klass_common(klass, true, false); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1169 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1170 // Same as before, but will produce an exact type, even if |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1171 // the klass is not final, as long as it has exactly one implementation. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1172 static const TypeKlassPtr* make_from_klass_unique(ciKlass* klass) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1173 return make_from_klass_common(klass, true, true); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1174 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1175 // Same as before, but does not respects UseUniqueSubclasses. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1176 // Use this only for creating array element types. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1177 static const TypeKlassPtr* make_from_klass_raw(ciKlass* klass) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1178 return make_from_klass_common(klass, false, false); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1179 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1180 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1181 // Make a generic (unclassed) pointer to metadata. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1182 static const TypeKlassPtr* make(PTR ptr, int offset); |
555 | 1183 |
0 | 1184 // ptr to klass 'k' |
1185 static const TypeKlassPtr *make( ciKlass* k ) { return make( TypePtr::Constant, k, 0); } | |
1186 // ptr to klass 'k' with offset | |
1187 static const TypeKlassPtr *make( ciKlass* k, int offset ) { return make( TypePtr::Constant, k, offset); } | |
1188 // ptr to klass 'k' or sub-klass | |
1189 static const TypeKlassPtr *make( PTR ptr, ciKlass* k, int offset); | |
1190 | |
1191 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
1192 | |
1193 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
1194 | |
1195 // corresponding pointer to instance, for a given class | |
1196 const TypeOopPtr* as_instance_type() const; | |
1197 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
1198 virtual const TypePtr *add_offset( intptr_t offset ) const; |
0 | 1199 virtual const Type *xmeet( const Type *t ) const; |
1200 virtual const Type *xdual() const; // Compute dual right now. | |
1201 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1202 virtual intptr_t get_con() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1203 |
0 | 1204 // Convenience common pre-built types. |
1205 static const TypeKlassPtr* OBJECT; // Not-null object klass or below | |
1206 static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same | |
1207 #ifndef PRODUCT | |
1208 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
1209 #endif | |
1210 }; | |
1211 | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1212 class TypeNarrowPtr : public Type { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1213 protected: |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1214 const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1215 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1216 TypeNarrowPtr(TYPES t, const TypePtr* ptrtype): _ptrtype(ptrtype), |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1217 Type(t) { |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1218 assert(ptrtype->offset() == 0 || |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1219 ptrtype->offset() == OffsetBot || |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1220 ptrtype->offset() == OffsetTop, "no real offsets"); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1221 } |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1222 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1223 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const = 0; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1224 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1225 virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const = 0; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1226 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const = 0; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1227 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1228 virtual bool eq( const Type *t ) const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1229 virtual int hash() const; // Type specific hashing |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1230 virtual bool singleton(void) const; // TRUE if type is a singleton |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1231 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1232 virtual const Type *xmeet( const Type *t ) const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1233 virtual const Type *xdual() const; // Compute dual right now. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1234 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1235 virtual intptr_t get_con() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1236 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1237 // Do not allow interface-vs.-noninterface joins to collapse to top. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1238 virtual const Type *filter( const Type *kills ) const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1239 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1240 virtual bool empty(void) const; // TRUE if type is vacuous |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1241 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1242 // returns the equivalent ptr type for this compressed pointer |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1243 const TypePtr *get_ptrtype() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1244 return _ptrtype; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1245 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1246 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1247 #ifndef PRODUCT |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1248 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1249 #endif |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1250 }; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1251 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1252 //------------------------------TypeNarrowOop---------------------------------- |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1253 // A compressed reference to some kind of Oop. This type wraps around |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1254 // a preexisting TypeOopPtr and forwards most of it's operations to |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1255 // the underlying type. It's only real purpose is to track the |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1256 // oopness of the compressed oop value when we expose the conversion |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1257 // between the normal and the compressed form. |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1258 class TypeNarrowOop : public TypeNarrowPtr { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1259 protected: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1260 TypeNarrowOop( const TypePtr* ptrtype): TypeNarrowPtr(NarrowOop, ptrtype) { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1261 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1262 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1263 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1264 return t->isa_narrowoop(); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1265 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1266 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1267 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1268 return t->is_narrowoop(); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1269 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1270 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1271 virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1272 return new TypeNarrowOop(t); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1273 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1274 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1275 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1276 return (const TypeNarrowPtr*)((new TypeNarrowOop(t))->hashcons()); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1277 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1278 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1279 public: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1280 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1281 static const TypeNarrowOop *make( const TypePtr* type); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1282 |
2379
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
1283 static const TypeNarrowOop* make_from_constant(ciObject* con, bool require_constant = false) { |
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
1284 return make(TypeOopPtr::make_from_constant(con, require_constant)); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1285 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1286 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1287 static const TypeNarrowOop *BOTTOM; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1288 static const TypeNarrowOop *NULL_PTR; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1289 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1290 #ifndef PRODUCT |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1291 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1292 #endif |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1293 }; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1294 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1295 //------------------------------TypeNarrowKlass---------------------------------- |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1296 // A compressed reference to klass pointer. This type wraps around a |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1297 // preexisting TypeKlassPtr and forwards most of it's operations to |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1298 // the underlying type. |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1299 class TypeNarrowKlass : public TypeNarrowPtr { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1300 protected: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1301 TypeNarrowKlass( const TypePtr* ptrtype): TypeNarrowPtr(NarrowKlass, ptrtype) { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1302 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1303 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1304 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1305 return t->isa_narrowklass(); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1306 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1307 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1308 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1309 return t->is_narrowklass(); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1310 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1311 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1312 virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1313 return new TypeNarrowKlass(t); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1314 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1315 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1316 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1317 return (const TypeNarrowPtr*)((new TypeNarrowKlass(t))->hashcons()); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1318 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1319 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1320 public: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1321 static const TypeNarrowKlass *make( const TypePtr* type); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1322 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1323 // static const TypeNarrowKlass *BOTTOM; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1324 static const TypeNarrowKlass *NULL_PTR; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1325 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1326 #ifndef PRODUCT |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1327 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1328 #endif |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1329 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1330 |
0 | 1331 //------------------------------TypeFunc--------------------------------------- |
1332 // Class of Array Types | |
1333 class TypeFunc : public Type { | |
1334 TypeFunc( const TypeTuple *domain, const TypeTuple *range ) : Type(Function), _domain(domain), _range(range) {} | |
1335 virtual bool eq( const Type *t ) const; | |
1336 virtual int hash() const; // Type specific hashing | |
1337 virtual bool singleton(void) const; // TRUE if type is a singleton | |
1338 virtual bool empty(void) const; // TRUE if type is vacuous | |
1339 public: | |
1340 // Constants are shared among ADLC and VM | |
1341 enum { Control = AdlcVMDeps::Control, | |
1342 I_O = AdlcVMDeps::I_O, | |
1343 Memory = AdlcVMDeps::Memory, | |
1344 FramePtr = AdlcVMDeps::FramePtr, | |
1345 ReturnAdr = AdlcVMDeps::ReturnAdr, | |
1346 Parms = AdlcVMDeps::Parms | |
1347 }; | |
1348 | |
1349 const TypeTuple* const _domain; // Domain of inputs | |
1350 const TypeTuple* const _range; // Range of results | |
1351 | |
1352 // Accessors: | |
1353 const TypeTuple* domain() const { return _domain; } | |
1354 const TypeTuple* range() const { return _range; } | |
1355 | |
1356 static const TypeFunc *make(ciMethod* method); | |
1357 static const TypeFunc *make(ciSignature signature, const Type* extra); | |
1358 static const TypeFunc *make(const TypeTuple* domain, const TypeTuple* range); | |
1359 | |
1360 virtual const Type *xmeet( const Type *t ) const; | |
1361 virtual const Type *xdual() const; // Compute dual right now. | |
1362 | |
1363 BasicType return_type() const; | |
1364 | |
1365 #ifndef PRODUCT | |
1366 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
1367 #endif | |
1368 // Convenience common pre-built types. | |
1369 }; | |
1370 | |
1371 //------------------------------accessors-------------------------------------- | |
163 | 1372 inline bool Type::is_ptr_to_narrowoop() const { |
1373 #ifdef _LP64 | |
1374 return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowoop_nv()); | |
1375 #else | |
1376 return false; | |
1377 #endif | |
1378 } | |
1379 | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1380 inline bool Type::is_ptr_to_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1381 #ifdef _LP64 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1382 return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowklass_nv()); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1383 #else |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1384 return false; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1385 #endif |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1386 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1387 |
0 | 1388 inline float Type::getf() const { |
1389 assert( _base == FloatCon, "Not a FloatCon" ); | |
1390 return ((TypeF*)this)->_f; | |
1391 } | |
1392 | |
1393 inline double Type::getd() const { | |
1394 assert( _base == DoubleCon, "Not a DoubleCon" ); | |
1395 return ((TypeD*)this)->_d; | |
1396 } | |
1397 | |
1398 inline const TypeInt *Type::is_int() const { | |
1399 assert( _base == Int, "Not an Int" ); | |
1400 return (TypeInt*)this; | |
1401 } | |
1402 | |
1403 inline const TypeInt *Type::isa_int() const { | |
1404 return ( _base == Int ? (TypeInt*)this : NULL); | |
1405 } | |
1406 | |
1407 inline const TypeLong *Type::is_long() const { | |
1408 assert( _base == Long, "Not a Long" ); | |
1409 return (TypeLong*)this; | |
1410 } | |
1411 | |
1412 inline const TypeLong *Type::isa_long() const { | |
1413 return ( _base == Long ? (TypeLong*)this : NULL); | |
1414 } | |
1415 | |
7194
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1416 inline const TypeF *Type::isa_float() const { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1417 return ((_base == FloatTop || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1418 _base == FloatCon || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1419 _base == FloatBot) ? (TypeF*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1420 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1421 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1422 inline const TypeF *Type::is_float_constant() const { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1423 assert( _base == FloatCon, "Not a Float" ); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1424 return (TypeF*)this; |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1425 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1426 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1427 inline const TypeF *Type::isa_float_constant() const { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1428 return ( _base == FloatCon ? (TypeF*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1429 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1430 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1431 inline const TypeD *Type::isa_double() const { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1432 return ((_base == DoubleTop || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1433 _base == DoubleCon || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1434 _base == DoubleBot) ? (TypeD*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1435 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1436 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1437 inline const TypeD *Type::is_double_constant() const { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1438 assert( _base == DoubleCon, "Not a Double" ); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1439 return (TypeD*)this; |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1440 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1441 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1442 inline const TypeD *Type::isa_double_constant() const { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1443 return ( _base == DoubleCon ? (TypeD*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1444 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1445 |
0 | 1446 inline const TypeTuple *Type::is_tuple() const { |
1447 assert( _base == Tuple, "Not a Tuple" ); | |
1448 return (TypeTuple*)this; | |
1449 } | |
1450 | |
1451 inline const TypeAry *Type::is_ary() const { | |
1452 assert( _base == Array , "Not an Array" ); | |
1453 return (TypeAry*)this; | |
1454 } | |
1455 | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1456 inline const TypeVect *Type::is_vect() const { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1457 assert( _base >= VectorS && _base <= VectorY, "Not a Vector" ); |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1458 return (TypeVect*)this; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1459 } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1460 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1461 inline const TypeVect *Type::isa_vect() const { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1462 return (_base >= VectorS && _base <= VectorY) ? (TypeVect*)this : NULL; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1463 } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1464 |
0 | 1465 inline const TypePtr *Type::is_ptr() const { |
1466 // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. | |
1467 assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer"); | |
1468 return (TypePtr*)this; | |
1469 } | |
1470 | |
1471 inline const TypePtr *Type::isa_ptr() const { | |
1472 // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. | |
1473 return (_base >= AnyPtr && _base <= KlassPtr) ? (TypePtr*)this : NULL; | |
1474 } | |
1475 | |
1476 inline const TypeOopPtr *Type::is_oopptr() const { | |
1477 // OopPtr is the first and KlassPtr the last, with no non-oops between. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1478 assert(_base >= OopPtr && _base <= AryPtr, "Not a Java pointer" ) ; |
0 | 1479 return (TypeOopPtr*)this; |
1480 } | |
1481 | |
1482 inline const TypeOopPtr *Type::isa_oopptr() const { | |
1483 // OopPtr is the first and KlassPtr the last, with no non-oops between. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1484 return (_base >= OopPtr && _base <= AryPtr) ? (TypeOopPtr*)this : NULL; |
0 | 1485 } |
1486 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1487 inline const TypeRawPtr *Type::isa_rawptr() const { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1488 return (_base == RawPtr) ? (TypeRawPtr*)this : NULL; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1489 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1490 |
0 | 1491 inline const TypeRawPtr *Type::is_rawptr() const { |
1492 assert( _base == RawPtr, "Not a raw pointer" ); | |
1493 return (TypeRawPtr*)this; | |
1494 } | |
1495 | |
1496 inline const TypeInstPtr *Type::isa_instptr() const { | |
1497 return (_base == InstPtr) ? (TypeInstPtr*)this : NULL; | |
1498 } | |
1499 | |
1500 inline const TypeInstPtr *Type::is_instptr() const { | |
1501 assert( _base == InstPtr, "Not an object pointer" ); | |
1502 return (TypeInstPtr*)this; | |
1503 } | |
1504 | |
1505 inline const TypeAryPtr *Type::isa_aryptr() const { | |
1506 return (_base == AryPtr) ? (TypeAryPtr*)this : NULL; | |
1507 } | |
1508 | |
1509 inline const TypeAryPtr *Type::is_aryptr() const { | |
1510 assert( _base == AryPtr, "Not an array pointer" ); | |
1511 return (TypeAryPtr*)this; | |
1512 } | |
1513 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1514 inline const TypeNarrowOop *Type::is_narrowoop() const { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1515 // OopPtr is the first and KlassPtr the last, with no non-oops between. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1516 assert(_base == NarrowOop, "Not a narrow oop" ) ; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1517 return (TypeNarrowOop*)this; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1518 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1519 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1520 inline const TypeNarrowOop *Type::isa_narrowoop() const { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1521 // OopPtr is the first and KlassPtr the last, with no non-oops between. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1522 return (_base == NarrowOop) ? (TypeNarrowOop*)this : NULL; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1523 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1524 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1525 inline const TypeNarrowKlass *Type::is_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1526 assert(_base == NarrowKlass, "Not a narrow oop" ) ; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1527 return (TypeNarrowKlass*)this; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1528 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1529 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1530 inline const TypeNarrowKlass *Type::isa_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1531 return (_base == NarrowKlass) ? (TypeNarrowKlass*)this : NULL; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1532 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1533 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1534 inline const TypeMetadataPtr *Type::is_metadataptr() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1535 // MetadataPtr is the first and CPCachePtr the last |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1536 assert(_base == MetadataPtr, "Not a metadata pointer" ) ; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1537 return (TypeMetadataPtr*)this; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1538 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1539 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1540 inline const TypeMetadataPtr *Type::isa_metadataptr() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1541 return (_base == MetadataPtr) ? (TypeMetadataPtr*)this : NULL; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1542 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1543 |
0 | 1544 inline const TypeKlassPtr *Type::isa_klassptr() const { |
1545 return (_base == KlassPtr) ? (TypeKlassPtr*)this : NULL; | |
1546 } | |
1547 | |
1548 inline const TypeKlassPtr *Type::is_klassptr() const { | |
1549 assert( _base == KlassPtr, "Not a klass pointer" ); | |
1550 return (TypeKlassPtr*)this; | |
1551 } | |
1552 | |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1553 inline const TypePtr* Type::make_ptr() const { |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1554 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype() : |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1555 ((_base == NarrowKlass) ? is_narrowklass()->get_ptrtype() : |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1556 (isa_ptr() ? is_ptr() : NULL)); |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1557 } |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1558 |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1559 inline const TypeOopPtr* Type::make_oopptr() const { |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1560 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->is_oopptr() : is_oopptr(); |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1561 } |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1562 |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1563 inline const TypeNarrowOop* Type::make_narrowoop() const { |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1564 return (_base == NarrowOop) ? is_narrowoop() : |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1565 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL); |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1566 } |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1567 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1568 inline const TypeNarrowKlass* Type::make_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1569 return (_base == NarrowKlass) ? is_narrowklass() : |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1570 (isa_ptr() ? TypeNarrowKlass::make(is_ptr()) : NULL); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1571 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1572 |
0 | 1573 inline bool Type::is_floatingpoint() const { |
1574 if( (_base == FloatCon) || (_base == FloatBot) || | |
1575 (_base == DoubleCon) || (_base == DoubleBot) ) | |
1576 return true; | |
1577 return false; | |
1578 } | |
1579 | |
10278 | 1580 inline bool Type::is_ptr_to_boxing_obj() const { |
1581 const TypeInstPtr* tp = isa_instptr(); | |
1582 return (tp != NULL) && (tp->offset() == 0) && | |
1583 tp->klass()->is_instance_klass() && | |
1584 tp->klass()->as_instance_klass()->is_box_klass(); | |
1585 } | |
1586 | |
0 | 1587 |
1588 // =============================================================== | |
1589 // Things that need to be 64-bits in the 64-bit build but | |
1590 // 32-bits in the 32-bit build. Done this way to get full | |
1591 // optimization AND strong typing. | |
1592 #ifdef _LP64 | |
1593 | |
1594 // For type queries and asserts | |
1595 #define is_intptr_t is_long | |
1596 #define isa_intptr_t isa_long | |
1597 #define find_intptr_t_type find_long_type | |
1598 #define find_intptr_t_con find_long_con | |
1599 #define TypeX TypeLong | |
1600 #define Type_X Type::Long | |
1601 #define TypeX_X TypeLong::LONG | |
1602 #define TypeX_ZERO TypeLong::ZERO | |
1603 // For 'ideal_reg' machine registers | |
1604 #define Op_RegX Op_RegL | |
1605 // For phase->intcon variants | |
1606 #define MakeConX longcon | |
1607 #define ConXNode ConLNode | |
1608 // For array index arithmetic | |
1609 #define MulXNode MulLNode | |
1610 #define AndXNode AndLNode | |
1611 #define OrXNode OrLNode | |
1612 #define CmpXNode CmpLNode | |
1613 #define SubXNode SubLNode | |
1614 #define LShiftXNode LShiftLNode | |
1615 // For object size computation: | |
1616 #define AddXNode AddLNode | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1617 #define RShiftXNode RShiftLNode |
0 | 1618 // For card marks and hashcodes |
1619 #define URShiftXNode URShiftLNode | |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1620 // UseOptoBiasInlining |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1621 #define XorXNode XorLNode |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1622 #define StoreXConditionalNode StoreLConditionalNode |
0 | 1623 // Opcodes |
1624 #define Op_LShiftX Op_LShiftL | |
1625 #define Op_AndX Op_AndL | |
1626 #define Op_AddX Op_AddL | |
1627 #define Op_SubX Op_SubL | |
851
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1628 #define Op_XorX Op_XorL |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1629 #define Op_URShiftX Op_URShiftL |
0 | 1630 // conversions |
1631 #define ConvI2X(x) ConvI2L(x) | |
1632 #define ConvL2X(x) (x) | |
1633 #define ConvX2I(x) ConvL2I(x) | |
1634 #define ConvX2L(x) (x) | |
1635 | |
1636 #else | |
1637 | |
1638 // For type queries and asserts | |
1639 #define is_intptr_t is_int | |
1640 #define isa_intptr_t isa_int | |
1641 #define find_intptr_t_type find_int_type | |
1642 #define find_intptr_t_con find_int_con | |
1643 #define TypeX TypeInt | |
1644 #define Type_X Type::Int | |
1645 #define TypeX_X TypeInt::INT | |
1646 #define TypeX_ZERO TypeInt::ZERO | |
1647 // For 'ideal_reg' machine registers | |
1648 #define Op_RegX Op_RegI | |
1649 // For phase->intcon variants | |
1650 #define MakeConX intcon | |
1651 #define ConXNode ConINode | |
1652 // For array index arithmetic | |
1653 #define MulXNode MulINode | |
1654 #define AndXNode AndINode | |
1655 #define OrXNode OrINode | |
1656 #define CmpXNode CmpINode | |
1657 #define SubXNode SubINode | |
1658 #define LShiftXNode LShiftINode | |
1659 // For object size computation: | |
1660 #define AddXNode AddINode | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1661 #define RShiftXNode RShiftINode |
0 | 1662 // For card marks and hashcodes |
1663 #define URShiftXNode URShiftINode | |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1664 // UseOptoBiasInlining |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1665 #define XorXNode XorINode |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1666 #define StoreXConditionalNode StoreIConditionalNode |
0 | 1667 // Opcodes |
1668 #define Op_LShiftX Op_LShiftI | |
1669 #define Op_AndX Op_AndI | |
1670 #define Op_AddX Op_AddI | |
1671 #define Op_SubX Op_SubI | |
851
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1672 #define Op_XorX Op_XorI |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1673 #define Op_URShiftX Op_URShiftI |
0 | 1674 // conversions |
1675 #define ConvI2X(x) (x) | |
1676 #define ConvL2X(x) ConvL2I(x) | |
1677 #define ConvX2I(x) (x) | |
1678 #define ConvX2L(x) ConvI2L(x) | |
1679 | |
1680 #endif | |
1972 | 1681 |
1682 #endif // SHARE_VM_OPTO_TYPE_HPP |