Mercurial > hg > truffle
annotate src/share/vm/opto/type.hpp @ 17541:4aa6fa2864af
Merge
author | asaha |
---|---|
date | Thu, 23 Jan 2014 14:50:08 -0800 |
parents | 6c2f07d1495f |
children | 5ec7dace41a6 15120a36272d |
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; | |
13014
6c2f07d1495f
8027140: Assertion in compiler when running bigapps/Kitchensink/stability
roland
parents:
12972
diff
changeset
|
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; |
12972
59e8ad757e19
8026844: Various Math functions needs intrinsification
rbackman
parents:
12966
diff
changeset
|
596 static const TypeTuple *LONG_CC_PAIR; |
0 | 597 #ifndef PRODUCT |
598 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping | |
599 #endif | |
600 }; | |
601 | |
602 //------------------------------TypeAry---------------------------------------- | |
603 // Class of Array Types | |
604 class TypeAry : public Type { | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
605 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
|
606 _elem(elem), _size(size), _stable(stable) {} |
0 | 607 public: |
608 virtual bool eq( const Type *t ) const; | |
609 virtual int hash() const; // Type specific hashing | |
610 virtual bool singleton(void) const; // TRUE if type is a singleton | |
611 virtual bool empty(void) const; // TRUE if type is vacuous | |
612 | |
613 private: | |
614 const Type *_elem; // Element type of array | |
615 const TypeInt *_size; // Elements in array | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
616 const bool _stable; // Are elements @Stable? |
0 | 617 friend class TypeAryPtr; |
618 | |
619 public: | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
620 static const TypeAry* make(const Type* elem, const TypeInt* size, bool stable = false); |
0 | 621 |
622 virtual const Type *xmeet( const Type *t ) const; | |
623 virtual const Type *xdual() const; // Compute dual right now. | |
624 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
|
625 #ifdef ASSERT |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
626 // One type is interface, the other is oop |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
627 virtual bool interface_vs_oop(const Type *t) const; |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
628 #endif |
0 | 629 #ifndef PRODUCT |
630 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping | |
631 #endif | |
632 }; | |
633 | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
634 //------------------------------TypeVect--------------------------------------- |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
635 // Class of Vector Types |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
636 class TypeVect : public Type { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
637 const Type* _elem; // Vector's element type |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
638 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
|
639 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
640 protected: |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
641 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
|
642 _elem(elem), _length(length) {} |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
643 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
644 public: |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
645 const Type* element_type() const { return _elem; } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
646 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
|
647 uint length() const { return _length; } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
648 uint length_in_bytes() const { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
649 return _length * type2aelembytes(element_basic_type()); |
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 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
652 virtual bool eq(const Type *t) const; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
653 virtual int hash() const; // Type specific hashing |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
654 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
|
655 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
|
656 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
657 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
|
658 // Use bottom primitive type. |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
659 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
|
660 } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
661 // 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
|
662 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
|
663 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
664 virtual const Type *xmeet( const Type *t) const; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
665 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
|
666 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
667 static const TypeVect *VECTS; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
668 static const TypeVect *VECTD; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
669 static const TypeVect *VECTX; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
670 static const TypeVect *VECTY; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
671 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
672 #ifndef PRODUCT |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
673 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
|
674 #endif |
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 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
677 class TypeVectS : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
678 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
679 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
|
680 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
681 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
682 class TypeVectD : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
683 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
684 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
|
685 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
686 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
687 class TypeVectX : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
688 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
689 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
|
690 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
691 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
692 class TypeVectY : public TypeVect { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
693 friend class TypeVect; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
694 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
|
695 }; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
696 |
0 | 697 //------------------------------TypePtr---------------------------------------- |
698 // Class of machine Pointer Types: raw data, instances or arrays. | |
699 // If the _base enum is AnyPtr, then this refers to all of the above. | |
700 // Otherwise the _base will indicate which subset of pointers is affected, | |
701 // and the class will be inherited from. | |
702 class TypePtr : public Type { | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
703 friend class TypeNarrowPtr; |
0 | 704 public: |
705 enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR }; | |
706 protected: | |
707 TypePtr( TYPES t, PTR ptr, int offset ) : Type(t), _ptr(ptr), _offset(offset) {} | |
708 virtual bool eq( const Type *t ) const; | |
709 virtual int hash() const; // Type specific hashing | |
710 static const PTR ptr_meet[lastPTR][lastPTR]; | |
711 static const PTR ptr_dual[lastPTR]; | |
712 static const char * const ptr_msg[lastPTR]; | |
713 | |
714 public: | |
715 const int _offset; // Offset into oop, with TOP & BOT | |
716 const PTR _ptr; // Pointer equivalence class | |
717 | |
718 const int offset() const { return _offset; } | |
719 const PTR ptr() const { return _ptr; } | |
720 | |
721 static const TypePtr *make( TYPES t, PTR ptr, int offset ); | |
722 | |
723 // Return a 'ptr' version of this type | |
724 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
725 | |
726 virtual intptr_t get_con() const; | |
727 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
728 int xadd_offset( intptr_t offset ) const; |
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
729 virtual const TypePtr *add_offset( intptr_t offset ) const; |
0 | 730 |
731 virtual bool singleton(void) const; // TRUE if type is a singleton | |
732 virtual bool empty(void) const; // TRUE if type is vacuous | |
733 virtual const Type *xmeet( const Type *t ) const; | |
734 int meet_offset( int offset ) const; | |
735 int dual_offset( ) const; | |
736 virtual const Type *xdual() const; // Compute dual right now. | |
737 | |
738 // meet, dual and join over pointer equivalence sets | |
739 PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; } | |
740 PTR dual_ptr() const { return ptr_dual[ptr()]; } | |
741 | |
742 // This is textually confusing unless one recalls that | |
743 // join(t) == dual()->meet(t->dual())->dual(). | |
744 PTR join_ptr( const PTR in_ptr ) const { | |
745 return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ]; | |
746 } | |
747 | |
748 // Tests for relation to centerline of type lattice: | |
749 static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); } | |
750 static bool below_centerline(PTR ptr) { return (ptr >= NotNull); } | |
751 // Convenience common pre-built types. | |
752 static const TypePtr *NULL_PTR; | |
753 static const TypePtr *NOTNULL; | |
754 static const TypePtr *BOTTOM; | |
755 #ifndef PRODUCT | |
756 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
757 #endif | |
758 }; | |
759 | |
760 //------------------------------TypeRawPtr------------------------------------- | |
761 // Class of raw pointers, pointers to things other than Oops. Examples | |
762 // include the stack pointer, top of heap, card-marking area, handles, etc. | |
763 class TypeRawPtr : public TypePtr { | |
764 protected: | |
765 TypeRawPtr( PTR ptr, address bits ) : TypePtr(RawPtr,ptr,0), _bits(bits){} | |
766 public: | |
767 virtual bool eq( const Type *t ) const; | |
768 virtual int hash() const; // Type specific hashing | |
769 | |
770 const address _bits; // Constant value, if applicable | |
771 | |
772 static const TypeRawPtr *make( PTR ptr ); | |
773 static const TypeRawPtr *make( address bits ); | |
774 | |
775 // Return a 'ptr' version of this type | |
776 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
777 | |
778 virtual intptr_t get_con() const; | |
779 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
780 virtual const TypePtr *add_offset( intptr_t offset ) const; |
0 | 781 |
782 virtual const Type *xmeet( const Type *t ) const; | |
783 virtual const Type *xdual() const; // Compute dual right now. | |
784 // Convenience common pre-built types. | |
785 static const TypeRawPtr *BOTTOM; | |
786 static const TypeRawPtr *NOTNULL; | |
787 #ifndef PRODUCT | |
788 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
789 #endif | |
790 }; | |
791 | |
792 //------------------------------TypeOopPtr------------------------------------- | |
793 // Some kind of oop (Java pointer), either klass or instance or array. | |
794 class TypeOopPtr : public TypePtr { | |
795 protected: | |
12966 | 796 TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id, const TypeOopPtr* speculative); |
0 | 797 public: |
798 virtual bool eq( const Type *t ) const; | |
799 virtual int hash() const; // Type specific hashing | |
800 virtual bool singleton(void) const; // TRUE if type is a singleton | |
801 enum { | |
223 | 802 InstanceTop = -1, // undefined instance |
803 InstanceBot = 0 // any possible instance | |
0 | 804 }; |
805 protected: | |
806 | |
807 // Oop is NULL, unless this is a constant oop. | |
808 ciObject* _const_oop; // Constant oop | |
809 // If _klass is NULL, then so is _sig. This is an unloaded klass. | |
810 ciKlass* _klass; // Klass object | |
811 // Does the type exclude subclasses of the klass? (Inexact == polymorphic.) | |
812 bool _klass_is_exact; | |
163 | 813 bool _is_ptr_to_narrowoop; |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
814 bool _is_ptr_to_narrowklass; |
10278 | 815 bool _is_ptr_to_boxed_value; |
0 | 816 |
223 | 817 // If not InstanceTop or InstanceBot, indicates that this is |
818 // a particular instance of this type which is distinct. | |
819 // This is the the node index of the allocation node creating this instance. | |
820 int _instance_id; | |
0 | 821 |
12966 | 822 // Extra type information profiling gave us. We propagate it the |
823 // same way the rest of the type info is propagated. If we want to | |
824 // use it, then we have to emit a guard: this part of the type is | |
825 // not something we know but something we speculate about the type. | |
826 const TypeOopPtr* _speculative; | |
827 | |
0 | 828 static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact); |
829 | |
223 | 830 int dual_instance_id() const; |
831 int meet_instance_id(int uid) const; | |
0 | 832 |
12966 | 833 // utility methods to work on the speculative part of the type |
834 const TypeOopPtr* dual_speculative() const; | |
835 const TypeOopPtr* meet_speculative(const TypeOopPtr* other) const; | |
836 bool eq_speculative(const TypeOopPtr* other) const; | |
837 int hash_speculative() const; | |
838 const TypeOopPtr* add_offset_speculative(intptr_t offset) const; | |
839 #ifndef PRODUCT | |
840 void dump_speculative(outputStream *st) const; | |
841 #endif | |
842 | |
0 | 843 public: |
844 // Creates a type given a klass. Correctly handles multi-dimensional arrays | |
845 // Respects UseUniqueSubclasses. | |
846 // If the klass is final, the resulting type will be exact. | |
847 static const TypeOopPtr* make_from_klass(ciKlass* klass) { | |
848 return make_from_klass_common(klass, true, false); | |
849 } | |
850 // Same as before, but will produce an exact type, even if | |
851 // the klass is not final, as long as it has exactly one implementation. | |
852 static const TypeOopPtr* make_from_klass_unique(ciKlass* klass) { | |
853 return make_from_klass_common(klass, true, true); | |
854 } | |
855 // Same as before, but does not respects UseUniqueSubclasses. | |
856 // Use this only for creating array element types. | |
857 static const TypeOopPtr* make_from_klass_raw(ciKlass* klass) { | |
858 return make_from_klass_common(klass, false, false); | |
859 } | |
860 // 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
|
861 // 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
|
862 // may return a non-singleton type. |
148e5441d916
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
958
diff
changeset
|
863 // If require_constant, produce a NULL if a singleton is not possible. |
10278 | 864 static const TypeOopPtr* make_from_constant(ciObject* o, |
865 bool require_constant = false, | |
866 bool not_null_elements = false); | |
0 | 867 |
868 // Make a generic (unclassed) pointer to an oop. | |
12966 | 869 static const TypeOopPtr* make(PTR ptr, int offset, int instance_id, const TypeOopPtr* speculative); |
0 | 870 |
871 ciObject* const_oop() const { return _const_oop; } | |
872 virtual ciKlass* klass() const { return _klass; } | |
873 bool klass_is_exact() const { return _klass_is_exact; } | |
163 | 874 |
875 // Returns true if this pointer points at memory which contains a | |
876 // compressed oop references. | |
877 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
|
878 bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; } |
10278 | 879 bool is_ptr_to_boxed_value() const { return _is_ptr_to_boxed_value; } |
223 | 880 bool is_known_instance() const { return _instance_id > 0; } |
881 int instance_id() const { return _instance_id; } | |
882 bool is_known_instance_field() const { return is_known_instance() && _offset >= 0; } | |
12966 | 883 const TypeOopPtr* speculative() const { return _speculative; } |
0 | 884 |
885 virtual intptr_t get_con() const; | |
886 | |
887 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
888 | |
889 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
890 | |
223 | 891 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; |
0 | 892 |
893 // corresponding pointer to klass, for a given instance | |
894 const TypeKlassPtr* as_klass_type() const; | |
895 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
896 virtual const TypePtr *add_offset( intptr_t offset ) const; |
12966 | 897 // Return same type without a speculative part |
898 virtual const TypeOopPtr* remove_speculative() const; | |
0 | 899 |
12966 | 900 virtual const Type *xmeet(const Type *t) const; |
0 | 901 virtual const Type *xdual() const; // Compute dual right now. |
12966 | 902 // the core of the computation of the meet for TypeOopPtr and for its subclasses |
903 virtual const Type *xmeet_helper(const Type *t) const; | |
0 | 904 |
905 // Do not allow interface-vs.-noninterface joins to collapse to top. | |
906 virtual const Type *filter( const Type *kills ) const; | |
907 | |
908 // Convenience common pre-built type. | |
909 static const TypeOopPtr *BOTTOM; | |
910 #ifndef PRODUCT | |
911 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; | |
912 #endif | |
12966 | 913 |
914 // Return the speculative type if any | |
915 ciKlass* speculative_type() const { | |
916 if (_speculative != NULL) { | |
917 const TypeOopPtr* speculative = _speculative->join(this)->is_oopptr(); | |
918 if (speculative->klass_is_exact()) { | |
919 return speculative->klass(); | |
920 } | |
921 } | |
922 return NULL; | |
923 } | |
0 | 924 }; |
925 | |
926 //------------------------------TypeInstPtr------------------------------------ | |
927 // 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
|
928 // or to a Klass* (including array klasses). |
0 | 929 class TypeInstPtr : public TypeOopPtr { |
12966 | 930 TypeInstPtr(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id, const TypeOopPtr* speculative); |
0 | 931 virtual bool eq( const Type *t ) const; |
932 virtual int hash() const; // Type specific hashing | |
933 | |
934 ciSymbol* _name; // class name | |
935 | |
936 public: | |
937 ciSymbol* name() const { return _name; } | |
938 | |
939 bool is_loaded() const { return _klass->is_loaded(); } | |
940 | |
941 // Make a pointer to a constant oop. | |
942 static const TypeInstPtr *make(ciObject* o) { | |
12966 | 943 return make(TypePtr::Constant, o->klass(), true, o, 0, InstanceBot); |
0 | 944 } |
945 // Make a pointer to a constant oop with offset. | |
946 static const TypeInstPtr *make(ciObject* o, int offset) { | |
12966 | 947 return make(TypePtr::Constant, o->klass(), true, o, offset, InstanceBot); |
0 | 948 } |
949 | |
950 // Make a pointer to some value of type klass. | |
951 static const TypeInstPtr *make(PTR ptr, ciKlass* klass) { | |
12966 | 952 return make(ptr, klass, false, NULL, 0, InstanceBot); |
0 | 953 } |
954 | |
955 // Make a pointer to some non-polymorphic value of exactly type klass. | |
956 static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) { | |
12966 | 957 return make(ptr, klass, true, NULL, 0, InstanceBot); |
0 | 958 } |
959 | |
960 // Make a pointer to some value of type klass with offset. | |
961 static const TypeInstPtr *make(PTR ptr, ciKlass* klass, int offset) { | |
12966 | 962 return make(ptr, klass, false, NULL, offset, InstanceBot); |
0 | 963 } |
964 | |
965 // Make a pointer to an oop. | |
12966 | 966 static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL); |
0 | 967 |
10278 | 968 /** Create constant type for a constant boxed value */ |
969 const Type* get_const_boxed_value() const; | |
970 | |
0 | 971 // If this is a java.lang.Class constant, return the type for it or NULL. |
972 // Pass to Type::get_const_type to turn it to a type, which will usually | |
973 // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc. | |
974 ciType* java_mirror_type() const; | |
975 | |
976 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
977 | |
978 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
979 | |
223 | 980 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; |
0 | 981 |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
982 virtual const TypePtr *add_offset( intptr_t offset ) const; |
12966 | 983 // Return same type without a speculative part |
984 virtual const TypeOopPtr* remove_speculative() const; | |
0 | 985 |
12966 | 986 // the core of the computation of the meet of 2 types |
987 virtual const Type *xmeet_helper(const Type *t) const; | |
0 | 988 virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const; |
989 virtual const Type *xdual() const; // Compute dual right now. | |
990 | |
991 // Convenience common pre-built types. | |
992 static const TypeInstPtr *NOTNULL; | |
993 static const TypeInstPtr *BOTTOM; | |
994 static const TypeInstPtr *MIRROR; | |
995 static const TypeInstPtr *MARK; | |
996 static const TypeInstPtr *KLASS; | |
997 #ifndef PRODUCT | |
998 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
999 #endif | |
1000 }; | |
1001 | |
1002 //------------------------------TypeAryPtr------------------------------------- | |
1003 // Class of Java array pointers | |
1004 class TypeAryPtr : public TypeOopPtr { | |
10278 | 1005 TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, |
12966 | 1006 int offset, int instance_id, bool is_autobox_cache, const TypeOopPtr* speculative) |
1007 : TypeOopPtr(AryPtr,ptr,k,xk,o,offset, instance_id, speculative), | |
10278 | 1008 _ary(ary), |
1009 _is_autobox_cache(is_autobox_cache) | |
1010 { | |
1761 | 1011 #ifdef ASSERT |
1012 if (k != NULL) { | |
1013 // Verify that specified klass and TypeAryPtr::klass() follow the same rules. | |
1014 ciKlass* ck = compute_klass(true); | |
1792 | 1015 if (k != ck) { |
1761 | 1016 this->dump(); tty->cr(); |
1017 tty->print(" k: "); | |
1018 k->print(); tty->cr(); | |
1019 tty->print("ck: "); | |
1020 if (ck != NULL) ck->print(); | |
1021 else tty->print("<NULL>"); | |
1022 tty->cr(); | |
1023 assert(false, "unexpected TypeAryPtr::_klass"); | |
1024 } | |
1025 } | |
1026 #endif | |
1027 } | |
0 | 1028 virtual bool eq( const Type *t ) const; |
1029 virtual int hash() const; // Type specific hashing | |
1030 const TypeAry *_ary; // Array we point into | |
10278 | 1031 const bool _is_autobox_cache; |
0 | 1032 |
1761 | 1033 ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const; |
1034 | |
0 | 1035 public: |
1036 // Accessors | |
1037 ciKlass* klass() const; | |
1038 const TypeAry* ary() const { return _ary; } | |
1039 const Type* elem() const { return _ary->_elem; } | |
1040 const TypeInt* size() const { return _ary->_size; } | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
1041 bool is_stable() const { return _ary->_stable; } |
0 | 1042 |
10278 | 1043 bool is_autobox_cache() const { return _is_autobox_cache; } |
1044 | |
12966 | 1045 static const TypeAryPtr *make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot, const TypeOopPtr* speculative = NULL); |
0 | 1046 // Constant pointer to array |
12966 | 1047 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 | 1048 |
1049 // Return a 'ptr' version of this type | |
1050 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
1051 | |
1052 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
1053 | |
223 | 1054 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; |
0 | 1055 |
1056 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
|
1057 virtual const TypeInt* narrow_size_type(const TypeInt* size) const; |
0 | 1058 |
1059 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
|
1060 virtual const TypePtr *add_offset( intptr_t offset ) const; |
12966 | 1061 // Return same type without a speculative part |
1062 virtual const TypeOopPtr* remove_speculative() const; | |
0 | 1063 |
12966 | 1064 // the core of the computation of the meet of 2 types |
1065 virtual const Type *xmeet_helper(const Type *t) const; | |
0 | 1066 virtual const Type *xdual() const; // Compute dual right now. |
1067 | |
12190
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
1068 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
|
1069 int stable_dimension() const; |
edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
vlivanov
parents:
12146
diff
changeset
|
1070 |
0 | 1071 // Convenience common pre-built types. |
1072 static const TypeAryPtr *RANGE; | |
1073 static const TypeAryPtr *OOPS; | |
163 | 1074 static const TypeAryPtr *NARROWOOPS; |
0 | 1075 static const TypeAryPtr *BYTES; |
1076 static const TypeAryPtr *SHORTS; | |
1077 static const TypeAryPtr *CHARS; | |
1078 static const TypeAryPtr *INTS; | |
1079 static const TypeAryPtr *LONGS; | |
1080 static const TypeAryPtr *FLOATS; | |
1081 static const TypeAryPtr *DOUBLES; | |
1082 // selects one of the above: | |
1083 static const TypeAryPtr *get_array_body_type(BasicType elem) { | |
1084 assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != NULL, "bad elem type"); | |
1085 return _array_body_type[elem]; | |
1086 } | |
1087 static const TypeAryPtr *_array_body_type[T_CONFLICT+1]; | |
1088 // 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
|
1089 #ifdef ASSERT |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
1090 // One type is interface, the other is oop |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
1091 virtual bool interface_vs_oop(const Type *t) const; |
915cc9c5ebc6
6837094: False positive for "meet not symmetric" failure
kvn
parents:
628
diff
changeset
|
1092 #endif |
0 | 1093 #ifndef PRODUCT |
1094 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
1095 #endif | |
1096 }; | |
1097 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1098 //------------------------------TypeMetadataPtr------------------------------------- |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1099 // 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
|
1100 class TypeMetadataPtr : public TypePtr { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1101 protected: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1102 TypeMetadataPtr(PTR ptr, ciMetadata* metadata, int offset); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1103 public: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1104 virtual bool eq( const Type *t ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1105 virtual int hash() const; // Type specific hashing |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1106 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
|
1107 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1108 private: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1109 ciMetadata* _metadata; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1110 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1111 public: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1112 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
|
1113 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1114 static const TypeMetadataPtr* make(ciMethod* m); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1115 static const TypeMetadataPtr* make(ciMethodData* m); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1116 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1117 ciMetadata* metadata() const { return _metadata; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1118 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1119 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
|
1120 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1121 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
|
1122 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1123 virtual const Type *xmeet( const Type *t ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1124 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
|
1125 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1126 virtual intptr_t get_con() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1127 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1128 // 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
|
1129 virtual const Type *filter( const Type *kills ) const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1130 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1131 // Convenience common pre-built types. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1132 static const TypeMetadataPtr *BOTTOM; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1133 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1134 #ifndef PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1135 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
|
1136 #endif |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1137 }; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1138 |
0 | 1139 //------------------------------TypeKlassPtr----------------------------------- |
1140 // Class of Java Klass pointers | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1141 class TypeKlassPtr : public TypePtr { |
0 | 1142 TypeKlassPtr( PTR ptr, ciKlass* klass, int offset ); |
1143 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1144 public: |
0 | 1145 virtual bool eq( const Type *t ) const; |
1146 virtual int hash() const; // Type specific hashing | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1147 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
|
1148 private: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1149 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1150 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
|
1151 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1152 ciKlass* _klass; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1153 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1154 // 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
|
1155 bool _klass_is_exact; |
0 | 1156 |
1157 public: | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1158 ciSymbol* name() const { return klass()->name(); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1159 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1160 ciKlass* klass() const { return _klass; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1161 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
|
1162 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1163 bool is_loaded() const { return klass()->is_loaded(); } |
0 | 1164 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1165 // 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
|
1166 // Respects UseUniqueSubclasses. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1167 // 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
|
1168 static const TypeKlassPtr* make_from_klass(ciKlass* klass) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1169 return make_from_klass_common(klass, true, false); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1170 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1171 // 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
|
1172 // 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
|
1173 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
|
1174 return make_from_klass_common(klass, true, true); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1175 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1176 // Same as before, but does not respects UseUniqueSubclasses. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1177 // Use this only for creating array element types. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1178 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
|
1179 return make_from_klass_common(klass, false, false); |
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 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1182 // Make a generic (unclassed) pointer to metadata. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1183 static const TypeKlassPtr* make(PTR ptr, int offset); |
555 | 1184 |
0 | 1185 // ptr to klass 'k' |
1186 static const TypeKlassPtr *make( ciKlass* k ) { return make( TypePtr::Constant, k, 0); } | |
1187 // ptr to klass 'k' with offset | |
1188 static const TypeKlassPtr *make( ciKlass* k, int offset ) { return make( TypePtr::Constant, k, offset); } | |
1189 // ptr to klass 'k' or sub-klass | |
1190 static const TypeKlassPtr *make( PTR ptr, ciKlass* k, int offset); | |
1191 | |
1192 virtual const Type *cast_to_ptr_type(PTR ptr) const; | |
1193 | |
1194 virtual const Type *cast_to_exactness(bool klass_is_exact) const; | |
1195 | |
1196 // corresponding pointer to instance, for a given class | |
1197 const TypeOopPtr* as_instance_type() const; | |
1198 | |
306
af945ba2e739
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
235
diff
changeset
|
1199 virtual const TypePtr *add_offset( intptr_t offset ) const; |
0 | 1200 virtual const Type *xmeet( const Type *t ) const; |
1201 virtual const Type *xdual() const; // Compute dual right now. | |
1202 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1203 virtual intptr_t get_con() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1204 |
13014
6c2f07d1495f
8027140: Assertion in compiler when running bigapps/Kitchensink/stability
roland
parents:
12972
diff
changeset
|
1205 // Do not allow interface-vs.-noninterface joins to collapse to top. |
6c2f07d1495f
8027140: Assertion in compiler when running bigapps/Kitchensink/stability
roland
parents:
12972
diff
changeset
|
1206 virtual const Type *filter( const Type *kills ) const; |
6c2f07d1495f
8027140: Assertion in compiler when running bigapps/Kitchensink/stability
roland
parents:
12972
diff
changeset
|
1207 |
0 | 1208 // Convenience common pre-built types. |
1209 static const TypeKlassPtr* OBJECT; // Not-null object klass or below | |
1210 static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same | |
1211 #ifndef PRODUCT | |
1212 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
1213 #endif | |
1214 }; | |
1215 | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1216 class TypeNarrowPtr : public Type { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1217 protected: |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1218 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
|
1219 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1220 TypeNarrowPtr(TYPES t, const TypePtr* ptrtype): _ptrtype(ptrtype), |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1221 Type(t) { |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1222 assert(ptrtype->offset() == 0 || |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1223 ptrtype->offset() == OffsetBot || |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1224 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
|
1225 } |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1226 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1227 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
|
1228 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
|
1229 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
|
1230 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
|
1231 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1232 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
|
1233 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
|
1234 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
|
1235 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1236 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
|
1237 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
|
1238 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1239 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
|
1240 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1241 // 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
|
1242 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
|
1243 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1244 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
|
1245 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1246 // returns the equivalent ptr type for this compressed pointer |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1247 const TypePtr *get_ptrtype() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1248 return _ptrtype; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1249 } |
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 #ifndef PRODUCT |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1252 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1253 #endif |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1254 }; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1255 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1256 //------------------------------TypeNarrowOop---------------------------------- |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1257 // 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
|
1258 // 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
|
1259 // 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
|
1260 // 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
|
1261 // between the normal and the compressed form. |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1262 class TypeNarrowOop : public TypeNarrowPtr { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1263 protected: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1264 TypeNarrowOop( const TypePtr* ptrtype): TypeNarrowPtr(NarrowOop, ptrtype) { |
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 *isa_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1268 return t->isa_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 *is_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1272 return t->is_narrowoop(); |
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_same_narrowptr(const TypePtr *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1276 return new TypeNarrowOop(t); |
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 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
|
1280 return (const TypeNarrowPtr*)((new TypeNarrowOop(t))->hashcons()); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1281 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1282 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1283 public: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1284 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1285 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
|
1286 |
2379
b099aaf51bf8
6962931: move interned strings out of the perm gen
jcoomes
parents:
1972
diff
changeset
|
1287 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
|
1288 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
|
1289 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1290 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1291 static const TypeNarrowOop *BOTTOM; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1292 static const TypeNarrowOop *NULL_PTR; |
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 #ifndef PRODUCT |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1295 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1296 #endif |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1297 }; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1298 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1299 //------------------------------TypeNarrowKlass---------------------------------- |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1300 // 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
|
1301 // preexisting TypeKlassPtr and forwards most of it's operations to |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1302 // the underlying type. |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1303 class TypeNarrowKlass : public TypeNarrowPtr { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1304 protected: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1305 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
|
1306 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1307 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1308 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1309 return t->isa_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 *is_same_narrowptr(const Type *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1313 return t->is_narrowklass(); |
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_same_narrowptr(const TypePtr *t) const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1317 return new TypeNarrowKlass(t); |
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 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
|
1321 return (const TypeNarrowPtr*)((new TypeNarrowKlass(t))->hashcons()); |
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 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1324 public: |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1325 static const TypeNarrowKlass *make( const TypePtr* type); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1326 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1327 // static const TypeNarrowKlass *BOTTOM; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1328 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
|
1329 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1330 #ifndef PRODUCT |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1331 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
|
1332 #endif |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1333 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1334 |
0 | 1335 //------------------------------TypeFunc--------------------------------------- |
1336 // Class of Array Types | |
1337 class TypeFunc : public Type { | |
1338 TypeFunc( const TypeTuple *domain, const TypeTuple *range ) : Type(Function), _domain(domain), _range(range) {} | |
1339 virtual bool eq( const Type *t ) const; | |
1340 virtual int hash() const; // Type specific hashing | |
1341 virtual bool singleton(void) const; // TRUE if type is a singleton | |
1342 virtual bool empty(void) const; // TRUE if type is vacuous | |
1343 public: | |
1344 // Constants are shared among ADLC and VM | |
1345 enum { Control = AdlcVMDeps::Control, | |
1346 I_O = AdlcVMDeps::I_O, | |
1347 Memory = AdlcVMDeps::Memory, | |
1348 FramePtr = AdlcVMDeps::FramePtr, | |
1349 ReturnAdr = AdlcVMDeps::ReturnAdr, | |
1350 Parms = AdlcVMDeps::Parms | |
1351 }; | |
1352 | |
1353 const TypeTuple* const _domain; // Domain of inputs | |
1354 const TypeTuple* const _range; // Range of results | |
1355 | |
1356 // Accessors: | |
1357 const TypeTuple* domain() const { return _domain; } | |
1358 const TypeTuple* range() const { return _range; } | |
1359 | |
1360 static const TypeFunc *make(ciMethod* method); | |
1361 static const TypeFunc *make(ciSignature signature, const Type* extra); | |
1362 static const TypeFunc *make(const TypeTuple* domain, const TypeTuple* range); | |
1363 | |
1364 virtual const Type *xmeet( const Type *t ) const; | |
1365 virtual const Type *xdual() const; // Compute dual right now. | |
1366 | |
1367 BasicType return_type() const; | |
1368 | |
1369 #ifndef PRODUCT | |
1370 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping | |
1371 #endif | |
1372 // Convenience common pre-built types. | |
1373 }; | |
1374 | |
1375 //------------------------------accessors-------------------------------------- | |
163 | 1376 inline bool Type::is_ptr_to_narrowoop() const { |
1377 #ifdef _LP64 | |
1378 return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowoop_nv()); | |
1379 #else | |
1380 return false; | |
1381 #endif | |
1382 } | |
1383 | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1384 inline bool Type::is_ptr_to_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1385 #ifdef _LP64 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1386 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
|
1387 #else |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1388 return false; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1389 #endif |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1390 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1391 |
0 | 1392 inline float Type::getf() const { |
1393 assert( _base == FloatCon, "Not a FloatCon" ); | |
1394 return ((TypeF*)this)->_f; | |
1395 } | |
1396 | |
1397 inline double Type::getd() const { | |
1398 assert( _base == DoubleCon, "Not a DoubleCon" ); | |
1399 return ((TypeD*)this)->_d; | |
1400 } | |
1401 | |
1402 inline const TypeInt *Type::is_int() const { | |
1403 assert( _base == Int, "Not an Int" ); | |
1404 return (TypeInt*)this; | |
1405 } | |
1406 | |
1407 inline const TypeInt *Type::isa_int() const { | |
1408 return ( _base == Int ? (TypeInt*)this : NULL); | |
1409 } | |
1410 | |
1411 inline const TypeLong *Type::is_long() const { | |
1412 assert( _base == Long, "Not a Long" ); | |
1413 return (TypeLong*)this; | |
1414 } | |
1415 | |
1416 inline const TypeLong *Type::isa_long() const { | |
1417 return ( _base == Long ? (TypeLong*)this : NULL); | |
1418 } | |
1419 | |
7194
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1420 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
|
1421 return ((_base == FloatTop || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1422 _base == FloatCon || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1423 _base == FloatBot) ? (TypeF*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1424 } |
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 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
|
1427 assert( _base == FloatCon, "Not a Float" ); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1428 return (TypeF*)this; |
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 TypeF *Type::isa_float_constant() const { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1432 return ( _base == FloatCon ? (TypeF*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1433 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1434 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1435 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
|
1436 return ((_base == DoubleTop || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1437 _base == DoubleCon || |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1438 _base == DoubleBot) ? (TypeD*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1439 } |
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 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
|
1442 assert( _base == DoubleCon, "Not a Double" ); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1443 return (TypeD*)this; |
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 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1446 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
|
1447 return ( _base == DoubleCon ? (TypeD*)this : NULL); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1448 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6848
diff
changeset
|
1449 |
0 | 1450 inline const TypeTuple *Type::is_tuple() const { |
1451 assert( _base == Tuple, "Not a Tuple" ); | |
1452 return (TypeTuple*)this; | |
1453 } | |
1454 | |
1455 inline const TypeAry *Type::is_ary() const { | |
1456 assert( _base == Array , "Not an Array" ); | |
1457 return (TypeAry*)this; | |
1458 } | |
1459 | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1460 inline const TypeVect *Type::is_vect() const { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1461 assert( _base >= VectorS && _base <= VectorY, "Not a Vector" ); |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1462 return (TypeVect*)this; |
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 |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1465 inline const TypeVect *Type::isa_vect() const { |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1466 return (_base >= VectorS && _base <= VectorY) ? (TypeVect*)this : NULL; |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1467 } |
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
3939
diff
changeset
|
1468 |
0 | 1469 inline const TypePtr *Type::is_ptr() const { |
1470 // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. | |
1471 assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer"); | |
1472 return (TypePtr*)this; | |
1473 } | |
1474 | |
1475 inline const TypePtr *Type::isa_ptr() const { | |
1476 // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. | |
1477 return (_base >= AnyPtr && _base <= KlassPtr) ? (TypePtr*)this : NULL; | |
1478 } | |
1479 | |
1480 inline const TypeOopPtr *Type::is_oopptr() const { | |
1481 // 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
|
1482 assert(_base >= OopPtr && _base <= AryPtr, "Not a Java pointer" ) ; |
0 | 1483 return (TypeOopPtr*)this; |
1484 } | |
1485 | |
1486 inline const TypeOopPtr *Type::isa_oopptr() const { | |
1487 // 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
|
1488 return (_base >= OopPtr && _base <= AryPtr) ? (TypeOopPtr*)this : NULL; |
0 | 1489 } |
1490 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1491 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
|
1492 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
|
1493 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1494 |
0 | 1495 inline const TypeRawPtr *Type::is_rawptr() const { |
1496 assert( _base == RawPtr, "Not a raw pointer" ); | |
1497 return (TypeRawPtr*)this; | |
1498 } | |
1499 | |
1500 inline const TypeInstPtr *Type::isa_instptr() const { | |
1501 return (_base == InstPtr) ? (TypeInstPtr*)this : NULL; | |
1502 } | |
1503 | |
1504 inline const TypeInstPtr *Type::is_instptr() const { | |
1505 assert( _base == InstPtr, "Not an object pointer" ); | |
1506 return (TypeInstPtr*)this; | |
1507 } | |
1508 | |
1509 inline const TypeAryPtr *Type::isa_aryptr() const { | |
1510 return (_base == AryPtr) ? (TypeAryPtr*)this : NULL; | |
1511 } | |
1512 | |
1513 inline const TypeAryPtr *Type::is_aryptr() const { | |
1514 assert( _base == AryPtr, "Not an array pointer" ); | |
1515 return (TypeAryPtr*)this; | |
1516 } | |
1517 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1518 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
|
1519 // 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
|
1520 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
|
1521 return (TypeNarrowOop*)this; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1522 } |
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 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
|
1525 // 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
|
1526 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
|
1527 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
64
diff
changeset
|
1528 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1529 inline const TypeNarrowKlass *Type::is_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1530 assert(_base == NarrowKlass, "Not a narrow oop" ) ; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1531 return (TypeNarrowKlass*)this; |
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 |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1534 inline const TypeNarrowKlass *Type::isa_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1535 return (_base == NarrowKlass) ? (TypeNarrowKlass*)this : NULL; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1536 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1537 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1538 inline const TypeMetadataPtr *Type::is_metadataptr() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1539 // MetadataPtr is the first and CPCachePtr the last |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1540 assert(_base == MetadataPtr, "Not a metadata pointer" ) ; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1541 return (TypeMetadataPtr*)this; |
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 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1544 inline const TypeMetadataPtr *Type::isa_metadataptr() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1545 return (_base == MetadataPtr) ? (TypeMetadataPtr*)this : NULL; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1546 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
1547 |
0 | 1548 inline const TypeKlassPtr *Type::isa_klassptr() const { |
1549 return (_base == KlassPtr) ? (TypeKlassPtr*)this : NULL; | |
1550 } | |
1551 | |
1552 inline const TypeKlassPtr *Type::is_klassptr() const { | |
1553 assert( _base == KlassPtr, "Not a klass pointer" ); | |
1554 return (TypeKlassPtr*)this; | |
1555 } | |
1556 | |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1557 inline const TypePtr* Type::make_ptr() const { |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1558 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype() : |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1559 ((_base == NarrowKlass) ? is_narrowklass()->get_ptrtype() : |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1560 (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
|
1561 } |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1562 |
827
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1563 inline const TypeOopPtr* Type::make_oopptr() const { |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1564 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
|
1565 } |
bf3489cc0aa0
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
820
diff
changeset
|
1566 |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1567 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
|
1568 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
|
1569 (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
|
1570 } |
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
163
diff
changeset
|
1571 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1572 inline const TypeNarrowKlass* Type::make_narrowklass() const { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1573 return (_base == NarrowKlass) ? is_narrowklass() : |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1574 (isa_ptr() ? TypeNarrowKlass::make(is_ptr()) : NULL); |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1575 } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6725
diff
changeset
|
1576 |
0 | 1577 inline bool Type::is_floatingpoint() const { |
1578 if( (_base == FloatCon) || (_base == FloatBot) || | |
1579 (_base == DoubleCon) || (_base == DoubleBot) ) | |
1580 return true; | |
1581 return false; | |
1582 } | |
1583 | |
10278 | 1584 inline bool Type::is_ptr_to_boxing_obj() const { |
1585 const TypeInstPtr* tp = isa_instptr(); | |
1586 return (tp != NULL) && (tp->offset() == 0) && | |
1587 tp->klass()->is_instance_klass() && | |
1588 tp->klass()->as_instance_klass()->is_box_klass(); | |
1589 } | |
1590 | |
0 | 1591 |
1592 // =============================================================== | |
1593 // Things that need to be 64-bits in the 64-bit build but | |
1594 // 32-bits in the 32-bit build. Done this way to get full | |
1595 // optimization AND strong typing. | |
1596 #ifdef _LP64 | |
1597 | |
1598 // For type queries and asserts | |
1599 #define is_intptr_t is_long | |
1600 #define isa_intptr_t isa_long | |
1601 #define find_intptr_t_type find_long_type | |
1602 #define find_intptr_t_con find_long_con | |
1603 #define TypeX TypeLong | |
1604 #define Type_X Type::Long | |
1605 #define TypeX_X TypeLong::LONG | |
1606 #define TypeX_ZERO TypeLong::ZERO | |
1607 // For 'ideal_reg' machine registers | |
1608 #define Op_RegX Op_RegL | |
1609 // For phase->intcon variants | |
1610 #define MakeConX longcon | |
1611 #define ConXNode ConLNode | |
1612 // For array index arithmetic | |
1613 #define MulXNode MulLNode | |
1614 #define AndXNode AndLNode | |
1615 #define OrXNode OrLNode | |
1616 #define CmpXNode CmpLNode | |
1617 #define SubXNode SubLNode | |
1618 #define LShiftXNode LShiftLNode | |
1619 // For object size computation: | |
1620 #define AddXNode AddLNode | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1621 #define RShiftXNode RShiftLNode |
0 | 1622 // For card marks and hashcodes |
1623 #define URShiftXNode URShiftLNode | |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1624 // UseOptoBiasInlining |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1625 #define XorXNode XorLNode |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1626 #define StoreXConditionalNode StoreLConditionalNode |
0 | 1627 // Opcodes |
1628 #define Op_LShiftX Op_LShiftL | |
1629 #define Op_AndX Op_AndL | |
1630 #define Op_AddX Op_AddL | |
1631 #define Op_SubX Op_SubL | |
851
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1632 #define Op_XorX Op_XorL |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1633 #define Op_URShiftX Op_URShiftL |
0 | 1634 // conversions |
1635 #define ConvI2X(x) ConvI2L(x) | |
1636 #define ConvL2X(x) (x) | |
1637 #define ConvX2I(x) ConvL2I(x) | |
1638 #define ConvX2L(x) (x) | |
1639 | |
1640 #else | |
1641 | |
1642 // For type queries and asserts | |
1643 #define is_intptr_t is_int | |
1644 #define isa_intptr_t isa_int | |
1645 #define find_intptr_t_type find_int_type | |
1646 #define find_intptr_t_con find_int_con | |
1647 #define TypeX TypeInt | |
1648 #define Type_X Type::Int | |
1649 #define TypeX_X TypeInt::INT | |
1650 #define TypeX_ZERO TypeInt::ZERO | |
1651 // For 'ideal_reg' machine registers | |
1652 #define Op_RegX Op_RegI | |
1653 // For phase->intcon variants | |
1654 #define MakeConX intcon | |
1655 #define ConXNode ConINode | |
1656 // For array index arithmetic | |
1657 #define MulXNode MulINode | |
1658 #define AndXNode AndINode | |
1659 #define OrXNode OrINode | |
1660 #define CmpXNode CmpINode | |
1661 #define SubXNode SubINode | |
1662 #define LShiftXNode LShiftINode | |
1663 // For object size computation: | |
1664 #define AddXNode AddINode | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
1665 #define RShiftXNode RShiftINode |
0 | 1666 // For card marks and hashcodes |
1667 #define URShiftXNode URShiftINode | |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1668 // UseOptoBiasInlining |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1669 #define XorXNode XorINode |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
1670 #define StoreXConditionalNode StoreIConditionalNode |
0 | 1671 // Opcodes |
1672 #define Op_LShiftX Op_LShiftI | |
1673 #define Op_AndX Op_AndI | |
1674 #define Op_AddX Op_AddI | |
1675 #define Op_SubX Op_SubI | |
851
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1676 #define Op_XorX Op_XorI |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
827
diff
changeset
|
1677 #define Op_URShiftX Op_URShiftI |
0 | 1678 // conversions |
1679 #define ConvI2X(x) (x) | |
1680 #define ConvL2X(x) ConvL2I(x) | |
1681 #define ConvX2I(x) (x) | |
1682 #define ConvX2L(x) ConvI2L(x) | |
1683 | |
1684 #endif | |
1972 | 1685 |
1686 #endif // SHARE_VM_OPTO_TYPE_HPP |