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