1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/opto/type.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,1124 @@ 1.4 +/* 1.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// Portions of code courtesy of Clifford Click 1.29 + 1.30 +// Optimization - Graph Style 1.31 + 1.32 + 1.33 +// This class defines a Type lattice. The lattice is used in the constant 1.34 +// propagation algorithms, and for some type-checking of the iloc code. 1.35 +// Basic types include RSD's (lower bound, upper bound, stride for integers), 1.36 +// float & double precision constants, sets of data-labels and code-labels. 1.37 +// The complete lattice is described below. Subtypes have no relationship to 1.38 +// up or down in the lattice; that is entirely determined by the behavior of 1.39 +// the MEET/JOIN functions. 1.40 + 1.41 +class Dict; 1.42 +class Type; 1.43 +class TypeD; 1.44 +class TypeF; 1.45 +class TypeInt; 1.46 +class TypeLong; 1.47 +class TypeAry; 1.48 +class TypeTuple; 1.49 +class TypePtr; 1.50 +class TypeRawPtr; 1.51 +class TypeOopPtr; 1.52 +class TypeInstPtr; 1.53 +class TypeAryPtr; 1.54 +class TypeKlassPtr; 1.55 + 1.56 +//------------------------------Type------------------------------------------- 1.57 +// Basic Type object, represents a set of primitive Values. 1.58 +// Types are hash-cons'd into a private class dictionary, so only one of each 1.59 +// different kind of Type exists. Types are never modified after creation, so 1.60 +// all their interesting fields are constant. 1.61 +class Type { 1.62 +public: 1.63 + enum TYPES { 1.64 + Bad=0, // Type check 1.65 + Control, // Control of code (not in lattice) 1.66 + Top, // Top of the lattice 1.67 + Int, // Integer range (lo-hi) 1.68 + Long, // Long integer range (lo-hi) 1.69 + Half, // Placeholder half of doubleword 1.70 + 1.71 + Tuple, // Method signature or object layout 1.72 + Array, // Array types 1.73 + 1.74 + AnyPtr, // Any old raw, klass, inst, or array pointer 1.75 + RawPtr, // Raw (non-oop) pointers 1.76 + OopPtr, // Any and all Java heap entities 1.77 + InstPtr, // Instance pointers (non-array objects) 1.78 + AryPtr, // Array pointers 1.79 + KlassPtr, // Klass pointers 1.80 + // (Ptr order matters: See is_ptr, isa_ptr, is_oopptr, isa_oopptr.) 1.81 + 1.82 + Function, // Function signature 1.83 + Abio, // Abstract I/O 1.84 + Return_Address, // Subroutine return address 1.85 + Memory, // Abstract store 1.86 + FloatTop, // No float value 1.87 + FloatCon, // Floating point constant 1.88 + FloatBot, // Any float value 1.89 + DoubleTop, // No double value 1.90 + DoubleCon, // Double precision constant 1.91 + DoubleBot, // Any double value 1.92 + Bottom, // Bottom of lattice 1.93 + lastype // Bogus ending type (not in lattice) 1.94 + }; 1.95 + 1.96 + // Signal values for offsets from a base pointer 1.97 + enum OFFSET_SIGNALS { 1.98 + OffsetTop = -2000000000, // undefined offset 1.99 + OffsetBot = -2000000001 // any possible offset 1.100 + }; 1.101 + 1.102 + // Min and max WIDEN values. 1.103 + enum WIDEN { 1.104 + WidenMin = 0, 1.105 + WidenMax = 3 1.106 + }; 1.107 + 1.108 +private: 1.109 + // Dictionary of types shared among compilations. 1.110 + static Dict* _shared_type_dict; 1.111 + 1.112 + static int uhash( const Type *const t ); 1.113 + // Structural equality check. Assumes that cmp() has already compared 1.114 + // the _base types and thus knows it can cast 't' appropriately. 1.115 + virtual bool eq( const Type *t ) const; 1.116 + 1.117 + // Top-level hash-table of types 1.118 + static Dict *type_dict() { 1.119 + return Compile::current()->type_dict(); 1.120 + } 1.121 + 1.122 + // DUAL operation: reflect around lattice centerline. Used instead of 1.123 + // join to ensure my lattice is symmetric up and down. Dual is computed 1.124 + // lazily, on demand, and cached in _dual. 1.125 + const Type *_dual; // Cached dual value 1.126 + // Table for efficient dualing of base types 1.127 + static const TYPES dual_type[lastype]; 1.128 + 1.129 +protected: 1.130 + // Each class of type is also identified by its base. 1.131 + const TYPES _base; // Enum of Types type 1.132 + 1.133 + Type( TYPES t ) : _dual(NULL), _base(t) {} // Simple types 1.134 + // ~Type(); // Use fast deallocation 1.135 + const Type *hashcons(); // Hash-cons the type 1.136 + 1.137 +public: 1.138 + 1.139 + inline void* operator new( size_t x ) { 1.140 + Compile* compile = Compile::current(); 1.141 + compile->set_type_last_size(x); 1.142 + void *temp = compile->type_arena()->Amalloc_D(x); 1.143 + compile->set_type_hwm(temp); 1.144 + return temp; 1.145 + } 1.146 + inline void operator delete( void* ptr ) { 1.147 + Compile* compile = Compile::current(); 1.148 + compile->type_arena()->Afree(ptr,compile->type_last_size()); 1.149 + } 1.150 + 1.151 + // Initialize the type system for a particular compilation. 1.152 + static void Initialize(Compile* compile); 1.153 + 1.154 + // Initialize the types shared by all compilations. 1.155 + static void Initialize_shared(Compile* compile); 1.156 + 1.157 + TYPES base() const { 1.158 + assert(_base > Bad && _base < lastype, "sanity"); 1.159 + return _base; 1.160 + } 1.161 + 1.162 + // Create a new hash-consd type 1.163 + static const Type *make(enum TYPES); 1.164 + // Test for equivalence of types 1.165 + static int cmp( const Type *const t1, const Type *const t2 ); 1.166 + // Test for higher or equal in lattice 1.167 + int higher_equal( const Type *t ) const { return !cmp(meet(t),t); } 1.168 + 1.169 + // MEET operation; lower in lattice. 1.170 + const Type *meet( const Type *t ) const; 1.171 + // WIDEN: 'widens' for Ints and other range types 1.172 + virtual const Type *widen( const Type *old ) const { return this; } 1.173 + // NARROW: complement for widen, used by pessimistic phases 1.174 + virtual const Type *narrow( const Type *old ) const { return this; } 1.175 + 1.176 + // DUAL operation: reflect around lattice centerline. Used instead of 1.177 + // join to ensure my lattice is symmetric up and down. 1.178 + const Type *dual() const { return _dual; } 1.179 + 1.180 + // Compute meet dependent on base type 1.181 + virtual const Type *xmeet( const Type *t ) const; 1.182 + virtual const Type *xdual() const; // Compute dual right now. 1.183 + 1.184 + // JOIN operation; higher in lattice. Done by finding the dual of the 1.185 + // meet of the dual of the 2 inputs. 1.186 + const Type *join( const Type *t ) const { 1.187 + return dual()->meet(t->dual())->dual(); } 1.188 + 1.189 + // Modified version of JOIN adapted to the needs Node::Value. 1.190 + // Normalizes all empty values to TOP. Does not kill _widen bits. 1.191 + // Currently, it also works around limitations involving interface types. 1.192 + virtual const Type *filter( const Type *kills ) const; 1.193 + 1.194 + // Convenience access 1.195 + float getf() const; 1.196 + double getd() const; 1.197 + 1.198 + const TypeInt *is_int() const; 1.199 + const TypeInt *isa_int() const; // Returns NULL if not an Int 1.200 + const TypeLong *is_long() const; 1.201 + const TypeLong *isa_long() const; // Returns NULL if not a Long 1.202 + const TypeD *is_double_constant() const; // Asserts it is a DoubleCon 1.203 + const TypeD *isa_double_constant() const; // Returns NULL if not a DoubleCon 1.204 + const TypeF *is_float_constant() const; // Asserts it is a FloatCon 1.205 + const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon 1.206 + const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer 1.207 + const TypeAry *is_ary() const; // Array, NOT array pointer 1.208 + const TypePtr *is_ptr() const; // Asserts it is a ptr type 1.209 + const TypePtr *isa_ptr() const; // Returns NULL if not ptr type 1.210 + const TypeRawPtr *is_rawptr() const; // NOT Java oop 1.211 + const TypeOopPtr *isa_oopptr() const; // Returns NULL if not ptr type 1.212 + const TypeKlassPtr *isa_klassptr() const; // Returns NULL if not KlassPtr 1.213 + const TypeKlassPtr *is_klassptr() const; // assert if not KlassPtr 1.214 + const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer 1.215 + const TypeInstPtr *isa_instptr() const; // Returns NULL if not InstPtr 1.216 + const TypeInstPtr *is_instptr() const; // Instance 1.217 + const TypeAryPtr *isa_aryptr() const; // Returns NULL if not AryPtr 1.218 + const TypeAryPtr *is_aryptr() const; // Array oop 1.219 + virtual bool is_finite() const; // Has a finite value 1.220 + virtual bool is_nan() const; // Is not a number (NaN) 1.221 + 1.222 + // Special test for register pressure heuristic 1.223 + bool is_floatingpoint() const; // True if Float or Double base type 1.224 + 1.225 + // Do you have memory, directly or through a tuple? 1.226 + bool has_memory( ) const; 1.227 + 1.228 + // Are you a pointer type or not? 1.229 + bool isa_oop_ptr() const; 1.230 + 1.231 + // TRUE if type is a singleton 1.232 + virtual bool singleton(void) const; 1.233 + 1.234 + // TRUE if type is above the lattice centerline, and is therefore vacuous 1.235 + virtual bool empty(void) const; 1.236 + 1.237 + // Return a hash for this type. The hash function is public so ConNode 1.238 + // (constants) can hash on their constant, which is represented by a Type. 1.239 + virtual int hash() const; 1.240 + 1.241 + // Map ideal registers (machine types) to ideal types 1.242 + static const Type *mreg2type[]; 1.243 + 1.244 + // Printing, statistics 1.245 + static const char * const msg[lastype]; // Printable strings 1.246 +#ifndef PRODUCT 1.247 + void dump_on(outputStream *st) const; 1.248 + void dump() const { 1.249 + dump_on(tty); 1.250 + } 1.251 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 1.252 + static void dump_stats(); 1.253 + static void verify_lastype(); // Check that arrays match type enum 1.254 +#endif 1.255 + void typerr(const Type *t) const; // Mixing types error 1.256 + 1.257 + // Create basic type 1.258 + static const Type* get_const_basic_type(BasicType type) { 1.259 + assert((uint)type <= T_CONFLICT && _const_basic_type[type] != NULL, "bad type"); 1.260 + return _const_basic_type[type]; 1.261 + } 1.262 + 1.263 + // Mapping to the array element's basic type. 1.264 + BasicType array_element_basic_type() const; 1.265 + 1.266 + // Create standard type for a ciType: 1.267 + static const Type* get_const_type(ciType* type); 1.268 + 1.269 + // Create standard zero value: 1.270 + static const Type* get_zero_type(BasicType type) { 1.271 + assert((uint)type <= T_CONFLICT && _zero_type[type] != NULL, "bad type"); 1.272 + return _zero_type[type]; 1.273 + } 1.274 + 1.275 + // Report if this is a zero value (not top). 1.276 + bool is_zero_type() const { 1.277 + BasicType type = basic_type(); 1.278 + if (type == T_VOID || type >= T_CONFLICT) 1.279 + return false; 1.280 + else 1.281 + return (this == _zero_type[type]); 1.282 + } 1.283 + 1.284 + // Convenience common pre-built types. 1.285 + static const Type *ABIO; 1.286 + static const Type *BOTTOM; 1.287 + static const Type *CONTROL; 1.288 + static const Type *DOUBLE; 1.289 + static const Type *FLOAT; 1.290 + static const Type *HALF; 1.291 + static const Type *MEMORY; 1.292 + static const Type *MULTI; 1.293 + static const Type *RETURN_ADDRESS; 1.294 + static const Type *TOP; 1.295 + 1.296 + // Mapping from compiler type to VM BasicType 1.297 + BasicType basic_type() const { return _basic_type[_base]; } 1.298 + 1.299 + // Mapping from CI type system to compiler type: 1.300 + static const Type* get_typeflow_type(ciType* type); 1.301 + 1.302 +private: 1.303 + // support arrays 1.304 + static const BasicType _basic_type[]; 1.305 + static const Type* _zero_type[T_CONFLICT+1]; 1.306 + static const Type* _const_basic_type[T_CONFLICT+1]; 1.307 +}; 1.308 + 1.309 +//------------------------------TypeF------------------------------------------ 1.310 +// Class of Float-Constant Types. 1.311 +class TypeF : public Type { 1.312 + TypeF( float f ) : Type(FloatCon), _f(f) {}; 1.313 +public: 1.314 + virtual bool eq( const Type *t ) const; 1.315 + virtual int hash() const; // Type specific hashing 1.316 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.317 + virtual bool empty(void) const; // TRUE if type is vacuous 1.318 +public: 1.319 + const float _f; // Float constant 1.320 + 1.321 + static const TypeF *make(float f); 1.322 + 1.323 + virtual bool is_finite() const; // Has a finite value 1.324 + virtual bool is_nan() const; // Is not a number (NaN) 1.325 + 1.326 + virtual const Type *xmeet( const Type *t ) const; 1.327 + virtual const Type *xdual() const; // Compute dual right now. 1.328 + // Convenience common pre-built types. 1.329 + static const TypeF *ZERO; // positive zero only 1.330 + static const TypeF *ONE; 1.331 +#ifndef PRODUCT 1.332 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 1.333 +#endif 1.334 +}; 1.335 + 1.336 +//------------------------------TypeD------------------------------------------ 1.337 +// Class of Double-Constant Types. 1.338 +class TypeD : public Type { 1.339 + TypeD( double d ) : Type(DoubleCon), _d(d) {}; 1.340 +public: 1.341 + virtual bool eq( const Type *t ) const; 1.342 + virtual int hash() const; // Type specific hashing 1.343 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.344 + virtual bool empty(void) const; // TRUE if type is vacuous 1.345 +public: 1.346 + const double _d; // Double constant 1.347 + 1.348 + static const TypeD *make(double d); 1.349 + 1.350 + virtual bool is_finite() const; // Has a finite value 1.351 + virtual bool is_nan() const; // Is not a number (NaN) 1.352 + 1.353 + virtual const Type *xmeet( const Type *t ) const; 1.354 + virtual const Type *xdual() const; // Compute dual right now. 1.355 + // Convenience common pre-built types. 1.356 + static const TypeD *ZERO; // positive zero only 1.357 + static const TypeD *ONE; 1.358 +#ifndef PRODUCT 1.359 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 1.360 +#endif 1.361 +}; 1.362 + 1.363 +//------------------------------TypeInt---------------------------------------- 1.364 +// Class of integer ranges, the set of integers between a lower bound and an 1.365 +// upper bound, inclusive. 1.366 +class TypeInt : public Type { 1.367 + TypeInt( jint lo, jint hi, int w ); 1.368 +public: 1.369 + virtual bool eq( const Type *t ) const; 1.370 + virtual int hash() const; // Type specific hashing 1.371 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.372 + virtual bool empty(void) const; // TRUE if type is vacuous 1.373 +public: 1.374 + const jint _lo, _hi; // Lower bound, upper bound 1.375 + const short _widen; // Limit on times we widen this sucker 1.376 + 1.377 + static const TypeInt *make(jint lo); 1.378 + // must always specify w 1.379 + static const TypeInt *make(jint lo, jint hi, int w); 1.380 + 1.381 + // Check for single integer 1.382 + int is_con() const { return _lo==_hi; } 1.383 + bool is_con(int i) const { return is_con() && _lo == i; } 1.384 + jint get_con() const { assert( is_con(), "" ); return _lo; } 1.385 + 1.386 + virtual bool is_finite() const; // Has a finite value 1.387 + 1.388 + virtual const Type *xmeet( const Type *t ) const; 1.389 + virtual const Type *xdual() const; // Compute dual right now. 1.390 + virtual const Type *widen( const Type *t ) const; 1.391 + virtual const Type *narrow( const Type *t ) const; 1.392 + // Do not kill _widen bits. 1.393 + virtual const Type *filter( const Type *kills ) const; 1.394 + // Convenience common pre-built types. 1.395 + static const TypeInt *MINUS_1; 1.396 + static const TypeInt *ZERO; 1.397 + static const TypeInt *ONE; 1.398 + static const TypeInt *BOOL; 1.399 + static const TypeInt *CC; 1.400 + static const TypeInt *CC_LT; // [-1] == MINUS_1 1.401 + static const TypeInt *CC_GT; // [1] == ONE 1.402 + static const TypeInt *CC_EQ; // [0] == ZERO 1.403 + static const TypeInt *CC_LE; // [-1,0] 1.404 + static const TypeInt *CC_GE; // [0,1] == BOOL (!) 1.405 + static const TypeInt *BYTE; 1.406 + static const TypeInt *CHAR; 1.407 + static const TypeInt *SHORT; 1.408 + static const TypeInt *POS; 1.409 + static const TypeInt *POS1; 1.410 + static const TypeInt *INT; 1.411 + static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint] 1.412 +#ifndef PRODUCT 1.413 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 1.414 +#endif 1.415 +}; 1.416 + 1.417 + 1.418 +//------------------------------TypeLong--------------------------------------- 1.419 +// Class of long integer ranges, the set of integers between a lower bound and 1.420 +// an upper bound, inclusive. 1.421 +class TypeLong : public Type { 1.422 + TypeLong( jlong lo, jlong hi, int w ); 1.423 +public: 1.424 + virtual bool eq( const Type *t ) const; 1.425 + virtual int hash() const; // Type specific hashing 1.426 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.427 + virtual bool empty(void) const; // TRUE if type is vacuous 1.428 +public: 1.429 + const jlong _lo, _hi; // Lower bound, upper bound 1.430 + const short _widen; // Limit on times we widen this sucker 1.431 + 1.432 + static const TypeLong *make(jlong lo); 1.433 + // must always specify w 1.434 + static const TypeLong *make(jlong lo, jlong hi, int w); 1.435 + 1.436 + // Check for single integer 1.437 + int is_con() const { return _lo==_hi; } 1.438 + jlong get_con() const { assert( is_con(), "" ); return _lo; } 1.439 + 1.440 + virtual bool is_finite() const; // Has a finite value 1.441 + 1.442 + virtual const Type *xmeet( const Type *t ) const; 1.443 + virtual const Type *xdual() const; // Compute dual right now. 1.444 + virtual const Type *widen( const Type *t ) const; 1.445 + virtual const Type *narrow( const Type *t ) const; 1.446 + // Do not kill _widen bits. 1.447 + virtual const Type *filter( const Type *kills ) const; 1.448 + // Convenience common pre-built types. 1.449 + static const TypeLong *MINUS_1; 1.450 + static const TypeLong *ZERO; 1.451 + static const TypeLong *ONE; 1.452 + static const TypeLong *POS; 1.453 + static const TypeLong *LONG; 1.454 + static const TypeLong *INT; // 32-bit subrange [min_jint..max_jint] 1.455 + static const TypeLong *UINT; // 32-bit unsigned [0..max_juint] 1.456 +#ifndef PRODUCT 1.457 + virtual void dump2( Dict &d, uint, outputStream *st ) const;// Specialized per-Type dumping 1.458 +#endif 1.459 +}; 1.460 + 1.461 +//------------------------------TypeTuple-------------------------------------- 1.462 +// Class of Tuple Types, essentially type collections for function signatures 1.463 +// and class layouts. It happens to also be a fast cache for the HotSpot 1.464 +// signature types. 1.465 +class TypeTuple : public Type { 1.466 + TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { } 1.467 +public: 1.468 + virtual bool eq( const Type *t ) const; 1.469 + virtual int hash() const; // Type specific hashing 1.470 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.471 + virtual bool empty(void) const; // TRUE if type is vacuous 1.472 + 1.473 +public: 1.474 + const uint _cnt; // Count of fields 1.475 + const Type ** const _fields; // Array of field types 1.476 + 1.477 + // Accessors: 1.478 + uint cnt() const { return _cnt; } 1.479 + const Type* field_at(uint i) const { 1.480 + assert(i < _cnt, "oob"); 1.481 + return _fields[i]; 1.482 + } 1.483 + void set_field_at(uint i, const Type* t) { 1.484 + assert(i < _cnt, "oob"); 1.485 + _fields[i] = t; 1.486 + } 1.487 + 1.488 + static const TypeTuple *make( uint cnt, const Type **fields ); 1.489 + static const TypeTuple *make_range(ciSignature *sig); 1.490 + static const TypeTuple *make_domain(ciInstanceKlass* recv, ciSignature *sig); 1.491 + 1.492 + // Subroutine call type with space allocated for argument types 1.493 + static const Type **fields( uint arg_cnt ); 1.494 + 1.495 + virtual const Type *xmeet( const Type *t ) const; 1.496 + virtual const Type *xdual() const; // Compute dual right now. 1.497 + // Convenience common pre-built types. 1.498 + static const TypeTuple *IFBOTH; 1.499 + static const TypeTuple *IFFALSE; 1.500 + static const TypeTuple *IFTRUE; 1.501 + static const TypeTuple *IFNEITHER; 1.502 + static const TypeTuple *LOOPBODY; 1.503 + static const TypeTuple *MEMBAR; 1.504 + static const TypeTuple *STORECONDITIONAL; 1.505 + static const TypeTuple *START_I2C; 1.506 + static const TypeTuple *INT_PAIR; 1.507 + static const TypeTuple *LONG_PAIR; 1.508 +#ifndef PRODUCT 1.509 + virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping 1.510 +#endif 1.511 +}; 1.512 + 1.513 +//------------------------------TypeAry---------------------------------------- 1.514 +// Class of Array Types 1.515 +class TypeAry : public Type { 1.516 + TypeAry( const Type *elem, const TypeInt *size) : Type(Array), 1.517 + _elem(elem), _size(size) {} 1.518 +public: 1.519 + virtual bool eq( const Type *t ) const; 1.520 + virtual int hash() const; // Type specific hashing 1.521 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.522 + virtual bool empty(void) const; // TRUE if type is vacuous 1.523 + 1.524 +private: 1.525 + const Type *_elem; // Element type of array 1.526 + const TypeInt *_size; // Elements in array 1.527 + friend class TypeAryPtr; 1.528 + 1.529 +public: 1.530 + static const TypeAry *make( const Type *elem, const TypeInt *size); 1.531 + 1.532 + virtual const Type *xmeet( const Type *t ) const; 1.533 + virtual const Type *xdual() const; // Compute dual right now. 1.534 + bool ary_must_be_exact() const; // true if arrays of such are never generic 1.535 +#ifndef PRODUCT 1.536 + virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping 1.537 +#endif 1.538 +}; 1.539 + 1.540 +//------------------------------TypePtr---------------------------------------- 1.541 +// Class of machine Pointer Types: raw data, instances or arrays. 1.542 +// If the _base enum is AnyPtr, then this refers to all of the above. 1.543 +// Otherwise the _base will indicate which subset of pointers is affected, 1.544 +// and the class will be inherited from. 1.545 +class TypePtr : public Type { 1.546 +public: 1.547 + enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR }; 1.548 +protected: 1.549 + TypePtr( TYPES t, PTR ptr, int offset ) : Type(t), _ptr(ptr), _offset(offset) {} 1.550 + virtual bool eq( const Type *t ) const; 1.551 + virtual int hash() const; // Type specific hashing 1.552 + static const PTR ptr_meet[lastPTR][lastPTR]; 1.553 + static const PTR ptr_dual[lastPTR]; 1.554 + static const char * const ptr_msg[lastPTR]; 1.555 + 1.556 +public: 1.557 + const int _offset; // Offset into oop, with TOP & BOT 1.558 + const PTR _ptr; // Pointer equivalence class 1.559 + 1.560 + const int offset() const { return _offset; } 1.561 + const PTR ptr() const { return _ptr; } 1.562 + 1.563 + static const TypePtr *make( TYPES t, PTR ptr, int offset ); 1.564 + 1.565 + // Return a 'ptr' version of this type 1.566 + virtual const Type *cast_to_ptr_type(PTR ptr) const; 1.567 + 1.568 + virtual intptr_t get_con() const; 1.569 + 1.570 + virtual const TypePtr *add_offset( int offset ) const; 1.571 + 1.572 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.573 + virtual bool empty(void) const; // TRUE if type is vacuous 1.574 + virtual const Type *xmeet( const Type *t ) const; 1.575 + int meet_offset( int offset ) const; 1.576 + int dual_offset( ) const; 1.577 + virtual const Type *xdual() const; // Compute dual right now. 1.578 + 1.579 + // meet, dual and join over pointer equivalence sets 1.580 + PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; } 1.581 + PTR dual_ptr() const { return ptr_dual[ptr()]; } 1.582 + 1.583 + // This is textually confusing unless one recalls that 1.584 + // join(t) == dual()->meet(t->dual())->dual(). 1.585 + PTR join_ptr( const PTR in_ptr ) const { 1.586 + return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ]; 1.587 + } 1.588 + 1.589 + // Tests for relation to centerline of type lattice: 1.590 + static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); } 1.591 + static bool below_centerline(PTR ptr) { return (ptr >= NotNull); } 1.592 + // Convenience common pre-built types. 1.593 + static const TypePtr *NULL_PTR; 1.594 + static const TypePtr *NOTNULL; 1.595 + static const TypePtr *BOTTOM; 1.596 +#ifndef PRODUCT 1.597 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 1.598 +#endif 1.599 +}; 1.600 + 1.601 +//------------------------------TypeRawPtr------------------------------------- 1.602 +// Class of raw pointers, pointers to things other than Oops. Examples 1.603 +// include the stack pointer, top of heap, card-marking area, handles, etc. 1.604 +class TypeRawPtr : public TypePtr { 1.605 +protected: 1.606 + TypeRawPtr( PTR ptr, address bits ) : TypePtr(RawPtr,ptr,0), _bits(bits){} 1.607 +public: 1.608 + virtual bool eq( const Type *t ) const; 1.609 + virtual int hash() const; // Type specific hashing 1.610 + 1.611 + const address _bits; // Constant value, if applicable 1.612 + 1.613 + static const TypeRawPtr *make( PTR ptr ); 1.614 + static const TypeRawPtr *make( address bits ); 1.615 + 1.616 + // Return a 'ptr' version of this type 1.617 + virtual const Type *cast_to_ptr_type(PTR ptr) const; 1.618 + 1.619 + virtual intptr_t get_con() const; 1.620 + 1.621 + virtual const TypePtr *add_offset( int offset ) const; 1.622 + 1.623 + virtual const Type *xmeet( const Type *t ) const; 1.624 + virtual const Type *xdual() const; // Compute dual right now. 1.625 + // Convenience common pre-built types. 1.626 + static const TypeRawPtr *BOTTOM; 1.627 + static const TypeRawPtr *NOTNULL; 1.628 +#ifndef PRODUCT 1.629 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 1.630 +#endif 1.631 +}; 1.632 + 1.633 +//------------------------------TypeOopPtr------------------------------------- 1.634 +// Some kind of oop (Java pointer), either klass or instance or array. 1.635 +class TypeOopPtr : public TypePtr { 1.636 +protected: 1.637 + TypeOopPtr( TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id ) : TypePtr(t, ptr, offset), _const_oop(o), _klass(k), _klass_is_exact(xk), _instance_id(instance_id) { } 1.638 +public: 1.639 + virtual bool eq( const Type *t ) const; 1.640 + virtual int hash() const; // Type specific hashing 1.641 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.642 + enum { 1.643 + UNKNOWN_INSTANCE = 0 1.644 + }; 1.645 +protected: 1.646 + 1.647 + int xadd_offset( int offset ) const; 1.648 + // Oop is NULL, unless this is a constant oop. 1.649 + ciObject* _const_oop; // Constant oop 1.650 + // If _klass is NULL, then so is _sig. This is an unloaded klass. 1.651 + ciKlass* _klass; // Klass object 1.652 + // Does the type exclude subclasses of the klass? (Inexact == polymorphic.) 1.653 + bool _klass_is_exact; 1.654 + 1.655 + int _instance_id; // if not UNKNOWN_INSTANCE, indicates that this is a particular instance 1.656 + // of this type which is distinct. This is the the node index of the 1.657 + // node creating this instance 1.658 + 1.659 + static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact); 1.660 + 1.661 + int dual_instance() const { return -_instance_id; } 1.662 + int meet_instance(int uid) const; 1.663 + 1.664 +public: 1.665 + // Creates a type given a klass. Correctly handles multi-dimensional arrays 1.666 + // Respects UseUniqueSubclasses. 1.667 + // If the klass is final, the resulting type will be exact. 1.668 + static const TypeOopPtr* make_from_klass(ciKlass* klass) { 1.669 + return make_from_klass_common(klass, true, false); 1.670 + } 1.671 + // Same as before, but will produce an exact type, even if 1.672 + // the klass is not final, as long as it has exactly one implementation. 1.673 + static const TypeOopPtr* make_from_klass_unique(ciKlass* klass) { 1.674 + return make_from_klass_common(klass, true, true); 1.675 + } 1.676 + // Same as before, but does not respects UseUniqueSubclasses. 1.677 + // Use this only for creating array element types. 1.678 + static const TypeOopPtr* make_from_klass_raw(ciKlass* klass) { 1.679 + return make_from_klass_common(klass, false, false); 1.680 + } 1.681 + // Creates a singleton type given an object. 1.682 + static const TypeOopPtr* make_from_constant(ciObject* o); 1.683 + 1.684 + // Make a generic (unclassed) pointer to an oop. 1.685 + static const TypeOopPtr* make(PTR ptr, int offset); 1.686 + 1.687 + ciObject* const_oop() const { return _const_oop; } 1.688 + virtual ciKlass* klass() const { return _klass; } 1.689 + bool klass_is_exact() const { return _klass_is_exact; } 1.690 + bool is_instance() const { return _instance_id != UNKNOWN_INSTANCE; } 1.691 + uint instance_id() const { return _instance_id; } 1.692 + 1.693 + virtual intptr_t get_con() const; 1.694 + 1.695 + virtual const Type *cast_to_ptr_type(PTR ptr) const; 1.696 + 1.697 + virtual const Type *cast_to_exactness(bool klass_is_exact) const; 1.698 + 1.699 + virtual const TypeOopPtr *cast_to_instance(int instance_id) const; 1.700 + 1.701 + // corresponding pointer to klass, for a given instance 1.702 + const TypeKlassPtr* as_klass_type() const; 1.703 + 1.704 + virtual const TypePtr *add_offset( int offset ) const; 1.705 + 1.706 + virtual const Type *xmeet( const Type *t ) const; 1.707 + virtual const Type *xdual() const; // Compute dual right now. 1.708 + 1.709 + // Do not allow interface-vs.-noninterface joins to collapse to top. 1.710 + virtual const Type *filter( const Type *kills ) const; 1.711 + 1.712 + // Convenience common pre-built type. 1.713 + static const TypeOopPtr *BOTTOM; 1.714 +#ifndef PRODUCT 1.715 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 1.716 +#endif 1.717 +}; 1.718 + 1.719 +//------------------------------TypeInstPtr------------------------------------ 1.720 +// Class of Java object pointers, pointing either to non-array Java instances 1.721 +// or to a klassOop (including array klasses). 1.722 +class TypeInstPtr : public TypeOopPtr { 1.723 + TypeInstPtr( PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id ); 1.724 + virtual bool eq( const Type *t ) const; 1.725 + virtual int hash() const; // Type specific hashing 1.726 + 1.727 + ciSymbol* _name; // class name 1.728 + 1.729 + public: 1.730 + ciSymbol* name() const { return _name; } 1.731 + 1.732 + bool is_loaded() const { return _klass->is_loaded(); } 1.733 + 1.734 + // Make a pointer to a constant oop. 1.735 + static const TypeInstPtr *make(ciObject* o) { 1.736 + return make(TypePtr::Constant, o->klass(), true, o, 0); 1.737 + } 1.738 + 1.739 + // Make a pointer to a constant oop with offset. 1.740 + static const TypeInstPtr *make(ciObject* o, int offset) { 1.741 + return make(TypePtr::Constant, o->klass(), true, o, offset); 1.742 + } 1.743 + 1.744 + // Make a pointer to some value of type klass. 1.745 + static const TypeInstPtr *make(PTR ptr, ciKlass* klass) { 1.746 + return make(ptr, klass, false, NULL, 0); 1.747 + } 1.748 + 1.749 + // Make a pointer to some non-polymorphic value of exactly type klass. 1.750 + static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) { 1.751 + return make(ptr, klass, true, NULL, 0); 1.752 + } 1.753 + 1.754 + // Make a pointer to some value of type klass with offset. 1.755 + static const TypeInstPtr *make(PTR ptr, ciKlass* klass, int offset) { 1.756 + return make(ptr, klass, false, NULL, offset); 1.757 + } 1.758 + 1.759 + // Make a pointer to an oop. 1.760 + static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id = 0 ); 1.761 + 1.762 + // If this is a java.lang.Class constant, return the type for it or NULL. 1.763 + // Pass to Type::get_const_type to turn it to a type, which will usually 1.764 + // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc. 1.765 + ciType* java_mirror_type() const; 1.766 + 1.767 + virtual const Type *cast_to_ptr_type(PTR ptr) const; 1.768 + 1.769 + virtual const Type *cast_to_exactness(bool klass_is_exact) const; 1.770 + 1.771 + virtual const TypeOopPtr *cast_to_instance(int instance_id) const; 1.772 + 1.773 + virtual const TypePtr *add_offset( int offset ) const; 1.774 + 1.775 + virtual const Type *xmeet( const Type *t ) const; 1.776 + virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const; 1.777 + virtual const Type *xdual() const; // Compute dual right now. 1.778 + 1.779 + // Convenience common pre-built types. 1.780 + static const TypeInstPtr *NOTNULL; 1.781 + static const TypeInstPtr *BOTTOM; 1.782 + static const TypeInstPtr *MIRROR; 1.783 + static const TypeInstPtr *MARK; 1.784 + static const TypeInstPtr *KLASS; 1.785 +#ifndef PRODUCT 1.786 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping 1.787 +#endif 1.788 +}; 1.789 + 1.790 +//------------------------------TypeAryPtr------------------------------------- 1.791 +// Class of Java array pointers 1.792 +class TypeAryPtr : public TypeOopPtr { 1.793 + TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id ) : TypeOopPtr(AryPtr,ptr,k,xk,o,offset, instance_id), _ary(ary) {}; 1.794 + virtual bool eq( const Type *t ) const; 1.795 + virtual int hash() const; // Type specific hashing 1.796 + const TypeAry *_ary; // Array we point into 1.797 + 1.798 +public: 1.799 + // Accessors 1.800 + ciKlass* klass() const; 1.801 + const TypeAry* ary() const { return _ary; } 1.802 + const Type* elem() const { return _ary->_elem; } 1.803 + const TypeInt* size() const { return _ary->_size; } 1.804 + 1.805 + static const TypeAryPtr *make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = 0); 1.806 + // Constant pointer to array 1.807 + static const TypeAryPtr *make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = 0); 1.808 + 1.809 + // Convenience 1.810 + static const TypeAryPtr *make(ciObject* o); 1.811 + 1.812 + // Return a 'ptr' version of this type 1.813 + virtual const Type *cast_to_ptr_type(PTR ptr) const; 1.814 + 1.815 + virtual const Type *cast_to_exactness(bool klass_is_exact) const; 1.816 + 1.817 + virtual const TypeOopPtr *cast_to_instance(int instance_id) const; 1.818 + 1.819 + virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const; 1.820 + 1.821 + virtual bool empty(void) const; // TRUE if type is vacuous 1.822 + virtual const TypePtr *add_offset( int offset ) const; 1.823 + 1.824 + virtual const Type *xmeet( const Type *t ) const; 1.825 + virtual const Type *xdual() const; // Compute dual right now. 1.826 + 1.827 + // Convenience common pre-built types. 1.828 + static const TypeAryPtr *RANGE; 1.829 + static const TypeAryPtr *OOPS; 1.830 + static const TypeAryPtr *BYTES; 1.831 + static const TypeAryPtr *SHORTS; 1.832 + static const TypeAryPtr *CHARS; 1.833 + static const TypeAryPtr *INTS; 1.834 + static const TypeAryPtr *LONGS; 1.835 + static const TypeAryPtr *FLOATS; 1.836 + static const TypeAryPtr *DOUBLES; 1.837 + // selects one of the above: 1.838 + static const TypeAryPtr *get_array_body_type(BasicType elem) { 1.839 + assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != NULL, "bad elem type"); 1.840 + return _array_body_type[elem]; 1.841 + } 1.842 + static const TypeAryPtr *_array_body_type[T_CONFLICT+1]; 1.843 + // sharpen the type of an int which is used as an array size 1.844 + static const TypeInt* narrow_size_type(const TypeInt* size, BasicType elem); 1.845 +#ifndef PRODUCT 1.846 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping 1.847 +#endif 1.848 +}; 1.849 + 1.850 +//------------------------------TypeKlassPtr----------------------------------- 1.851 +// Class of Java Klass pointers 1.852 +class TypeKlassPtr : public TypeOopPtr { 1.853 + TypeKlassPtr( PTR ptr, ciKlass* klass, int offset ); 1.854 + 1.855 + virtual bool eq( const Type *t ) const; 1.856 + virtual int hash() const; // Type specific hashing 1.857 + 1.858 +public: 1.859 + ciSymbol* name() const { return _klass->name(); } 1.860 + 1.861 + // ptr to klass 'k' 1.862 + static const TypeKlassPtr *make( ciKlass* k ) { return make( TypePtr::Constant, k, 0); } 1.863 + // ptr to klass 'k' with offset 1.864 + static const TypeKlassPtr *make( ciKlass* k, int offset ) { return make( TypePtr::Constant, k, offset); } 1.865 + // ptr to klass 'k' or sub-klass 1.866 + static const TypeKlassPtr *make( PTR ptr, ciKlass* k, int offset); 1.867 + 1.868 + virtual const Type *cast_to_ptr_type(PTR ptr) const; 1.869 + 1.870 + virtual const Type *cast_to_exactness(bool klass_is_exact) const; 1.871 + 1.872 + // corresponding pointer to instance, for a given class 1.873 + const TypeOopPtr* as_instance_type() const; 1.874 + 1.875 + virtual const TypePtr *add_offset( int offset ) const; 1.876 + virtual const Type *xmeet( const Type *t ) const; 1.877 + virtual const Type *xdual() const; // Compute dual right now. 1.878 + 1.879 + // Convenience common pre-built types. 1.880 + static const TypeKlassPtr* OBJECT; // Not-null object klass or below 1.881 + static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same 1.882 +#ifndef PRODUCT 1.883 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping 1.884 +#endif 1.885 +}; 1.886 + 1.887 +//------------------------------TypeFunc--------------------------------------- 1.888 +// Class of Array Types 1.889 +class TypeFunc : public Type { 1.890 + TypeFunc( const TypeTuple *domain, const TypeTuple *range ) : Type(Function), _domain(domain), _range(range) {} 1.891 + virtual bool eq( const Type *t ) const; 1.892 + virtual int hash() const; // Type specific hashing 1.893 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.894 + virtual bool empty(void) const; // TRUE if type is vacuous 1.895 +public: 1.896 + // Constants are shared among ADLC and VM 1.897 + enum { Control = AdlcVMDeps::Control, 1.898 + I_O = AdlcVMDeps::I_O, 1.899 + Memory = AdlcVMDeps::Memory, 1.900 + FramePtr = AdlcVMDeps::FramePtr, 1.901 + ReturnAdr = AdlcVMDeps::ReturnAdr, 1.902 + Parms = AdlcVMDeps::Parms 1.903 + }; 1.904 + 1.905 + const TypeTuple* const _domain; // Domain of inputs 1.906 + const TypeTuple* const _range; // Range of results 1.907 + 1.908 + // Accessors: 1.909 + const TypeTuple* domain() const { return _domain; } 1.910 + const TypeTuple* range() const { return _range; } 1.911 + 1.912 + static const TypeFunc *make(ciMethod* method); 1.913 + static const TypeFunc *make(ciSignature signature, const Type* extra); 1.914 + static const TypeFunc *make(const TypeTuple* domain, const TypeTuple* range); 1.915 + 1.916 + virtual const Type *xmeet( const Type *t ) const; 1.917 + virtual const Type *xdual() const; // Compute dual right now. 1.918 + 1.919 + BasicType return_type() const; 1.920 + 1.921 +#ifndef PRODUCT 1.922 + virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping 1.923 + void print_flattened() const; // Print a 'flattened' signature 1.924 +#endif 1.925 + // Convenience common pre-built types. 1.926 +}; 1.927 + 1.928 +//------------------------------accessors-------------------------------------- 1.929 +inline float Type::getf() const { 1.930 + assert( _base == FloatCon, "Not a FloatCon" ); 1.931 + return ((TypeF*)this)->_f; 1.932 +} 1.933 + 1.934 +inline double Type::getd() const { 1.935 + assert( _base == DoubleCon, "Not a DoubleCon" ); 1.936 + return ((TypeD*)this)->_d; 1.937 +} 1.938 + 1.939 +inline const TypeF *Type::is_float_constant() const { 1.940 + assert( _base == FloatCon, "Not a Float" ); 1.941 + return (TypeF*)this; 1.942 +} 1.943 + 1.944 +inline const TypeF *Type::isa_float_constant() const { 1.945 + return ( _base == FloatCon ? (TypeF*)this : NULL); 1.946 +} 1.947 + 1.948 +inline const TypeD *Type::is_double_constant() const { 1.949 + assert( _base == DoubleCon, "Not a Double" ); 1.950 + return (TypeD*)this; 1.951 +} 1.952 + 1.953 +inline const TypeD *Type::isa_double_constant() const { 1.954 + return ( _base == DoubleCon ? (TypeD*)this : NULL); 1.955 +} 1.956 + 1.957 +inline const TypeInt *Type::is_int() const { 1.958 + assert( _base == Int, "Not an Int" ); 1.959 + return (TypeInt*)this; 1.960 +} 1.961 + 1.962 +inline const TypeInt *Type::isa_int() const { 1.963 + return ( _base == Int ? (TypeInt*)this : NULL); 1.964 +} 1.965 + 1.966 +inline const TypeLong *Type::is_long() const { 1.967 + assert( _base == Long, "Not a Long" ); 1.968 + return (TypeLong*)this; 1.969 +} 1.970 + 1.971 +inline const TypeLong *Type::isa_long() const { 1.972 + return ( _base == Long ? (TypeLong*)this : NULL); 1.973 +} 1.974 + 1.975 +inline const TypeTuple *Type::is_tuple() const { 1.976 + assert( _base == Tuple, "Not a Tuple" ); 1.977 + return (TypeTuple*)this; 1.978 +} 1.979 + 1.980 +inline const TypeAry *Type::is_ary() const { 1.981 + assert( _base == Array , "Not an Array" ); 1.982 + return (TypeAry*)this; 1.983 +} 1.984 + 1.985 +inline const TypePtr *Type::is_ptr() const { 1.986 + // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. 1.987 + assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer"); 1.988 + return (TypePtr*)this; 1.989 +} 1.990 + 1.991 +inline const TypePtr *Type::isa_ptr() const { 1.992 + // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. 1.993 + return (_base >= AnyPtr && _base <= KlassPtr) ? (TypePtr*)this : NULL; 1.994 +} 1.995 + 1.996 +inline const TypeOopPtr *Type::is_oopptr() const { 1.997 + // OopPtr is the first and KlassPtr the last, with no non-oops between. 1.998 + assert(_base >= OopPtr && _base <= KlassPtr, "Not a Java pointer" ) ; 1.999 + return (TypeOopPtr*)this; 1.1000 +} 1.1001 + 1.1002 +inline const TypeOopPtr *Type::isa_oopptr() const { 1.1003 + // OopPtr is the first and KlassPtr the last, with no non-oops between. 1.1004 + return (_base >= OopPtr && _base <= KlassPtr) ? (TypeOopPtr*)this : NULL; 1.1005 +} 1.1006 + 1.1007 +inline const TypeRawPtr *Type::is_rawptr() const { 1.1008 + assert( _base == RawPtr, "Not a raw pointer" ); 1.1009 + return (TypeRawPtr*)this; 1.1010 +} 1.1011 + 1.1012 +inline const TypeInstPtr *Type::isa_instptr() const { 1.1013 + return (_base == InstPtr) ? (TypeInstPtr*)this : NULL; 1.1014 +} 1.1015 + 1.1016 +inline const TypeInstPtr *Type::is_instptr() const { 1.1017 + assert( _base == InstPtr, "Not an object pointer" ); 1.1018 + return (TypeInstPtr*)this; 1.1019 +} 1.1020 + 1.1021 +inline const TypeAryPtr *Type::isa_aryptr() const { 1.1022 + return (_base == AryPtr) ? (TypeAryPtr*)this : NULL; 1.1023 +} 1.1024 + 1.1025 +inline const TypeAryPtr *Type::is_aryptr() const { 1.1026 + assert( _base == AryPtr, "Not an array pointer" ); 1.1027 + return (TypeAryPtr*)this; 1.1028 +} 1.1029 + 1.1030 +inline const TypeKlassPtr *Type::isa_klassptr() const { 1.1031 + return (_base == KlassPtr) ? (TypeKlassPtr*)this : NULL; 1.1032 +} 1.1033 + 1.1034 +inline const TypeKlassPtr *Type::is_klassptr() const { 1.1035 + assert( _base == KlassPtr, "Not a klass pointer" ); 1.1036 + return (TypeKlassPtr*)this; 1.1037 +} 1.1038 + 1.1039 +inline bool Type::is_floatingpoint() const { 1.1040 + if( (_base == FloatCon) || (_base == FloatBot) || 1.1041 + (_base == DoubleCon) || (_base == DoubleBot) ) 1.1042 + return true; 1.1043 + return false; 1.1044 +} 1.1045 + 1.1046 + 1.1047 +// =============================================================== 1.1048 +// Things that need to be 64-bits in the 64-bit build but 1.1049 +// 32-bits in the 32-bit build. Done this way to get full 1.1050 +// optimization AND strong typing. 1.1051 +#ifdef _LP64 1.1052 + 1.1053 +// For type queries and asserts 1.1054 +#define is_intptr_t is_long 1.1055 +#define isa_intptr_t isa_long 1.1056 +#define find_intptr_t_type find_long_type 1.1057 +#define find_intptr_t_con find_long_con 1.1058 +#define TypeX TypeLong 1.1059 +#define Type_X Type::Long 1.1060 +#define TypeX_X TypeLong::LONG 1.1061 +#define TypeX_ZERO TypeLong::ZERO 1.1062 +// For 'ideal_reg' machine registers 1.1063 +#define Op_RegX Op_RegL 1.1064 +// For phase->intcon variants 1.1065 +#define MakeConX longcon 1.1066 +#define ConXNode ConLNode 1.1067 +// For array index arithmetic 1.1068 +#define MulXNode MulLNode 1.1069 +#define AndXNode AndLNode 1.1070 +#define OrXNode OrLNode 1.1071 +#define CmpXNode CmpLNode 1.1072 +#define SubXNode SubLNode 1.1073 +#define LShiftXNode LShiftLNode 1.1074 +// For object size computation: 1.1075 +#define AddXNode AddLNode 1.1076 +// For card marks and hashcodes 1.1077 +#define URShiftXNode URShiftLNode 1.1078 +// Opcodes 1.1079 +#define Op_LShiftX Op_LShiftL 1.1080 +#define Op_AndX Op_AndL 1.1081 +#define Op_AddX Op_AddL 1.1082 +#define Op_SubX Op_SubL 1.1083 +// conversions 1.1084 +#define ConvI2X(x) ConvI2L(x) 1.1085 +#define ConvL2X(x) (x) 1.1086 +#define ConvX2I(x) ConvL2I(x) 1.1087 +#define ConvX2L(x) (x) 1.1088 + 1.1089 +#else 1.1090 + 1.1091 +// For type queries and asserts 1.1092 +#define is_intptr_t is_int 1.1093 +#define isa_intptr_t isa_int 1.1094 +#define find_intptr_t_type find_int_type 1.1095 +#define find_intptr_t_con find_int_con 1.1096 +#define TypeX TypeInt 1.1097 +#define Type_X Type::Int 1.1098 +#define TypeX_X TypeInt::INT 1.1099 +#define TypeX_ZERO TypeInt::ZERO 1.1100 +// For 'ideal_reg' machine registers 1.1101 +#define Op_RegX Op_RegI 1.1102 +// For phase->intcon variants 1.1103 +#define MakeConX intcon 1.1104 +#define ConXNode ConINode 1.1105 +// For array index arithmetic 1.1106 +#define MulXNode MulINode 1.1107 +#define AndXNode AndINode 1.1108 +#define OrXNode OrINode 1.1109 +#define CmpXNode CmpINode 1.1110 +#define SubXNode SubINode 1.1111 +#define LShiftXNode LShiftINode 1.1112 +// For object size computation: 1.1113 +#define AddXNode AddINode 1.1114 +// For card marks and hashcodes 1.1115 +#define URShiftXNode URShiftINode 1.1116 +// Opcodes 1.1117 +#define Op_LShiftX Op_LShiftI 1.1118 +#define Op_AndX Op_AndI 1.1119 +#define Op_AddX Op_AddI 1.1120 +#define Op_SubX Op_SubI 1.1121 +// conversions 1.1122 +#define ConvI2X(x) (x) 1.1123 +#define ConvL2X(x) ConvL2I(x) 1.1124 +#define ConvX2I(x) (x) 1.1125 +#define ConvX2L(x) ConvI2L(x) 1.1126 + 1.1127 +#endif