79 Top, // Top of the lattice |
81 Top, // Top of the lattice |
80 Int, // Integer range (lo-hi) |
82 Int, // Integer range (lo-hi) |
81 Long, // Long integer range (lo-hi) |
83 Long, // Long integer range (lo-hi) |
82 Half, // Placeholder half of doubleword |
84 Half, // Placeholder half of doubleword |
83 NarrowOop, // Compressed oop pointer |
85 NarrowOop, // Compressed oop pointer |
|
86 NarrowKlass, // Compressed klass pointer |
84 |
87 |
85 Tuple, // Method signature or object layout |
88 Tuple, // Method signature or object layout |
86 Array, // Array types |
89 Array, // Array types |
87 VectorS, // 32bit Vector types |
90 VectorS, // 32bit Vector types |
88 VectorD, // 64bit Vector types |
91 VectorD, // 64bit Vector types |
250 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type |
254 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type |
251 const TypeRawPtr *isa_rawptr() const; // NOT Java oop |
255 const TypeRawPtr *isa_rawptr() const; // NOT Java oop |
252 const TypeRawPtr *is_rawptr() const; // Asserts is rawptr |
256 const TypeRawPtr *is_rawptr() const; // Asserts is rawptr |
253 const TypeNarrowOop *is_narrowoop() const; // Java-style GC'd pointer |
257 const TypeNarrowOop *is_narrowoop() const; // Java-style GC'd pointer |
254 const TypeNarrowOop *isa_narrowoop() const; // Returns NULL if not oop ptr type |
258 const TypeNarrowOop *isa_narrowoop() const; // Returns NULL if not oop ptr type |
|
259 const TypeNarrowKlass *is_narrowklass() const; // compressed klass pointer |
|
260 const TypeNarrowKlass *isa_narrowklass() const;// Returns NULL if not oop ptr type |
255 const TypeOopPtr *isa_oopptr() const; // Returns NULL if not oop ptr type |
261 const TypeOopPtr *isa_oopptr() const; // Returns NULL if not oop ptr type |
256 const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer |
262 const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer |
257 const TypeInstPtr *isa_instptr() const; // Returns NULL if not InstPtr |
263 const TypeInstPtr *isa_instptr() const; // Returns NULL if not InstPtr |
258 const TypeInstPtr *is_instptr() const; // Instance |
264 const TypeInstPtr *is_instptr() const; // Instance |
259 const TypeAryPtr *isa_aryptr() const; // Returns NULL if not AryPtr |
265 const TypeAryPtr *isa_aryptr() const; // Returns NULL if not AryPtr |
668 // Class of machine Pointer Types: raw data, instances or arrays. |
678 // Class of machine Pointer Types: raw data, instances or arrays. |
669 // If the _base enum is AnyPtr, then this refers to all of the above. |
679 // If the _base enum is AnyPtr, then this refers to all of the above. |
670 // Otherwise the _base will indicate which subset of pointers is affected, |
680 // Otherwise the _base will indicate which subset of pointers is affected, |
671 // and the class will be inherited from. |
681 // and the class will be inherited from. |
672 class TypePtr : public Type { |
682 class TypePtr : public Type { |
673 friend class TypeNarrowOop; |
683 friend class TypeNarrowPtr; |
674 public: |
684 public: |
675 enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR }; |
685 enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR }; |
676 protected: |
686 protected: |
677 TypePtr( TYPES t, PTR ptr, int offset ) : Type(t), _ptr(ptr), _offset(offset) {} |
687 TypePtr( TYPES t, PTR ptr, int offset ) : Type(t), _ptr(ptr), _offset(offset) {} |
678 virtual bool eq( const Type *t ) const; |
688 virtual bool eq( const Type *t ) const; |
1120 #ifndef PRODUCT |
1132 #ifndef PRODUCT |
1121 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping |
1133 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping |
1122 #endif |
1134 #endif |
1123 }; |
1135 }; |
1124 |
1136 |
|
1137 class TypeNarrowPtr : public Type { |
|
1138 protected: |
|
1139 const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR |
|
1140 |
|
1141 TypeNarrowPtr(TYPES t, const TypePtr* ptrtype): _ptrtype(ptrtype), |
|
1142 Type(t) { |
|
1143 assert(ptrtype->offset() == 0 || |
|
1144 ptrtype->offset() == OffsetBot || |
|
1145 ptrtype->offset() == OffsetTop, "no real offsets"); |
|
1146 } |
|
1147 |
|
1148 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const = 0; |
|
1149 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0; |
|
1150 virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const = 0; |
|
1151 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const = 0; |
|
1152 public: |
|
1153 virtual bool eq( const Type *t ) const; |
|
1154 virtual int hash() const; // Type specific hashing |
|
1155 virtual bool singleton(void) const; // TRUE if type is a singleton |
|
1156 |
|
1157 virtual const Type *xmeet( const Type *t ) const; |
|
1158 virtual const Type *xdual() const; // Compute dual right now. |
|
1159 |
|
1160 virtual intptr_t get_con() const; |
|
1161 |
|
1162 // Do not allow interface-vs.-noninterface joins to collapse to top. |
|
1163 virtual const Type *filter( const Type *kills ) const; |
|
1164 |
|
1165 virtual bool empty(void) const; // TRUE if type is vacuous |
|
1166 |
|
1167 // returns the equivalent ptr type for this compressed pointer |
|
1168 const TypePtr *get_ptrtype() const { |
|
1169 return _ptrtype; |
|
1170 } |
|
1171 |
|
1172 #ifndef PRODUCT |
|
1173 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
|
1174 #endif |
|
1175 }; |
|
1176 |
1125 //------------------------------TypeNarrowOop---------------------------------- |
1177 //------------------------------TypeNarrowOop---------------------------------- |
1126 // A compressed reference to some kind of Oop. This type wraps around |
1178 // A compressed reference to some kind of Oop. This type wraps around |
1127 // a preexisting TypeOopPtr and forwards most of it's operations to |
1179 // a preexisting TypeOopPtr and forwards most of it's operations to |
1128 // the underlying type. It's only real purpose is to track the |
1180 // the underlying type. It's only real purpose is to track the |
1129 // oopness of the compressed oop value when we expose the conversion |
1181 // oopness of the compressed oop value when we expose the conversion |
1130 // between the normal and the compressed form. |
1182 // between the normal and the compressed form. |
1131 class TypeNarrowOop : public Type { |
1183 class TypeNarrowOop : public TypeNarrowPtr { |
1132 protected: |
1184 protected: |
1133 const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR |
1185 TypeNarrowOop( const TypePtr* ptrtype): TypeNarrowPtr(NarrowOop, ptrtype) { |
1134 |
1186 } |
1135 TypeNarrowOop( const TypePtr* ptrtype): Type(NarrowOop), |
1187 |
1136 _ptrtype(ptrtype) { |
1188 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const { |
1137 assert(ptrtype->offset() == 0 || |
1189 return t->isa_narrowoop(); |
1138 ptrtype->offset() == OffsetBot || |
1190 } |
1139 ptrtype->offset() == OffsetTop, "no real offsets"); |
1191 |
1140 } |
1192 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const { |
1141 public: |
1193 return t->is_narrowoop(); |
1142 virtual bool eq( const Type *t ) const; |
1194 } |
1143 virtual int hash() const; // Type specific hashing |
1195 |
1144 virtual bool singleton(void) const; // TRUE if type is a singleton |
1196 virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const { |
1145 |
1197 return new TypeNarrowOop(t); |
1146 virtual const Type *xmeet( const Type *t ) const; |
1198 } |
1147 virtual const Type *xdual() const; // Compute dual right now. |
1199 |
1148 |
1200 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const { |
1149 virtual intptr_t get_con() const; |
1201 return (const TypeNarrowPtr*)((new TypeNarrowOop(t))->hashcons()); |
1150 |
1202 } |
1151 // Do not allow interface-vs.-noninterface joins to collapse to top. |
1203 |
1152 virtual const Type *filter( const Type *kills ) const; |
1204 public: |
1153 |
|
1154 virtual bool empty(void) const; // TRUE if type is vacuous |
|
1155 |
1205 |
1156 static const TypeNarrowOop *make( const TypePtr* type); |
1206 static const TypeNarrowOop *make( const TypePtr* type); |
1157 |
1207 |
1158 static const TypeNarrowOop* make_from_constant(ciObject* con, bool require_constant = false) { |
1208 static const TypeNarrowOop* make_from_constant(ciObject* con, bool require_constant = false) { |
1159 return make(TypeOopPtr::make_from_constant(con, require_constant)); |
1209 return make(TypeOopPtr::make_from_constant(con, require_constant)); |
1160 } |
1210 } |
1161 |
1211 |
1162 // returns the equivalent ptr type for this compressed pointer |
|
1163 const TypePtr *get_ptrtype() const { |
|
1164 return _ptrtype; |
|
1165 } |
|
1166 |
|
1167 static const TypeNarrowOop *BOTTOM; |
1212 static const TypeNarrowOop *BOTTOM; |
1168 static const TypeNarrowOop *NULL_PTR; |
1213 static const TypeNarrowOop *NULL_PTR; |
|
1214 |
|
1215 #ifndef PRODUCT |
|
1216 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
|
1217 #endif |
|
1218 }; |
|
1219 |
|
1220 //------------------------------TypeNarrowKlass---------------------------------- |
|
1221 // A compressed reference to klass pointer. This type wraps around a |
|
1222 // preexisting TypeKlassPtr and forwards most of it's operations to |
|
1223 // the underlying type. |
|
1224 class TypeNarrowKlass : public TypeNarrowPtr { |
|
1225 protected: |
|
1226 TypeNarrowKlass( const TypePtr* ptrtype): TypeNarrowPtr(NarrowKlass, ptrtype) { |
|
1227 } |
|
1228 |
|
1229 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const { |
|
1230 return t->isa_narrowklass(); |
|
1231 } |
|
1232 |
|
1233 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const { |
|
1234 return t->is_narrowklass(); |
|
1235 } |
|
1236 |
|
1237 virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const { |
|
1238 return new TypeNarrowKlass(t); |
|
1239 } |
|
1240 |
|
1241 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const { |
|
1242 return (const TypeNarrowPtr*)((new TypeNarrowKlass(t))->hashcons()); |
|
1243 } |
|
1244 |
|
1245 public: |
|
1246 static const TypeNarrowKlass *make( const TypePtr* type); |
|
1247 |
|
1248 // static const TypeNarrowKlass *BOTTOM; |
|
1249 static const TypeNarrowKlass *NULL_PTR; |
1169 |
1250 |
1170 #ifndef PRODUCT |
1251 #ifndef PRODUCT |
1171 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
1252 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; |
1172 #endif |
1253 #endif |
1173 }; |
1254 }; |
1344 inline const TypeNarrowOop *Type::isa_narrowoop() const { |
1433 inline const TypeNarrowOop *Type::isa_narrowoop() const { |
1345 // OopPtr is the first and KlassPtr the last, with no non-oops between. |
1434 // OopPtr is the first and KlassPtr the last, with no non-oops between. |
1346 return (_base == NarrowOop) ? (TypeNarrowOop*)this : NULL; |
1435 return (_base == NarrowOop) ? (TypeNarrowOop*)this : NULL; |
1347 } |
1436 } |
1348 |
1437 |
|
1438 inline const TypeNarrowKlass *Type::is_narrowklass() const { |
|
1439 assert(_base == NarrowKlass, "Not a narrow oop" ) ; |
|
1440 return (TypeNarrowKlass*)this; |
|
1441 } |
|
1442 |
|
1443 inline const TypeNarrowKlass *Type::isa_narrowklass() const { |
|
1444 return (_base == NarrowKlass) ? (TypeNarrowKlass*)this : NULL; |
|
1445 } |
|
1446 |
1349 inline const TypeMetadataPtr *Type::is_metadataptr() const { |
1447 inline const TypeMetadataPtr *Type::is_metadataptr() const { |
1350 // MetadataPtr is the first and CPCachePtr the last |
1448 // MetadataPtr is the first and CPCachePtr the last |
1351 assert(_base == MetadataPtr, "Not a metadata pointer" ) ; |
1449 assert(_base == MetadataPtr, "Not a metadata pointer" ) ; |
1352 return (TypeMetadataPtr*)this; |
1450 return (TypeMetadataPtr*)this; |
1353 } |
1451 } |
1365 return (TypeKlassPtr*)this; |
1463 return (TypeKlassPtr*)this; |
1366 } |
1464 } |
1367 |
1465 |
1368 inline const TypePtr* Type::make_ptr() const { |
1466 inline const TypePtr* Type::make_ptr() const { |
1369 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype() : |
1467 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype() : |
1370 (isa_ptr() ? is_ptr() : NULL); |
1468 ((_base == NarrowKlass) ? is_narrowklass()->get_ptrtype() : |
|
1469 (isa_ptr() ? is_ptr() : NULL)); |
1371 } |
1470 } |
1372 |
1471 |
1373 inline const TypeOopPtr* Type::make_oopptr() const { |
1472 inline const TypeOopPtr* Type::make_oopptr() const { |
1374 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->is_oopptr() : is_oopptr(); |
1473 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->is_oopptr() : is_oopptr(); |
1375 } |
1474 } |
1376 |
1475 |
1377 inline const TypeNarrowOop* Type::make_narrowoop() const { |
1476 inline const TypeNarrowOop* Type::make_narrowoop() const { |
1378 return (_base == NarrowOop) ? is_narrowoop() : |
1477 return (_base == NarrowOop) ? is_narrowoop() : |
1379 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL); |
1478 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL); |
|
1479 } |
|
1480 |
|
1481 inline const TypeNarrowKlass* Type::make_narrowklass() const { |
|
1482 return (_base == NarrowKlass) ? is_narrowklass() : |
|
1483 (isa_ptr() ? TypeNarrowKlass::make(is_ptr()) : NULL); |
1380 } |
1484 } |
1381 |
1485 |
1382 inline bool Type::is_floatingpoint() const { |
1486 inline bool Type::is_floatingpoint() const { |
1383 if( (_base == FloatCon) || (_base == FloatBot) || |
1487 if( (_base == FloatCon) || (_base == FloatBot) || |
1384 (_base == DoubleCon) || (_base == DoubleBot) ) |
1488 (_base == DoubleCon) || (_base == DoubleBot) ) |