< prev index next >

src/hotspot/share/opto/type.hpp

Print this page




1122   virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1123   virtual const TypePtr* with_inline_depth(int depth) const;
1124 
1125   virtual const TypePtr* with_instance_id(int instance_id) const;
1126 
1127   virtual const Type *xdual() const;    // Compute dual right now.
1128   // the core of the computation of the meet for TypeOopPtr and for its subclasses
1129   virtual const Type *xmeet_helper(const Type *t) const;
1130 
1131   // Convenience common pre-built type.
1132   static const TypeOopPtr *BOTTOM;
1133 #ifndef PRODUCT
1134   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1135 #endif
1136 };
1137 
1138 //------------------------------TypeInstPtr------------------------------------
1139 // Class of Java object pointers, pointing either to non-array Java instances
1140 // or to a Klass* (including array klasses).
1141 class TypeInstPtr : public TypeOopPtr {
1142   TypeInstPtr(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset, int instance_id,
1143               const TypePtr* speculative, int inline_depth);

1144   virtual bool eq( const Type *t ) const;
1145   virtual int  hash() const;             // Type specific hashing
1146 
1147   ciSymbol*  _name;        // class name





1148 
1149  public:
1150   ciSymbol* name()         const { return _name; }





1151 
1152   bool  is_loaded() const { return _klass->is_loaded(); }
1153 
1154   // Make a pointer to a constant oop.
1155   static const TypeInstPtr *make(ciObject* o) {
1156     return make(TypePtr::Constant, o->klass(), true, o, Offset(0), InstanceBot);
1157   }
1158   // Make a pointer to a constant oop with offset.
1159   static const TypeInstPtr* make(ciObject* o, Offset offset) {
1160     return make(TypePtr::Constant, o->klass(), true, o, offset, InstanceBot);
1161   }
1162 
1163   // Make a pointer to some value of type klass.
1164   static const TypeInstPtr *make(PTR ptr, ciKlass* klass) {
1165     return make(ptr, klass, false, NULL, Offset(0), InstanceBot);
1166   }
1167 
1168   // Make a pointer to some non-polymorphic value of exactly type klass.
1169   static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) {
1170     return make(ptr, klass, true, NULL, Offset(0), InstanceBot);
1171   }
1172 
1173   // Make a pointer to some value of type klass with offset.
1174   static const TypeInstPtr *make(PTR ptr, ciKlass* klass, Offset offset) {
1175     return make(ptr, klass, false, NULL, offset, InstanceBot);
1176   }
1177 
1178   // Make a pointer to an oop.
1179   static const TypeInstPtr* make(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset,

1180                                  int instance_id = InstanceBot,
1181                                  const TypePtr* speculative = NULL,
1182                                  int inline_depth = InlineDepthBottom);
1183 
1184   /** Create constant type for a constant boxed value */
1185   const Type* get_const_boxed_value() const;
1186 
1187   // If this is a java.lang.Class constant, return the type for it or NULL.
1188   // Pass to Type::get_const_type to turn it to a type, which will usually
1189   // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
1190   ciType* java_mirror_type(bool* is_indirect_type = NULL) const;
1191 
1192   virtual const Type *cast_to_ptr_type(PTR ptr) const;
1193 
1194   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1195 
1196   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1197 
1198   virtual const TypeOopPtr *cast_to_nonconst() const;
1199 
1200   virtual const TypePtr *add_offset( intptr_t offset ) const;
1201 
1202   // Speculative type helper methods.
1203   virtual const Type* remove_speculative() const;
1204   virtual const TypePtr* with_inline_depth(int depth) const;
1205   virtual const TypePtr* with_instance_id(int instance_id) const;
1206 


