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