1207   // the core of the computation of the meet of 2 types
1208   virtual const Type *xmeet_helper(const Type *t) const;
1209   virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const;
1210   virtual const Type *xdual() const;    // Compute dual right now.
1211 
1212   // Convenience common pre-built types.
1213   static const TypeInstPtr *NOTNULL;
1214   static const TypeInstPtr *BOTTOM;
1215   static const TypeInstPtr *MIRROR;
1216   static const TypeInstPtr *MARK;
1217   static const TypeInstPtr *KLASS;
1218 #ifndef PRODUCT
1219   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1220 #endif
1221 };
1222 
1223 //------------------------------TypeAryPtr-------------------------------------
1224 // Class of Java array pointers
1225 class TypeAryPtr : public TypeOopPtr {
1226   TypeAryPtr(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk,


1382   virtual const Type *cast_to_ptr_type(PTR ptr) const;
1383 
1384   virtual const TypePtr *add_offset( intptr_t offset ) const;
1385 
1386   virtual const Type *xmeet( const Type *t ) const;
1387   virtual const Type *xdual() const;    // Compute dual right now.
1388 
1389   virtual intptr_t get_con() const;
1390 
1391   // Convenience common pre-built types.
1392   static const TypeMetadataPtr *BOTTOM;
1393 
1394 #ifndef PRODUCT
1395   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1396 #endif
1397 };
1398 
1399 //------------------------------TypeKlassPtr-----------------------------------
1400 // Class of Java Klass pointers
1401 class TypeKlassPtr : public TypePtr {
1402   TypeKlassPtr(PTR ptr, ciKlass* klass, Offset offset);
1403 
1404 protected:
1405   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1406  public:
1407   virtual bool eq( const Type *t ) const;
1408   virtual int hash() const;             // Type specific hashing
1409   virtual bool singleton(void) const;    // TRUE if type is a singleton
1410  private:
1411 
1412   ciKlass* _klass;
1413 
1414   // Does the type exclude subclasses of the klass?  (Inexact == polymorphic.)
1415   bool          _klass_is_exact;

1416 
1417 public:
1418   ciKlass* klass() const { return  _klass; }
1419   bool klass_is_exact()    const { return _klass_is_exact; }
1420 








1421   bool  is_loaded() const { return klass() != NULL && klass()->is_loaded(); }
1422 
1423   // ptr to klass 'k'
1424   static const TypeKlassPtr* make(ciKlass* k) { return make( TypePtr::Constant, k, Offset(0)); }
1425   // ptr to klass 'k' with offset
1426   static const TypeKlassPtr* make(ciKlass* k, Offset offset) { return make( TypePtr::Constant, k, offset); }
1427   // ptr to klass 'k' or sub-klass
1428   static const TypeKlassPtr* make(PTR ptr, ciKlass* k, Offset offset);
1429 
1430   virtual const Type *cast_to_ptr_type(PTR ptr) const;
1431 
1432   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1433 
1434   // corresponding pointer to instance, for a given class
1435   const TypeOopPtr* as_instance_type() const;
1436 
1437   virtual const TypePtr *add_offset( intptr_t offset ) const;
1438   virtual const Type    *xmeet( const Type *t ) const;
1439   virtual const Type    *xdual() const;      // Compute dual right now.
1440 
1441   virtual intptr_t get_con() const;
1442 
1443   // Convenience common pre-built types.
1444   static const TypeKlassPtr* OBJECT; // Not-null object klass or below
1445   static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
1446 #ifndef PRODUCT
1447   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1448 #endif




1122   virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1123   virtual const TypePtr* with_inline_depth(int depth) const;
1124 
1125   virtual const TypePtr* with_instance_id(int instance_id) const;
1126 
1127   virtual const Type *xdual() const;    // Compute dual right now.
1128   // the core of the computation of the meet for TypeOopPtr and for its subclasses
1129   virtual const Type *xmeet_helper(const Type *t) const;
1130 
1131   // Convenience common pre-built type.
1132   static const TypeOopPtr *BOTTOM;
1133 #ifndef PRODUCT
1134   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1135 #endif
1136 };
1137 
1138 //------------------------------TypeInstPtr------------------------------------
1139 // Class of Java object pointers, pointing either to non-array Java instances
1140 // or to a Klass* (including array klasses).
1141 class TypeInstPtr : public TypeOopPtr {
1142   TypeInstPtr(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset,
1143               bool is_value, int instance_id, const TypePtr* speculative,
1144               int inline_depth);
1145   virtual bool eq( const Type *t ) const;
1146   virtual int  hash() const;             // Type specific hashing
1147 
1148   ciSymbol*  _name;        // class name
1149   bool _flatten_array;
1150   
1151   bool meet_flatten_array(bool other_flatten_array) const {
1152     return (_flatten_array && other_flatten_array) ? true : false;
1153   }
1154   
1155  public:
1156   ciSymbol* name()         const { return _name; }
1157   bool flatten_array() const {
1158     assert(!klass()->is_valuetype() || !klass()->as_value_klass()->flatten_array() || _flatten_array, "incorrect value bit");
1159     assert(!_flatten_array || can_be_value_type(), "incorrect value bit");
1160     return _flatten_array;
1161   }
1162 
1163   bool  is_loaded() const { return _klass->is_loaded(); }
1164 
1165   // Make a pointer to a constant oop.
1166   static const TypeInstPtr *make(ciObject* o) {
1167     return make(TypePtr::Constant, o->klass(), true, o, Offset(0), o->klass()->is_valuetype() && o->klass()->as_value_klass()->flatten_array(), InstanceBot);
1168   }
1169   // Make a pointer to a constant oop with offset.
1170   static const TypeInstPtr* make(ciObject* o, Offset offset) {
1171     return make(TypePtr::Constant, o->klass(), true, o, offset, o->klass()->is_valuetype() && o->klass()->as_value_klass()->flatten_array(), InstanceBot);
1172   }
1173 
1174   // Make a pointer to some value of type klass.
1175   static const TypeInstPtr *make(PTR ptr, ciKlass* klass) {
1176     return make(ptr, klass, false, NULL, Offset(0), klass->is_valuetype() && klass->as_value_klass()->flatten_array(), InstanceBot);
1177   }
1178 
1179   // Make a pointer to some non-polymorphic value of exactly type klass.
1180   static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) {
1181     return make(ptr, klass, true, NULL, Offset(0), klass->is_valuetype() && klass->as_value_klass()->flatten_array(), InstanceBot);
1182   }
1183 
1184   // Make a pointer to some value of type klass with offset.
1185   static const TypeInstPtr *make(PTR ptr, ciKlass* klass, Offset offset) {
1186     return make(ptr, klass, false, NULL, offset, klass->is_valuetype() && klass->as_value_klass()->flatten_array(), InstanceBot);
1187   }
1188 
1189   // Make a pointer to an oop.
1190   static const TypeInstPtr* make(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset,
1191                                  bool flatten_array,
1192                                  int instance_id = InstanceBot,
1193                                  const TypePtr* speculative = NULL,
1194                                  int inline_depth = InlineDepthBottom);
1195 
1196   /** Create constant type for a constant boxed value */
1197   const Type* get_const_boxed_value() const;
1198 
1199   // If this is a java.lang.Class constant, return the type for it or NULL.
1200   // Pass to Type::get_const_type to turn it to a type, which will usually
1201   // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
1202   ciType* java_mirror_type(bool* is_indirect_type = NULL) const;
1203 
1204   virtual const Type *cast_to_ptr_type(PTR ptr) const;
1205 
1206   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1207 
1208   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1209 
1210   virtual const TypeOopPtr *cast_to_nonconst() const;
1211 
1212   virtual const TypePtr *add_offset( intptr_t offset ) const;
1213 
1214   // Speculative type helper methods.
1215   virtual const Type* remove_speculative() const;
1216   virtual const TypePtr* with_inline_depth(int depth) const;
1217   virtual const TypePtr* with_instance_id(int instance_id) const;
1218 
1219   virtual const TypeInstPtr* cast_to_flatten_array() const;
1220 
1221   // the core of the computation of the meet of 2 types
1222   virtual const Type *xmeet_helper(const Type *t) const;
1223   virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const;
1224   virtual const Type *xdual() const;    // Compute dual right now.
1225 
1226   // Convenience common pre-built types.
1227   static const TypeInstPtr *NOTNULL;
1228   static const TypeInstPtr *BOTTOM;
1229   static const TypeInstPtr *MIRROR;
1230   static const TypeInstPtr *MARK;
1231   static const TypeInstPtr *KLASS;
1232 #ifndef PRODUCT
1233   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1234 #endif
1235 };
1236 
1237 //------------------------------TypeAryPtr-------------------------------------
1238 // Class of Java array pointers
1239 class TypeAryPtr : public TypeOopPtr {
1240   TypeAryPtr(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk,


1396   virtual const Type *cast_to_ptr_type(PTR ptr) const;
1397 
1398   virtual const TypePtr *add_offset( intptr_t offset ) const;
1399 
1400   virtual const Type *xmeet( const Type *t ) const;
1401   virtual const Type *xdual() const;    // Compute dual right now.
1402 
1403   virtual intptr_t get_con() const;
1404 
1405   // Convenience common pre-built types.
1406   static const TypeMetadataPtr *BOTTOM;
1407 
1408 #ifndef PRODUCT
1409   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1410 #endif
1411 };
1412 
1413 //------------------------------TypeKlassPtr-----------------------------------
1414 // Class of Java Klass pointers
1415 class TypeKlassPtr : public TypePtr {
1416   TypeKlassPtr(PTR ptr, ciKlass* klass, Offset offset, bool flatten_array);
1417 
1418 protected:
1419   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1420  public:
1421   virtual bool eq( const Type *t ) const;
1422   virtual int hash() const;             // Type specific hashing
1423   virtual bool singleton(void) const;    // TRUE if type is a singleton
1424  private:
1425 
1426   ciKlass* _klass;
1427 
1428   // Does the type exclude subclasses of the klass?  (Inexact == polymorphic.)
1429   bool          _klass_is_exact;
1430   bool _flatten_array;
1431 
1432 public:
1433   ciKlass* klass() const { return  _klass; }
1434   bool klass_is_exact()    const { return _klass_is_exact; }
1435 
1436   virtual bool can_be_value_type() const { return EnableValhalla && can_be_value_type_raw(); }
1437   virtual bool can_be_value_type_raw() const { return _klass == NULL || !_klass->is_loaded() || _klass->is_valuetype() || ((_klass->is_java_lang_Object() || _klass->is_interface()) && !klass_is_exact()); }
1438   bool flatten_array() const {
1439     assert(!klass()->is_valuetype() || !klass()->as_value_klass()->flatten_array() || _flatten_array, "incorrect value bit");
1440     assert(!_flatten_array || can_be_value_type(), "incorrect value bit");
1441     return _flatten_array;
1442   }
1443 
1444   bool  is_loaded() const { return klass() != NULL && klass()->is_loaded(); }
1445 
1446   // ptr to klass 'k'
1447   static const TypeKlassPtr* make(ciKlass* k) { return make( TypePtr::Constant, k, Offset(0), k->is_valuetype() && k->as_value_klass()->flatten_array()); }
1448   // ptr to klass 'k' with offset
1449   static const TypeKlassPtr* make(ciKlass* k, Offset offset) { return make( TypePtr::Constant, k, offset, k->is_valuetype() && k->as_value_klass()->flatten_array()); }
1450   // ptr to klass 'k' or sub-klass
1451   static const TypeKlassPtr* make(PTR ptr, ciKlass* k, Offset offset, bool flatten_array);
1452 
1453   virtual const Type *cast_to_ptr_type(PTR ptr) const;
1454 
1455   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1456 
1457   // corresponding pointer to instance, for a given class
1458   const TypeOopPtr* as_instance_type() const;
1459 
1460   virtual const TypePtr *add_offset( intptr_t offset ) const;
1461   virtual const Type    *xmeet( const Type *t ) const;
1462   virtual const Type    *xdual() const;      // Compute dual right now.
1463 
1464   virtual intptr_t get_con() const;
1465 
1466   // Convenience common pre-built types.
1467   static const TypeKlassPtr* OBJECT; // Not-null object klass or below
1468   static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
1469 #ifndef PRODUCT
1470   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1471 #endif


< prev index next >