8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OPTO_TYPE_HPP
26 #define SHARE_OPTO_TYPE_HPP
27
28 #include "opto/adlcVMDeps.hpp"
29 #include "runtime/handles.hpp"
30
31 // Portions of code courtesy of Clifford Click
32
33 // Optimization - Graph Style
34
35
36 // This class defines a Type lattice. The lattice is used in the constant
37 // propagation algorithms, and for some type-checking of the iloc code.
38 // Basic types include RSD's (lower bound, upper bound, stride for integers),
39 // float & double precision constants, sets of data-labels and code-labels.
40 // The complete lattice is described below. Subtypes have no relationship to
41 // up or down in the lattice; that is entirely determined by the behavior of
42 // the MEET/JOIN functions.
43
44 class Dict;
45 class Type;
46 class TypeD;
47 class TypeF;
48 class TypeInteger;
49 class TypeInt;
119 Function, // Function signature
120 Abio, // Abstract I/O
121 Return_Address, // Subroutine return address
122 Memory, // Abstract store
123 FloatTop, // No float value
124 FloatCon, // Floating point constant
125 FloatBot, // Any float value
126 DoubleTop, // No double value
127 DoubleCon, // Double precision constant
128 DoubleBot, // Any double value
129 Bottom, // Bottom of lattice
130 lastype // Bogus ending type (not in lattice)
131 };
132
133 // Signal values for offsets from a base pointer
134 enum OFFSET_SIGNALS {
135 OffsetTop = -2000000000, // undefined offset
136 OffsetBot = -2000000001 // any possible offset
137 };
138
139 // Min and max WIDEN values.
140 enum WIDEN {
141 WidenMin = 0,
142 WidenMax = 3
143 };
144
145 private:
146 typedef struct {
147 TYPES dual_type;
148 BasicType basic_type;
149 const char* msg;
150 bool isa_oop;
151 uint ideal_reg;
152 relocInfo::relocType reloc;
153 } TypeInfo;
154
155 // Dictionary of types shared among compilations.
156 static Dict* _shared_type_dict;
157 static const TypeInfo _type_info[];
158
309 const TypeNarrowKlass *isa_narrowklass() const;// Returns null if not oop ptr type
310 const TypeOopPtr *isa_oopptr() const; // Returns null if not oop ptr type
311 const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer
312 const TypeInstPtr *isa_instptr() const; // Returns null if not InstPtr
313 const TypeInstPtr *is_instptr() const; // Instance
314 const TypeAryPtr *isa_aryptr() const; // Returns null if not AryPtr
315 const TypeAryPtr *is_aryptr() const; // Array oop
316
317 const TypeMetadataPtr *isa_metadataptr() const; // Returns null if not oop ptr type
318 const TypeMetadataPtr *is_metadataptr() const; // Java-style GC'd pointer
319 const TypeKlassPtr *isa_klassptr() const; // Returns null if not KlassPtr
320 const TypeKlassPtr *is_klassptr() const; // assert if not KlassPtr
321 const TypeInstKlassPtr *isa_instklassptr() const; // Returns null if not IntKlassPtr
322 const TypeInstKlassPtr *is_instklassptr() const; // assert if not IntKlassPtr
323 const TypeAryKlassPtr *isa_aryklassptr() const; // Returns null if not AryKlassPtr
324 const TypeAryKlassPtr *is_aryklassptr() const; // assert if not AryKlassPtr
325
326 virtual bool is_finite() const; // Has a finite value
327 virtual bool is_nan() const; // Is not a number (NaN)
328
329 // Returns this ptr type or the equivalent ptr type for this compressed pointer.
330 const TypePtr* make_ptr() const;
331
332 // Returns this oopptr type or the equivalent oopptr type for this compressed pointer.
333 // Asserts if the underlying type is not an oopptr or narrowoop.
334 const TypeOopPtr* make_oopptr() const;
335
336 // Returns this compressed pointer or the equivalent compressed version
337 // of this pointer type.
338 const TypeNarrowOop* make_narrowoop() const;
339
340 // Returns this compressed klass pointer or the equivalent
341 // compressed version of this pointer type.
342 const TypeNarrowKlass* make_narrowklass() const;
343
344 // Special test for register pressure heuristic
345 bool is_floatingpoint() const; // True if Float or Double base type
346
347 // Do you have memory, directly or through a tuple?
348 bool has_memory( ) const;
707 const Type ** const _fields; // Array of field types
708
709 public:
710 virtual bool eq( const Type *t ) const;
711 virtual uint hash() const; // Type specific hashing
712 virtual bool singleton(void) const; // TRUE if type is a singleton
713 virtual bool empty(void) const; // TRUE if type is vacuous
714
715 // Accessors:
716 uint cnt() const { return _cnt; }
717 const Type* field_at(uint i) const {
718 assert(i < _cnt, "oob");
719 return _fields[i];
720 }
721 void set_field_at(uint i, const Type* t) {
722 assert(i < _cnt, "oob");
723 _fields[i] = t;
724 }
725
726 static const TypeTuple *make( uint cnt, const Type **fields );
727 static const TypeTuple *make_range(ciSignature *sig, InterfaceHandling interface_handling = ignore_interfaces);
728 static const TypeTuple *make_domain(ciInstanceKlass* recv, ciSignature *sig, InterfaceHandling interface_handling);
729
730 // Subroutine call type with space allocated for argument types
731 // Memory for Control, I_O, Memory, FramePtr, and ReturnAdr is allocated implicitly
732 static const Type **fields( uint arg_cnt );
733
734 virtual const Type *xmeet( const Type *t ) const;
735 virtual const Type *xdual() const; // Compute dual right now.
736 // Convenience common pre-built types.
737 static const TypeTuple *IFBOTH;
738 static const TypeTuple *IFFALSE;
739 static const TypeTuple *IFTRUE;
740 static const TypeTuple *IFNEITHER;
741 static const TypeTuple *LOOPBODY;
742 static const TypeTuple *MEMBAR;
743 static const TypeTuple *STORECONDITIONAL;
744 static const TypeTuple *START_I2C;
745 static const TypeTuple *INT_PAIR;
746 static const TypeTuple *LONG_PAIR;
747 static const TypeTuple *INT_CC_PAIR;
748 static const TypeTuple *LONG_CC_PAIR;
749 #ifndef PRODUCT
750 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
751 #endif
752 };
753
754 //------------------------------TypeAry----------------------------------------
755 // Class of Array Types
756 class TypeAry : public Type {
757 TypeAry(const Type* elem, const TypeInt* size, bool stable) : Type(Array),
758 _elem(elem), _size(size), _stable(stable) {}
759 public:
760 virtual bool eq( const Type *t ) const;
761 virtual uint hash() const; // Type specific hashing
762 virtual bool singleton(void) const; // TRUE if type is a singleton
763 virtual bool empty(void) const; // TRUE if type is vacuous
764
765 private:
766 const Type *_elem; // Element type of array
767 const TypeInt *_size; // Elements in array
768 const bool _stable; // Are elements @Stable?
769 friend class TypeAryPtr;
770
771 public:
772 static const TypeAry* make(const Type* elem, const TypeInt* size, bool stable = false);
773
774 virtual const Type *xmeet( const Type *t ) const;
775 virtual const Type *xdual() const; // Compute dual right now.
776 bool ary_must_be_exact() const; // true if arrays of such are never generic
777 virtual const TypeAry* remove_speculative() const;
778 virtual const Type* cleanup_speculative() const;
779 #ifndef PRODUCT
780 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
781 #endif
782 };
783
784 //------------------------------TypeVect---------------------------------------
785 // Class of Vector Types
786 class TypeVect : public Type {
787 const Type* _elem; // Vector's element type
788 const uint _length; // Elements in vector (power of 2)
789
790 protected:
791 TypeVect(TYPES t, const Type* elem, uint length) : Type(t),
792 _elem(elem), _length(length) {}
913
914 const Type* xmeet(const Type* t) const;
915
916 bool singleton(void) const;
917 };
918
919 //------------------------------TypePtr----------------------------------------
920 // Class of machine Pointer Types: raw data, instances or arrays.
921 // If the _base enum is AnyPtr, then this refers to all of the above.
922 // Otherwise the _base will indicate which subset of pointers is affected,
923 // and the class will be inherited from.
924 class TypePtr : public Type {
925 friend class TypeNarrowPtr;
926 friend class Type;
927 protected:
928 static const TypeInterfaces* interfaces(ciKlass*& k, bool klass, bool interface, bool array, InterfaceHandling interface_handling);
929
930 public:
931 enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR };
932 protected:
933 TypePtr(TYPES t, PTR ptr, int offset,
934 const TypePtr* speculative = nullptr,
935 int inline_depth = InlineDepthBottom) :
936 Type(t), _speculative(speculative), _inline_depth(inline_depth), _offset(offset),
937 _ptr(ptr) {}
938 static const PTR ptr_meet[lastPTR][lastPTR];
939 static const PTR ptr_dual[lastPTR];
940 static const char * const ptr_msg[lastPTR];
941
942 enum {
943 InlineDepthBottom = INT_MAX,
944 InlineDepthTop = -InlineDepthBottom
945 };
946
947 // Extra type information profiling gave us. We propagate it the
948 // same way the rest of the type info is propagated. If we want to
949 // use it, then we have to emit a guard: this part of the type is
950 // not something we know but something we speculate about the type.
951 const TypePtr* _speculative;
952 // For speculative types, we record at what inlining depth the
953 // profiling point that provided the data is. We want to favor
969 // utility methods to work on the inline depth of the type
970 int dual_inline_depth() const;
971 int meet_inline_depth(int depth) const;
972 #ifndef PRODUCT
973 void dump_inline_depth(outputStream *st) const;
974 #endif
975
976 // TypeInstPtr (TypeAryPtr resp.) and TypeInstKlassPtr (TypeAryKlassPtr resp.) implement very similar meet logic.
977 // The logic for meeting 2 instances (2 arrays resp.) is shared in the 2 utility methods below. However the logic for
978 // the oop and klass versions can be slightly different and extra logic may have to be executed depending on what
979 // exact case the meet falls into. The MeetResult struct is used by the utility methods to communicate what case was
980 // encountered so the right logic specific to klasses or oops can be executed.,
981 enum MeetResult {
982 QUICK,
983 UNLOADED,
984 SUBTYPE,
985 NOT_SUBTYPE,
986 LCA
987 };
988 template<class T> static TypePtr::MeetResult meet_instptr(PTR& ptr, const TypeInterfaces*& interfaces, const T* this_type,
989 const T* other_type, ciKlass*& res_klass, bool& res_xk);
990
991 template<class T> static MeetResult meet_aryptr(PTR& ptr, const Type*& elem, const T* this_ary, const T* other_ary,
992 ciKlass*& res_klass, bool& res_xk);
993
994 template <class T1, class T2> static bool is_java_subtype_of_helper_for_instance(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
995 template <class T1, class T2> static bool is_same_java_type_as_helper_for_instance(const T1* this_one, const T2* other);
996 template <class T1, class T2> static bool maybe_java_subtype_of_helper_for_instance(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
997 template <class T1, class T2> static bool is_java_subtype_of_helper_for_array(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
998 template <class T1, class T2> static bool is_same_java_type_as_helper_for_array(const T1* this_one, const T2* other);
999 template <class T1, class T2> static bool maybe_java_subtype_of_helper_for_array(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
1000 template <class T1, class T2> static bool is_meet_subtype_of_helper_for_instance(const T1* this_one, const T2* other, bool this_xk, bool other_xk);
1001 template <class T1, class T2> static bool is_meet_subtype_of_helper_for_array(const T1* this_one, const T2* other, bool this_xk, bool other_xk);
1002 public:
1003 const int _offset; // Offset into oop, with TOP & BOT
1004 const PTR _ptr; // Pointer equivalence class
1005
1006 int offset() const { return _offset; }
1007 PTR ptr() const { return _ptr; }
1008
1009 static const TypePtr *make(TYPES t, PTR ptr, int offset,
1010 const TypePtr* speculative = nullptr,
1011 int inline_depth = InlineDepthBottom);
1012
1013 // Return a 'ptr' version of this type
1014 virtual const TypePtr* cast_to_ptr_type(PTR ptr) const;
1015
1016 virtual intptr_t get_con() const;
1017
1018 int xadd_offset( intptr_t offset ) const;
1019 virtual const TypePtr* add_offset(intptr_t offset) const;
1020 virtual const TypePtr* with_offset(intptr_t offset) const;
1021 virtual bool eq(const Type *t) const;
1022 virtual uint hash() const; // Type specific hashing
1023
1024 virtual bool singleton(void) const; // TRUE if type is a singleton
1025 virtual bool empty(void) const; // TRUE if type is vacuous
1026 virtual const Type *xmeet( const Type *t ) const;
1027 virtual const Type *xmeet_helper( const Type *t ) const;
1028 int meet_offset( int offset ) const;
1029 int dual_offset( ) const;
1030 virtual const Type *xdual() const; // Compute dual right now.
1031
1032 // meet, dual and join over pointer equivalence sets
1033 PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; }
1034 PTR dual_ptr() const { return ptr_dual[ptr()]; }
1035
1036 // This is textually confusing unless one recalls that
1037 // join(t) == dual()->meet(t->dual())->dual().
1038 PTR join_ptr( const PTR in_ptr ) const {
1039 return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ];
1040 }
1041
1042 // Speculative type helper methods.
1043 virtual const TypePtr* speculative() const { return _speculative; }
1044 int inline_depth() const { return _inline_depth; }
1045 virtual ciKlass* speculative_type() const;
1046 virtual ciKlass* speculative_type_not_null() const;
1047 virtual bool speculative_maybe_null() const;
1048 virtual bool speculative_always_null() const;
1049 virtual const TypePtr* remove_speculative() const;
1050 virtual const Type* cleanup_speculative() const;
1051 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1052 virtual bool would_improve_ptr(ProfilePtrKind maybe_null) const;
1053 virtual const TypePtr* with_inline_depth(int depth) const;
1054
1055 virtual bool maybe_null() const { return meet_ptr(Null) == ptr(); }
1056
1057 // Tests for relation to centerline of type lattice:
1058 static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); }
1059 static bool below_centerline(PTR ptr) { return (ptr >= NotNull); }
1060 // Convenience common pre-built types.
1061 static const TypePtr *NULL_PTR;
1062 static const TypePtr *NOTNULL;
1063 static const TypePtr *BOTTOM;
1064 #ifndef PRODUCT
1065 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1066 #endif
1067 };
1068
1069 //------------------------------TypeRawPtr-------------------------------------
1070 // Class of raw pointers, pointers to things other than Oops. Examples
1071 // include the stack pointer, top of heap, card-marking area, handles, etc.
1072 class TypeRawPtr : public TypePtr {
1073 protected:
1074 TypeRawPtr( PTR ptr, address bits ) : TypePtr(RawPtr,ptr,0), _bits(bits){}
1075 public:
1076 virtual bool eq( const Type *t ) const;
1077 virtual uint hash() const; // Type specific hashing
1078
1079 const address _bits; // Constant value, if applicable
1080
1081 static const TypeRawPtr *make( PTR ptr );
1082 static const TypeRawPtr *make( address bits );
1083
1084 // Return a 'ptr' version of this type
1085 virtual const TypeRawPtr* cast_to_ptr_type(PTR ptr) const;
1086
1087 virtual intptr_t get_con() const;
1088
1089 virtual const TypePtr* add_offset(intptr_t offset) const;
1090 virtual const TypeRawPtr* with_offset(intptr_t offset) const { ShouldNotReachHere(); return nullptr;}
1091
1092 virtual const Type *xmeet( const Type *t ) const;
1093 virtual const Type *xdual() const; // Compute dual right now.
1094 // Convenience common pre-built types.
1095 static const TypeRawPtr *BOTTOM;
1096 static const TypeRawPtr *NOTNULL;
1097 #ifndef PRODUCT
1098 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1099 #endif
1100 };
1101
1102 //------------------------------TypeOopPtr-------------------------------------
1103 // Some kind of oop (Java pointer), either instance or array.
1104 class TypeOopPtr : public TypePtr {
1105 friend class TypeAry;
1106 friend class TypePtr;
1107 friend class TypeInstPtr;
1108 friend class TypeAryPtr;
1109 protected:
1110 TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, bool xk, ciObject* o, int offset, int instance_id,
1111 const TypePtr* speculative, int inline_depth);
1112 public:
1113 virtual bool eq( const Type *t ) const;
1114 virtual uint hash() const; // Type specific hashing
1115 virtual bool singleton(void) const; // TRUE if type is a singleton
1116 enum {
1117 InstanceTop = -1, // undefined instance
1118 InstanceBot = 0 // any possible instance
1119 };
1120 protected:
1121
1122 // Oop is null, unless this is a constant oop.
1123 ciObject* _const_oop; // Constant oop
1124 // If _klass is null, then so is _sig. This is an unloaded klass.
1125 ciKlass* _klass; // Klass object
1126
1127 const TypeInterfaces* _interfaces;
1128
1129 // Does the type exclude subclasses of the klass? (Inexact == polymorphic.)
1130 bool _klass_is_exact;
1131 bool _is_ptr_to_narrowoop;
1132 bool _is_ptr_to_narrowklass;
1133 bool _is_ptr_to_boxed_value;
1134
1135 // If not InstanceTop or InstanceBot, indicates that this is
1136 // a particular instance of this type which is distinct.
1137 // This is the node index of the allocation node creating this instance.
1138 int _instance_id;
1139
1140 static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact, InterfaceHandling interface_handling);
1141
1142 int dual_instance_id() const;
1143 int meet_instance_id(int uid) const;
1144
1145 const TypeInterfaces* meet_interfaces(const TypeOopPtr* other) const;
1146
1147 // Do not allow interface-vs.-noninterface joins to collapse to top.
1148 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1149
1150 virtual ciKlass* exact_klass_helper() const { return nullptr; }
1151 virtual ciKlass* klass() const { return _klass; }
1152
1153 public:
1154
1155 bool is_java_subtype_of(const TypeOopPtr* other) const {
1156 return is_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1157 }
1158
1159 bool is_same_java_type_as(const TypePtr* other) const {
1160 return is_same_java_type_as_helper(other->is_oopptr());
1161 }
1162
1163 virtual bool is_same_java_type_as_helper(const TypeOopPtr* other) const {
1164 ShouldNotReachHere(); return false;
1165 }
1166
1167 bool maybe_java_subtype_of(const TypeOopPtr* other) const {
1168 return maybe_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1169 }
1170 virtual bool is_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1171 virtual bool maybe_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1178 return make_from_klass_common(klass, true, false, interface_handling);
1179 }
1180 // Same as before, but will produce an exact type, even if
1181 // the klass is not final, as long as it has exactly one implementation.
1182 static const TypeOopPtr* make_from_klass_unique(ciKlass* klass, InterfaceHandling interface_handling= ignore_interfaces) {
1183 return make_from_klass_common(klass, true, true, interface_handling);
1184 }
1185 // Same as before, but does not respects UseUniqueSubclasses.
1186 // Use this only for creating array element types.
1187 static const TypeOopPtr* make_from_klass_raw(ciKlass* klass, InterfaceHandling interface_handling = ignore_interfaces) {
1188 return make_from_klass_common(klass, false, false, interface_handling);
1189 }
1190 // Creates a singleton type given an object.
1191 // If the object cannot be rendered as a constant,
1192 // may return a non-singleton type.
1193 // If require_constant, produce a null if a singleton is not possible.
1194 static const TypeOopPtr* make_from_constant(ciObject* o,
1195 bool require_constant = false);
1196
1197 // Make a generic (unclassed) pointer to an oop.
1198 static const TypeOopPtr* make(PTR ptr, int offset, int instance_id,
1199 const TypePtr* speculative = nullptr,
1200 int inline_depth = InlineDepthBottom);
1201
1202 ciObject* const_oop() const { return _const_oop; }
1203 // Exact klass, possibly an interface or an array of interface
1204 ciKlass* exact_klass(bool maybe_null = false) const { assert(klass_is_exact(), ""); ciKlass* k = exact_klass_helper(); assert(k != nullptr || maybe_null, ""); return k; }
1205 ciKlass* unloaded_klass() const { assert(!is_loaded(), "only for unloaded types"); return klass(); }
1206
1207 virtual bool is_loaded() const { return klass()->is_loaded(); }
1208 virtual bool klass_is_exact() const { return _klass_is_exact; }
1209
1210 // Returns true if this pointer points at memory which contains a
1211 // compressed oop references.
1212 bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; }
1213 bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; }
1214 bool is_ptr_to_boxed_value() const { return _is_ptr_to_boxed_value; }
1215 bool is_known_instance() const { return _instance_id > 0; }
1216 int instance_id() const { return _instance_id; }
1217 bool is_known_instance_field() const { return is_known_instance() && _offset >= 0; }
1218
1219 virtual intptr_t get_con() const;
1220
1221 virtual const TypeOopPtr* cast_to_ptr_type(PTR ptr) const;
1222
1223 virtual const TypeOopPtr* cast_to_exactness(bool klass_is_exact) const;
1224
1225 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1226
1227 // corresponding pointer to klass, for a given instance
1228 virtual const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1229
1230 virtual const TypeOopPtr* with_offset(intptr_t offset) const;
1231 virtual const TypePtr* add_offset(intptr_t offset) const;
1232
1233 // Speculative type helper methods.
1234 virtual const TypeOopPtr* remove_speculative() const;
1235 virtual const Type* cleanup_speculative() const;
1236 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1237 virtual const TypePtr* with_inline_depth(int depth) const;
1260 return _interfaces;
1261 };
1262
1263 const TypeOopPtr* is_reference_type(const Type* other) const {
1264 return other->isa_oopptr();
1265 }
1266
1267 const TypeAryPtr* is_array_type(const TypeOopPtr* other) const {
1268 return other->isa_aryptr();
1269 }
1270
1271 const TypeInstPtr* is_instance_type(const TypeOopPtr* other) const {
1272 return other->isa_instptr();
1273 }
1274 };
1275
1276 //------------------------------TypeInstPtr------------------------------------
1277 // Class of Java object pointers, pointing either to non-array Java instances
1278 // or to a Klass* (including array klasses).
1279 class TypeInstPtr : public TypeOopPtr {
1280 TypeInstPtr(PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, bool xk, ciObject* o, int off, int instance_id,
1281 const TypePtr* speculative, int inline_depth);
1282 virtual bool eq( const Type *t ) const;
1283 virtual uint hash() const; // Type specific hashing
1284
1285 ciKlass* exact_klass_helper() const;
1286
1287 public:
1288
1289 // Instance klass, ignoring any interface
1290 ciInstanceKlass* instance_klass() const {
1291 assert(!(klass()->is_loaded() && klass()->is_interface()), "");
1292 return klass()->as_instance_klass();
1293 }
1294
1295 bool is_same_java_type_as_helper(const TypeOopPtr* other) const;
1296 bool is_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1297 bool maybe_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1298
1299 // Make a pointer to a constant oop.
1300 static const TypeInstPtr *make(ciObject* o) {
1301 ciKlass* k = o->klass();
1302 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1303 return make(TypePtr::Constant, k, interfaces, true, o, 0, InstanceBot);
1304 }
1305 // Make a pointer to a constant oop with offset.
1306 static const TypeInstPtr *make(ciObject* o, int offset) {
1307 ciKlass* k = o->klass();
1308 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1309 return make(TypePtr::Constant, k, interfaces, true, o, offset, InstanceBot);
1310 }
1311
1312 // Make a pointer to some value of type klass.
1313 static const TypeInstPtr *make(PTR ptr, ciKlass* klass, InterfaceHandling interface_handling = ignore_interfaces) {
1314 const TypeInterfaces* interfaces = TypePtr::interfaces(klass, true, true, false, interface_handling);
1315 return make(ptr, klass, interfaces, false, nullptr, 0, InstanceBot);
1316 }
1317
1318 // Make a pointer to some non-polymorphic value of exactly type klass.
1319 static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) {
1320 const TypeInterfaces* interfaces = TypePtr::interfaces(klass, true, false, false, ignore_interfaces);
1321 return make(ptr, klass, interfaces, true, nullptr, 0, InstanceBot);
1322 }
1323
1324 // Make a pointer to some value of type klass with offset.
1325 static const TypeInstPtr *make(PTR ptr, ciKlass* klass, int offset) {
1326 const TypeInterfaces* interfaces = TypePtr::interfaces(klass, true, false, false, ignore_interfaces);
1327 return make(ptr, klass, interfaces, false, nullptr, offset, InstanceBot);
1328 }
1329
1330 static const TypeInstPtr *make(PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, bool xk, ciObject* o, int offset,
1331 int instance_id = InstanceBot,
1332 const TypePtr* speculative = nullptr,
1333 int inline_depth = InlineDepthBottom);
1334
1335 static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id = InstanceBot) {
1336 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1337 return make(ptr, k, interfaces, xk, o, offset, instance_id);
1338 }
1339
1340 /** Create constant type for a constant boxed value */
1341 const Type* get_const_boxed_value() const;
1342
1343 // If this is a java.lang.Class constant, return the type for it or null.
1344 // Pass to Type::get_const_type to turn it to a type, which will usually
1345 // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
1346 ciType* java_mirror_type() const;
1347
1348 virtual const TypeInstPtr* cast_to_ptr_type(PTR ptr) const;
1349
1350 virtual const TypeInstPtr* cast_to_exactness(bool klass_is_exact) const;
1351
1352 virtual const TypeInstPtr* cast_to_instance_id(int instance_id) const;
1353
1354 virtual const TypePtr* add_offset(intptr_t offset) const;
1355 virtual const TypeInstPtr* with_offset(intptr_t offset) const;
1356
1357 // Speculative type helper methods.
1358 virtual const TypeInstPtr* remove_speculative() const;
1359 virtual const TypePtr* with_inline_depth(int depth) const;
1360 virtual const TypePtr* with_instance_id(int instance_id) const;
1361
1362 // the core of the computation of the meet of 2 types
1363 virtual const Type *xmeet_helper(const Type *t) const;
1364 virtual const TypeInstPtr *xmeet_unloaded(const TypeInstPtr *tinst, const TypeInterfaces* interfaces) const;
1365 virtual const Type *xdual() const; // Compute dual right now.
1366
1367 const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1368
1369 // Convenience common pre-built types.
1370 static const TypeInstPtr *NOTNULL;
1371 static const TypeInstPtr *BOTTOM;
1372 static const TypeInstPtr *MIRROR;
1373 static const TypeInstPtr *MARK;
1374 static const TypeInstPtr *KLASS;
1375 #ifndef PRODUCT
1376 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1377 #endif
1378
1379 private:
1380 virtual bool is_meet_subtype_of_helper(const TypeOopPtr* other, bool this_xk, bool other_xk) const;
1381
1382 virtual bool is_meet_same_type_as(const TypePtr* other) const {
1383 return _klass->equals(other->is_instptr()->_klass) && _interfaces->eq(other->is_instptr()->_interfaces);
1384 }
1385
1386 };
1387
1388 //------------------------------TypeAryPtr-------------------------------------
1389 // Class of Java array pointers
1390 class TypeAryPtr : public TypeOopPtr {
1391 friend class Type;
1392 friend class TypePtr;
1393
1394 TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk,
1395 int offset, int instance_id, bool is_autobox_cache,
1396 const TypePtr* speculative, int inline_depth)
1397 : TypeOopPtr(AryPtr,ptr,k,_array_interfaces,xk,o,offset, instance_id, speculative, inline_depth),
1398 _ary(ary),
1399 _is_autobox_cache(is_autobox_cache)
1400 {
1401 int dummy;
1402 bool top_or_bottom = (base_element_type(dummy) == Type::TOP || base_element_type(dummy) == Type::BOTTOM);
1403
1404 if (UseCompressedOops && (elem()->make_oopptr() != nullptr && !top_or_bottom) &&
1405 _offset != 0 && _offset != arrayOopDesc::length_offset_in_bytes() &&
1406 _offset != arrayOopDesc::klass_offset_in_bytes()) {
1407 _is_ptr_to_narrowoop = true;
1408 }
1409
1410 }
1411 virtual bool eq( const Type *t ) const;
1412 virtual uint hash() const; // Type specific hashing
1413 const TypeAry *_ary; // Array we point into
1414 const bool _is_autobox_cache;
1415
1416 ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const;
1417
1418 // A pointer to delay allocation to Type::Initialize_shared()
1419
1420 static const TypeInterfaces* _array_interfaces;
1421 ciKlass* exact_klass_helper() const;
1422 // Only guaranteed non null for array of basic types
1423 ciKlass* klass() const;
1424
1425 public:
1426
1427 bool is_same_java_type_as_helper(const TypeOopPtr* other) const;
1428 bool is_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1429 bool maybe_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1430
1431 // returns base element type, an instance klass (and not interface) for object arrays
1432 const Type* base_element_type(int& dims) const;
1433
1434 // Accessors
1435 bool is_loaded() const { return (_ary->_elem->make_oopptr() ? _ary->_elem->make_oopptr()->is_loaded() : true); }
1436
1437 const TypeAry* ary() const { return _ary; }
1438 const Type* elem() const { return _ary->_elem; }
1439 const TypeInt* size() const { return _ary->_size; }
1440 bool is_stable() const { return _ary->_stable; }
1441
1442 bool is_autobox_cache() const { return _is_autobox_cache; }
1443
1444 static const TypeAryPtr *make(PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset,
1445 int instance_id = InstanceBot,
1446 const TypePtr* speculative = nullptr,
1447 int inline_depth = InlineDepthBottom);
1448 // Constant pointer to array
1449 static const TypeAryPtr *make(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset,
1450 int instance_id = InstanceBot,
1451 const TypePtr* speculative = nullptr,
1452 int inline_depth = InlineDepthBottom, bool is_autobox_cache = false);
1453
1454 // Return a 'ptr' version of this type
1455 virtual const TypeAryPtr* cast_to_ptr_type(PTR ptr) const;
1456
1457 virtual const TypeAryPtr* cast_to_exactness(bool klass_is_exact) const;
1458
1459 virtual const TypeAryPtr* cast_to_instance_id(int instance_id) const;
1460
1461 virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
1462 virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
1463
1464 virtual bool empty(void) const; // TRUE if type is vacuous
1465 virtual const TypePtr *add_offset( intptr_t offset ) const;
1466 virtual const TypeAryPtr *with_offset( intptr_t offset ) const;
1467 const TypeAryPtr* with_ary(const TypeAry* ary) const;
1468
1469 // Speculative type helper methods.
1470 virtual const TypeAryPtr* remove_speculative() const;
1471 virtual const TypePtr* with_inline_depth(int depth) const;
1472 virtual const TypePtr* with_instance_id(int instance_id) const;
1473
1474 // the core of the computation of the meet of 2 types
1475 virtual const Type *xmeet_helper(const Type *t) const;
1476 virtual const Type *xdual() const; // Compute dual right now.
1477
1478 const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
1479 int stable_dimension() const;
1480
1481 const TypeAryPtr* cast_to_autobox_cache() const;
1482
1483 static jint max_array_length(BasicType etype) ;
1484 virtual const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1485
1486 // Convenience common pre-built types.
1487 static const TypeAryPtr *RANGE;
1488 static const TypeAryPtr *OOPS;
1489 static const TypeAryPtr *NARROWOOPS;
1490 static const TypeAryPtr *BYTES;
1491 static const TypeAryPtr *SHORTS;
1492 static const TypeAryPtr *CHARS;
1493 static const TypeAryPtr *INTS;
1494 static const TypeAryPtr *LONGS;
1495 static const TypeAryPtr *FLOATS;
1496 static const TypeAryPtr *DOUBLES;
1497 // selects one of the above:
1498 static const TypeAryPtr *get_array_body_type(BasicType elem) {
1499 assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != nullptr, "bad elem type");
1500 return _array_body_type[elem];
1501 }
1502 static const TypeAryPtr *_array_body_type[T_CONFLICT+1];
1503 // sharpen the type of an int which is used as an array size
1504 #ifndef PRODUCT
1505 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1506 #endif
1507 private:
1508 virtual bool is_meet_subtype_of_helper(const TypeOopPtr* other, bool this_xk, bool other_xk) const;
1509 };
1510
1511 //------------------------------TypeMetadataPtr-------------------------------------
1512 // Some kind of metadata, either Method*, MethodData* or CPCacheOop
1513 class TypeMetadataPtr : public TypePtr {
1514 protected:
1515 TypeMetadataPtr(PTR ptr, ciMetadata* metadata, int offset);
1516 // Do not allow interface-vs.-noninterface joins to collapse to top.
1517 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1518 public:
1519 virtual bool eq( const Type *t ) const;
1520 virtual uint hash() const; // Type specific hashing
1521 virtual bool singleton(void) const; // TRUE if type is a singleton
1522
1523 private:
1524 ciMetadata* _metadata;
1525
1526 public:
1527 static const TypeMetadataPtr* make(PTR ptr, ciMetadata* m, int offset);
1528
1529 static const TypeMetadataPtr* make(ciMethod* m);
1530 static const TypeMetadataPtr* make(ciMethodData* m);
1531
1532 ciMetadata* metadata() const { return _metadata; }
1533
1534 virtual const TypeMetadataPtr* cast_to_ptr_type(PTR ptr) const;
1535
1536 virtual const TypePtr *add_offset( intptr_t offset ) const;
1537
1538 virtual const Type *xmeet( const Type *t ) const;
1539 virtual const Type *xdual() const; // Compute dual right now.
1540
1541 virtual intptr_t get_con() const;
1542
1543 // Convenience common pre-built types.
1544 static const TypeMetadataPtr *BOTTOM;
1545
1546 #ifndef PRODUCT
1547 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1548 #endif
1549 };
1550
1551 //------------------------------TypeKlassPtr-----------------------------------
1552 // Class of Java Klass pointers
1553 class TypeKlassPtr : public TypePtr {
1554 friend class TypeInstKlassPtr;
1555 friend class TypeAryKlassPtr;
1556 friend class TypePtr;
1557 protected:
1558 TypeKlassPtr(TYPES t, PTR ptr, ciKlass* klass, const TypeInterfaces* interfaces, int offset);
1559
1560 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1561
1562 public:
1563 virtual bool eq( const Type *t ) const;
1564 virtual uint hash() const;
1565 virtual bool singleton(void) const; // TRUE if type is a singleton
1566
1567 protected:
1568
1569 ciKlass* _klass;
1570 const TypeInterfaces* _interfaces;
1571 const TypeInterfaces* meet_interfaces(const TypeKlassPtr* other) const;
1572 virtual bool must_be_exact() const { ShouldNotReachHere(); return false; }
1573 virtual ciKlass* exact_klass_helper() const;
1574 virtual ciKlass* klass() const { return _klass; }
1575
1576 public:
1577
1578 bool is_java_subtype_of(const TypeKlassPtr* other) const {
1579 return is_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1580 }
1581 bool is_same_java_type_as(const TypePtr* other) const {
1582 return is_same_java_type_as_helper(other->is_klassptr());
1583 }
1584
1585 bool maybe_java_subtype_of(const TypeKlassPtr* other) const {
1586 return maybe_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1587 }
1588 virtual bool is_same_java_type_as_helper(const TypeKlassPtr* other) const { ShouldNotReachHere(); return false; }
1589 virtual bool is_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1590 virtual bool maybe_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1591
1592 // Exact klass, possibly an interface or an array of interface
1593 ciKlass* exact_klass(bool maybe_null = false) const { assert(klass_is_exact(), ""); ciKlass* k = exact_klass_helper(); assert(k != nullptr || maybe_null, ""); return k; }
1594 virtual bool klass_is_exact() const { return _ptr == Constant; }
1595
1596 static const TypeKlassPtr* make(ciKlass* klass, InterfaceHandling interface_handling = ignore_interfaces);
1597 static const TypeKlassPtr *make(PTR ptr, ciKlass* klass, int offset, InterfaceHandling interface_handling = ignore_interfaces);
1598
1599 virtual bool is_loaded() const { return _klass->is_loaded(); }
1600
1601 virtual const TypeKlassPtr* cast_to_ptr_type(PTR ptr) const { ShouldNotReachHere(); return nullptr; }
1602
1603 virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const { ShouldNotReachHere(); return nullptr; }
1604
1605 // corresponding pointer to instance, for a given class
1606 virtual const TypeOopPtr* as_instance_type(bool klass_change = true) const { ShouldNotReachHere(); return nullptr; }
1607
1608 virtual const TypePtr *add_offset( intptr_t offset ) const { ShouldNotReachHere(); return nullptr; }
1609 virtual const Type *xmeet( const Type *t ) const { ShouldNotReachHere(); return nullptr; }
1610 virtual const Type *xdual() const { ShouldNotReachHere(); return nullptr; }
1611
1612 virtual intptr_t get_con() const;
1613
1614 virtual const TypeKlassPtr* with_offset(intptr_t offset) const { ShouldNotReachHere(); return nullptr; }
1615
1616 virtual const TypeKlassPtr* try_improve() const { return this; }
1617
1618 #ifndef PRODUCT
1619 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1620 #endif
1621 private:
1622 virtual bool is_meet_subtype_of(const TypePtr* other) const {
1623 return is_meet_subtype_of_helper(other->is_klassptr(), klass_is_exact(), other->is_klassptr()->klass_is_exact());
1624 }
1625
1626 virtual bool is_meet_subtype_of_helper(const TypeKlassPtr* other, bool this_xk, bool other_xk) const {
1627 ShouldNotReachHere(); return false;
1628 }
1629
1630 virtual const TypeInterfaces* interfaces() const {
1631 return _interfaces;
1632 };
1633
1634 const TypeKlassPtr* is_reference_type(const Type* other) const {
1635 return other->isa_klassptr();
1636 }
1637
1638 const TypeAryKlassPtr* is_array_type(const TypeKlassPtr* other) const {
1639 return other->isa_aryklassptr();
1640 }
1641
1642 const TypeInstKlassPtr* is_instance_type(const TypeKlassPtr* other) const {
1643 return other->isa_instklassptr();
1644 }
1645 };
1646
1647 // Instance klass pointer, mirrors TypeInstPtr
1648 class TypeInstKlassPtr : public TypeKlassPtr {
1649
1650 TypeInstKlassPtr(PTR ptr, ciKlass* klass, const TypeInterfaces* interfaces, int offset)
1651 : TypeKlassPtr(InstKlassPtr, ptr, klass, interfaces, offset) {
1652 assert(klass->is_instance_klass() && (!klass->is_loaded() || !klass->is_interface()), "");
1653 }
1654
1655 virtual bool must_be_exact() const;
1656
1657 public:
1658 // Instance klass ignoring any interface
1659 ciInstanceKlass* instance_klass() const {
1660 assert(!klass()->is_interface(), "");
1661 return klass()->as_instance_klass();
1662 }
1663
1664 bool is_same_java_type_as_helper(const TypeKlassPtr* other) const;
1665 bool is_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1666 bool maybe_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1667
1668 static const TypeInstKlassPtr *make(ciKlass* k, InterfaceHandling interface_handling) {
1669 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, true, false, interface_handling);
1670 return make(TypePtr::Constant, k, interfaces, 0);
1671 }
1672 static const TypeInstKlassPtr* make(PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, int offset);
1673
1674 static const TypeInstKlassPtr* make(PTR ptr, ciKlass* k, int offset) {
1675 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1676 return make(ptr, k, interfaces, offset);
1677 }
1678
1679 virtual const TypeInstKlassPtr* cast_to_ptr_type(PTR ptr) const;
1680
1681 virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const;
1682
1683 // corresponding pointer to instance, for a given class
1684 virtual const TypeOopPtr* as_instance_type(bool klass_change = true) const;
1685 virtual uint hash() const;
1686 virtual bool eq(const Type *t) const;
1687
1688 virtual const TypePtr *add_offset( intptr_t offset ) const;
1689 virtual const Type *xmeet( const Type *t ) const;
1690 virtual const Type *xdual() const;
1691 virtual const TypeInstKlassPtr* with_offset(intptr_t offset) const;
1692
1693 virtual const TypeKlassPtr* try_improve() const;
1694
1695 // Convenience common pre-built types.
1696 static const TypeInstKlassPtr* OBJECT; // Not-null object klass or below
1697 static const TypeInstKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
1698 private:
1699 virtual bool is_meet_subtype_of_helper(const TypeKlassPtr* other, bool this_xk, bool other_xk) const;
1700 };
1701
1702 // Array klass pointer, mirrors TypeAryPtr
1703 class TypeAryKlassPtr : public TypeKlassPtr {
1704 friend class TypeInstKlassPtr;
1705 friend class Type;
1706 friend class TypePtr;
1707
1708 const Type *_elem;
1709
1710 static const TypeInterfaces* _array_interfaces;
1711 TypeAryKlassPtr(PTR ptr, const Type *elem, ciKlass* klass, int offset)
1712 : TypeKlassPtr(AryKlassPtr, ptr, klass, _array_interfaces, offset), _elem(elem) {
1713 assert(klass == nullptr || klass->is_type_array_klass() || !klass->as_obj_array_klass()->base_element_klass()->is_interface(), "");
1714 }
1715
1716 virtual ciKlass* exact_klass_helper() const;
1717 // Only guaranteed non null for array of basic types
1718 virtual ciKlass* klass() const;
1719
1720 virtual bool must_be_exact() const;
1721
1722 public:
1723
1724 // returns base element type, an instance klass (and not interface) for object arrays
1725 const Type* base_element_type(int& dims) const;
1726
1727 static const TypeAryKlassPtr *make(PTR ptr, ciKlass* k, int offset, InterfaceHandling interface_handling);
1728
1729 bool is_same_java_type_as_helper(const TypeKlassPtr* other) const;
1730 bool is_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1731 bool maybe_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1732
1733 bool is_loaded() const { return (_elem->isa_klassptr() ? _elem->is_klassptr()->is_loaded() : true); }
1734
1735 static const TypeAryKlassPtr *make(PTR ptr, const Type *elem, ciKlass* k, int offset);
1736 static const TypeAryKlassPtr* make(ciKlass* klass, InterfaceHandling interface_handling);
1737
1738 const Type *elem() const { return _elem; }
1739
1740 virtual bool eq(const Type *t) const;
1741 virtual uint hash() const; // Type specific hashing
1742
1743 virtual const TypeAryKlassPtr* cast_to_ptr_type(PTR ptr) const;
1744
1745 virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const;
1746
1747 // corresponding pointer to instance, for a given class
1748 virtual const TypeOopPtr* as_instance_type(bool klass_change = true) const;
1749
1750 virtual const TypePtr *add_offset( intptr_t offset ) const;
1751 virtual const Type *xmeet( const Type *t ) const;
1752 virtual const Type *xdual() const; // Compute dual right now.
1753
1754 virtual const TypeAryKlassPtr* with_offset(intptr_t offset) const;
1755
1756 virtual bool empty(void) const {
1757 return TypeKlassPtr::empty() || _elem->empty();
1758 }
1759
1760 #ifndef PRODUCT
1761 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1762 #endif
1763 private:
1764 virtual bool is_meet_subtype_of_helper(const TypeKlassPtr* other, bool this_xk, bool other_xk) const;
1765 };
1766
1767 class TypeNarrowPtr : public Type {
1768 protected:
1769 const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR
1770
1771 TypeNarrowPtr(TYPES t, const TypePtr* ptrtype): Type(t),
1772 _ptrtype(ptrtype) {
1773 assert(ptrtype->offset() == 0 ||
1774 ptrtype->offset() == OffsetBot ||
1775 ptrtype->offset() == OffsetTop, "no real offsets");
1776 }
1777
1778 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const = 0;
1779 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0;
1875 }
1876
1877 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const {
1878 return (const TypeNarrowPtr*)((new TypeNarrowKlass(t))->hashcons());
1879 }
1880
1881 public:
1882 static const TypeNarrowKlass *make( const TypePtr* type);
1883
1884 // static const TypeNarrowKlass *BOTTOM;
1885 static const TypeNarrowKlass *NULL_PTR;
1886
1887 #ifndef PRODUCT
1888 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1889 #endif
1890 };
1891
1892 //------------------------------TypeFunc---------------------------------------
1893 // Class of Array Types
1894 class TypeFunc : public Type {
1895 TypeFunc( const TypeTuple *domain, const TypeTuple *range ) : Type(Function), _domain(domain), _range(range) {}
1896 virtual bool eq( const Type *t ) const;
1897 virtual uint hash() const; // Type specific hashing
1898 virtual bool singleton(void) const; // TRUE if type is a singleton
1899 virtual bool empty(void) const; // TRUE if type is vacuous
1900
1901 const TypeTuple* const _domain; // Domain of inputs
1902 const TypeTuple* const _range; // Range of results
1903
1904 public:
1905 // Constants are shared among ADLC and VM
1906 enum { Control = AdlcVMDeps::Control,
1907 I_O = AdlcVMDeps::I_O,
1908 Memory = AdlcVMDeps::Memory,
1909 FramePtr = AdlcVMDeps::FramePtr,
1910 ReturnAdr = AdlcVMDeps::ReturnAdr,
1911 Parms = AdlcVMDeps::Parms
1912 };
1913
1914
1915 // Accessors:
1916 const TypeTuple* domain() const { return _domain; }
1917 const TypeTuple* range() const { return _range; }
1918
1919 static const TypeFunc *make(ciMethod* method);
1920 static const TypeFunc *make(ciSignature signature, const Type* extra);
1921 static const TypeFunc *make(const TypeTuple* domain, const TypeTuple* range);
1922
1923 virtual const Type *xmeet( const Type *t ) const;
1924 virtual const Type *xdual() const; // Compute dual right now.
1925
1926 BasicType return_type() const;
1927
1928 #ifndef PRODUCT
1929 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1930 #endif
1931 // Convenience common pre-built types.
1932 };
1933
1934 //------------------------------accessors--------------------------------------
1935 inline bool Type::is_ptr_to_narrowoop() const {
1936 #ifdef _LP64
1937 return (isa_oopptr() != nullptr && is_oopptr()->is_ptr_to_narrowoop_nv());
1938 #else
1939 return false;
1940 #endif
1941 }
1942
1943 inline bool Type::is_ptr_to_narrowklass() const {
1944 #ifdef _LP64
1945 return (isa_oopptr() != nullptr && is_oopptr()->is_ptr_to_narrowklass_nv());
1946 #else
1947 return false;
2163 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->isa_oopptr() : isa_oopptr();
2164 }
2165
2166 inline const TypeNarrowOop* Type::make_narrowoop() const {
2167 return (_base == NarrowOop) ? is_narrowoop() :
2168 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : nullptr);
2169 }
2170
2171 inline const TypeNarrowKlass* Type::make_narrowklass() const {
2172 return (_base == NarrowKlass) ? is_narrowklass() :
2173 (isa_ptr() ? TypeNarrowKlass::make(is_ptr()) : nullptr);
2174 }
2175
2176 inline bool Type::is_floatingpoint() const {
2177 if( (_base == FloatCon) || (_base == FloatBot) ||
2178 (_base == DoubleCon) || (_base == DoubleBot) )
2179 return true;
2180 return false;
2181 }
2182
2183
2184 // ===============================================================
2185 // Things that need to be 64-bits in the 64-bit build but
2186 // 32-bits in the 32-bit build. Done this way to get full
2187 // optimization AND strong typing.
2188 #ifdef _LP64
2189
2190 // For type queries and asserts
2191 #define is_intptr_t is_long
2192 #define isa_intptr_t isa_long
2193 #define find_intptr_t_type find_long_type
2194 #define find_intptr_t_con find_long_con
2195 #define TypeX TypeLong
2196 #define Type_X Type::Long
2197 #define TypeX_X TypeLong::LONG
2198 #define TypeX_ZERO TypeLong::ZERO
2199 // For 'ideal_reg' machine registers
2200 #define Op_RegX Op_RegL
2201 // For phase->intcon variants
2202 #define MakeConX longcon
2203 #define ConXNode ConLNode
2204 // For array index arithmetic
2205 #define MulXNode MulLNode
2206 #define AndXNode AndLNode
2207 #define OrXNode OrLNode
2208 #define CmpXNode CmpLNode
2209 #define SubXNode SubLNode
2210 #define LShiftXNode LShiftLNode
2211 // For object size computation:
2212 #define AddXNode AddLNode
2213 #define RShiftXNode RShiftLNode
2214 // For card marks and hashcodes
2215 #define URShiftXNode URShiftLNode
2216 // For shenandoahSupport
2217 #define LoadXNode LoadLNode
2218 #define StoreXNode StoreLNode
2219 // Opcodes
2220 #define Op_LShiftX Op_LShiftL
2221 #define Op_AndX Op_AndL
2222 #define Op_AddX Op_AddL
2223 #define Op_SubX Op_SubL
2224 #define Op_XorX Op_XorL
2225 #define Op_URShiftX Op_URShiftL
2226 #define Op_LoadX Op_LoadL
2227 // conversions
2228 #define ConvI2X(x) ConvI2L(x)
2229 #define ConvL2X(x) (x)
2230 #define ConvX2I(x) ConvL2I(x)
2231 #define ConvX2L(x) (x)
2232 #define ConvX2UL(x) (x)
2233
2234 #else
2235
2236 // For type queries and asserts
2237 #define is_intptr_t is_int
2238 #define isa_intptr_t isa_int
2239 #define find_intptr_t_type find_int_type
2240 #define find_intptr_t_con find_int_con
2241 #define TypeX TypeInt
2242 #define Type_X Type::Int
2243 #define TypeX_X TypeInt::INT
2244 #define TypeX_ZERO TypeInt::ZERO
2245 // For 'ideal_reg' machine registers
2246 #define Op_RegX Op_RegI
2247 // For phase->intcon variants
2248 #define MakeConX intcon
2249 #define ConXNode ConINode
2250 // For array index arithmetic
2251 #define MulXNode MulINode
2252 #define AndXNode AndINode
2253 #define OrXNode OrINode
2254 #define CmpXNode CmpINode
2255 #define SubXNode SubINode
2256 #define LShiftXNode LShiftINode
2257 // For object size computation:
2258 #define AddXNode AddINode
2259 #define RShiftXNode RShiftINode
2260 // For card marks and hashcodes
2261 #define URShiftXNode URShiftINode
2262 // For shenandoahSupport
2263 #define LoadXNode LoadINode
2264 #define StoreXNode StoreINode
2265 // Opcodes
2266 #define Op_LShiftX Op_LShiftI
2267 #define Op_AndX Op_AndI
2268 #define Op_AddX Op_AddI
2269 #define Op_SubX Op_SubI
2270 #define Op_XorX Op_XorI
2271 #define Op_URShiftX Op_URShiftI
2272 #define Op_LoadX Op_LoadI
2273 // conversions
2274 #define ConvI2X(x) (x)
2275 #define ConvL2X(x) ConvL2I(x)
2276 #define ConvX2I(x) (x)
2277 #define ConvX2L(x) ConvI2L(x)
2278 #define ConvX2UL(x) ConvI2UL(x)
2279
2280 #endif
2281
2282 #endif // SHARE_OPTO_TYPE_HPP
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_OPTO_TYPE_HPP
26 #define SHARE_OPTO_TYPE_HPP
27
28 #include "ci/ciInlineKlass.hpp"
29 #include "opto/adlcVMDeps.hpp"
30 #include "runtime/handles.hpp"
31 #include "runtime/sharedRuntime.hpp"
32
33 // Portions of code courtesy of Clifford Click
34
35 // Optimization - Graph Style
36
37
38 // This class defines a Type lattice. The lattice is used in the constant
39 // propagation algorithms, and for some type-checking of the iloc code.
40 // Basic types include RSD's (lower bound, upper bound, stride for integers),
41 // float & double precision constants, sets of data-labels and code-labels.
42 // The complete lattice is described below. Subtypes have no relationship to
43 // up or down in the lattice; that is entirely determined by the behavior of
44 // the MEET/JOIN functions.
45
46 class Dict;
47 class Type;
48 class TypeD;
49 class TypeF;
50 class TypeInteger;
51 class TypeInt;
121 Function, // Function signature
122 Abio, // Abstract I/O
123 Return_Address, // Subroutine return address
124 Memory, // Abstract store
125 FloatTop, // No float value
126 FloatCon, // Floating point constant
127 FloatBot, // Any float value
128 DoubleTop, // No double value
129 DoubleCon, // Double precision constant
130 DoubleBot, // Any double value
131 Bottom, // Bottom of lattice
132 lastype // Bogus ending type (not in lattice)
133 };
134
135 // Signal values for offsets from a base pointer
136 enum OFFSET_SIGNALS {
137 OffsetTop = -2000000000, // undefined offset
138 OffsetBot = -2000000001 // any possible offset
139 };
140
141 class Offset {
142 private:
143 int _offset;
144
145 public:
146 explicit Offset(int offset) : _offset(offset) {}
147
148 const Offset meet(const Offset other) const;
149 const Offset dual() const;
150 const Offset add(intptr_t offset) const;
151 bool operator==(const Offset& other) const {
152 return _offset == other._offset;
153 }
154 bool operator!=(const Offset& other) const {
155 return _offset != other._offset;
156 }
157 int get() const { return _offset; }
158
159 void dump2(outputStream *st) const;
160
161 static const Offset top;
162 static const Offset bottom;
163 };
164
165 // Min and max WIDEN values.
166 enum WIDEN {
167 WidenMin = 0,
168 WidenMax = 3
169 };
170
171 private:
172 typedef struct {
173 TYPES dual_type;
174 BasicType basic_type;
175 const char* msg;
176 bool isa_oop;
177 uint ideal_reg;
178 relocInfo::relocType reloc;
179 } TypeInfo;
180
181 // Dictionary of types shared among compilations.
182 static Dict* _shared_type_dict;
183 static const TypeInfo _type_info[];
184
335 const TypeNarrowKlass *isa_narrowklass() const;// Returns null if not oop ptr type
336 const TypeOopPtr *isa_oopptr() const; // Returns null if not oop ptr type
337 const TypeOopPtr *is_oopptr() const; // Java-style GC'd pointer
338 const TypeInstPtr *isa_instptr() const; // Returns null if not InstPtr
339 const TypeInstPtr *is_instptr() const; // Instance
340 const TypeAryPtr *isa_aryptr() const; // Returns null if not AryPtr
341 const TypeAryPtr *is_aryptr() const; // Array oop
342
343 const TypeMetadataPtr *isa_metadataptr() const; // Returns null if not oop ptr type
344 const TypeMetadataPtr *is_metadataptr() const; // Java-style GC'd pointer
345 const TypeKlassPtr *isa_klassptr() const; // Returns null if not KlassPtr
346 const TypeKlassPtr *is_klassptr() const; // assert if not KlassPtr
347 const TypeInstKlassPtr *isa_instklassptr() const; // Returns null if not IntKlassPtr
348 const TypeInstKlassPtr *is_instklassptr() const; // assert if not IntKlassPtr
349 const TypeAryKlassPtr *isa_aryklassptr() const; // Returns null if not AryKlassPtr
350 const TypeAryKlassPtr *is_aryklassptr() const; // assert if not AryKlassPtr
351
352 virtual bool is_finite() const; // Has a finite value
353 virtual bool is_nan() const; // Is not a number (NaN)
354
355 bool is_inlinetypeptr() const;
356 virtual ciInlineKlass* inline_klass() const;
357
358 // Returns this ptr type or the equivalent ptr type for this compressed pointer.
359 const TypePtr* make_ptr() const;
360
361 // Returns this oopptr type or the equivalent oopptr type for this compressed pointer.
362 // Asserts if the underlying type is not an oopptr or narrowoop.
363 const TypeOopPtr* make_oopptr() const;
364
365 // Returns this compressed pointer or the equivalent compressed version
366 // of this pointer type.
367 const TypeNarrowOop* make_narrowoop() const;
368
369 // Returns this compressed klass pointer or the equivalent
370 // compressed version of this pointer type.
371 const TypeNarrowKlass* make_narrowklass() const;
372
373 // Special test for register pressure heuristic
374 bool is_floatingpoint() const; // True if Float or Double base type
375
376 // Do you have memory, directly or through a tuple?
377 bool has_memory( ) const;
736 const Type ** const _fields; // Array of field types
737
738 public:
739 virtual bool eq( const Type *t ) const;
740 virtual uint hash() const; // Type specific hashing
741 virtual bool singleton(void) const; // TRUE if type is a singleton
742 virtual bool empty(void) const; // TRUE if type is vacuous
743
744 // Accessors:
745 uint cnt() const { return _cnt; }
746 const Type* field_at(uint i) const {
747 assert(i < _cnt, "oob");
748 return _fields[i];
749 }
750 void set_field_at(uint i, const Type* t) {
751 assert(i < _cnt, "oob");
752 _fields[i] = t;
753 }
754
755 static const TypeTuple *make( uint cnt, const Type **fields );
756 static const TypeTuple *make_range(ciSignature* sig, InterfaceHandling interface_handling = ignore_interfaces, bool ret_vt_fields = false);
757 static const TypeTuple *make_domain(ciMethod* method, InterfaceHandling interface_handling, bool vt_fields_as_args = false);
758
759 // Subroutine call type with space allocated for argument types
760 // Memory for Control, I_O, Memory, FramePtr, and ReturnAdr is allocated implicitly
761 static const Type **fields( uint arg_cnt );
762
763 virtual const Type *xmeet( const Type *t ) const;
764 virtual const Type *xdual() const; // Compute dual right now.
765 // Convenience common pre-built types.
766 static const TypeTuple *IFBOTH;
767 static const TypeTuple *IFFALSE;
768 static const TypeTuple *IFTRUE;
769 static const TypeTuple *IFNEITHER;
770 static const TypeTuple *LOOPBODY;
771 static const TypeTuple *MEMBAR;
772 static const TypeTuple *STORECONDITIONAL;
773 static const TypeTuple *START_I2C;
774 static const TypeTuple *INT_PAIR;
775 static const TypeTuple *LONG_PAIR;
776 static const TypeTuple *INT_CC_PAIR;
777 static const TypeTuple *LONG_CC_PAIR;
778 #ifndef PRODUCT
779 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
780 #endif
781 };
782
783 //------------------------------TypeAry----------------------------------------
784 // Class of Array Types
785 class TypeAry : public Type {
786 TypeAry(const Type* elem, const TypeInt* size, bool stable, bool flat, bool not_flat, bool not_null_free) : Type(Array),
787 _elem(elem), _size(size), _stable(stable), _flat(flat), _not_flat(not_flat), _not_null_free(not_null_free) {}
788 public:
789 virtual bool eq( const Type *t ) const;
790 virtual uint hash() const; // Type specific hashing
791 virtual bool singleton(void) const; // TRUE if type is a singleton
792 virtual bool empty(void) const; // TRUE if type is vacuous
793
794 private:
795 const Type *_elem; // Element type of array
796 const TypeInt *_size; // Elements in array
797 const bool _stable; // Are elements @Stable?
798
799 // Inline type array properties
800 const bool _flat; // Array is flat
801 const bool _not_flat; // Array is never flat
802 const bool _not_null_free; // Array is never null-free
803
804 friend class TypeAryPtr;
805
806 public:
807 static const TypeAry* make(const Type* elem, const TypeInt* size, bool stable = false,
808 bool flat = false, bool not_flat = false, bool not_null_free = false);
809
810 virtual const Type *xmeet( const Type *t ) const;
811 virtual const Type *xdual() const; // Compute dual right now.
812 bool ary_must_be_exact() const; // true if arrays of such are never generic
813 virtual const TypeAry* remove_speculative() const;
814 virtual const Type* cleanup_speculative() const;
815 #ifndef PRODUCT
816 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
817 #endif
818 };
819
820 //------------------------------TypeVect---------------------------------------
821 // Class of Vector Types
822 class TypeVect : public Type {
823 const Type* _elem; // Vector's element type
824 const uint _length; // Elements in vector (power of 2)
825
826 protected:
827 TypeVect(TYPES t, const Type* elem, uint length) : Type(t),
828 _elem(elem), _length(length) {}
949
950 const Type* xmeet(const Type* t) const;
951
952 bool singleton(void) const;
953 };
954
955 //------------------------------TypePtr----------------------------------------
956 // Class of machine Pointer Types: raw data, instances or arrays.
957 // If the _base enum is AnyPtr, then this refers to all of the above.
958 // Otherwise the _base will indicate which subset of pointers is affected,
959 // and the class will be inherited from.
960 class TypePtr : public Type {
961 friend class TypeNarrowPtr;
962 friend class Type;
963 protected:
964 static const TypeInterfaces* interfaces(ciKlass*& k, bool klass, bool interface, bool array, InterfaceHandling interface_handling);
965
966 public:
967 enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR };
968 protected:
969 TypePtr(TYPES t, PTR ptr, Offset offset,
970 const TypePtr* speculative = nullptr,
971 int inline_depth = InlineDepthBottom) :
972 Type(t), _speculative(speculative), _inline_depth(inline_depth), _offset(offset),
973 _ptr(ptr) {}
974 static const PTR ptr_meet[lastPTR][lastPTR];
975 static const PTR ptr_dual[lastPTR];
976 static const char * const ptr_msg[lastPTR];
977
978 enum {
979 InlineDepthBottom = INT_MAX,
980 InlineDepthTop = -InlineDepthBottom
981 };
982
983 // Extra type information profiling gave us. We propagate it the
984 // same way the rest of the type info is propagated. If we want to
985 // use it, then we have to emit a guard: this part of the type is
986 // not something we know but something we speculate about the type.
987 const TypePtr* _speculative;
988 // For speculative types, we record at what inlining depth the
989 // profiling point that provided the data is. We want to favor
1005 // utility methods to work on the inline depth of the type
1006 int dual_inline_depth() const;
1007 int meet_inline_depth(int depth) const;
1008 #ifndef PRODUCT
1009 void dump_inline_depth(outputStream *st) const;
1010 #endif
1011
1012 // TypeInstPtr (TypeAryPtr resp.) and TypeInstKlassPtr (TypeAryKlassPtr resp.) implement very similar meet logic.
1013 // The logic for meeting 2 instances (2 arrays resp.) is shared in the 2 utility methods below. However the logic for
1014 // the oop and klass versions can be slightly different and extra logic may have to be executed depending on what
1015 // exact case the meet falls into. The MeetResult struct is used by the utility methods to communicate what case was
1016 // encountered so the right logic specific to klasses or oops can be executed.,
1017 enum MeetResult {
1018 QUICK,
1019 UNLOADED,
1020 SUBTYPE,
1021 NOT_SUBTYPE,
1022 LCA
1023 };
1024 template<class T> static TypePtr::MeetResult meet_instptr(PTR& ptr, const TypeInterfaces*& interfaces, const T* this_type,
1025 const T* other_type, ciKlass*& res_klass, bool& res_xk, bool& res_flat_array);
1026
1027 template<class T> static MeetResult meet_aryptr(PTR& ptr, const Type*& elem, const T* this_ary, const T* other_ary,
1028 ciKlass*& res_klass, bool& res_xk, bool &res_flat, bool &res_not_flat, bool &res_not_null_free);
1029
1030 template <class T1, class T2> static bool is_java_subtype_of_helper_for_instance(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
1031 template <class T1, class T2> static bool is_same_java_type_as_helper_for_instance(const T1* this_one, const T2* other);
1032 template <class T1, class T2> static bool maybe_java_subtype_of_helper_for_instance(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
1033 template <class T1, class T2> static bool is_java_subtype_of_helper_for_array(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
1034 template <class T1, class T2> static bool is_same_java_type_as_helper_for_array(const T1* this_one, const T2* other);
1035 template <class T1, class T2> static bool maybe_java_subtype_of_helper_for_array(const T1* this_one, const T2* other, bool this_exact, bool other_exact);
1036 template <class T1, class T2> static bool is_meet_subtype_of_helper_for_instance(const T1* this_one, const T2* other, bool this_xk, bool other_xk);
1037 template <class T1, class T2> static bool is_meet_subtype_of_helper_for_array(const T1* this_one, const T2* other, bool this_xk, bool other_xk);
1038 public:
1039 const Offset _offset; // Offset into oop, with TOP & BOT
1040 const PTR _ptr; // Pointer equivalence class
1041
1042 int offset() const { return _offset.get(); }
1043 PTR ptr() const { return _ptr; }
1044
1045 static const TypePtr* make(TYPES t, PTR ptr, Offset offset,
1046 const TypePtr* speculative = nullptr,
1047 int inline_depth = InlineDepthBottom);
1048
1049 // Return a 'ptr' version of this type
1050 virtual const TypePtr* cast_to_ptr_type(PTR ptr) const;
1051
1052 virtual intptr_t get_con() const;
1053
1054 Type::Offset xadd_offset(intptr_t offset) const;
1055 virtual const TypePtr* add_offset(intptr_t offset) const;
1056 virtual const TypePtr* with_offset(intptr_t offset) const;
1057 virtual int flat_offset() const { return offset(); }
1058 virtual bool eq(const Type *t) const;
1059 virtual uint hash() const; // Type specific hashing
1060
1061 virtual bool singleton(void) const; // TRUE if type is a singleton
1062 virtual bool empty(void) const; // TRUE if type is vacuous
1063 virtual const Type *xmeet( const Type *t ) const;
1064 virtual const Type *xmeet_helper( const Type *t ) const;
1065 Offset meet_offset(int offset) const;
1066 Offset dual_offset() const;
1067 virtual const Type *xdual() const; // Compute dual right now.
1068
1069 // meet, dual and join over pointer equivalence sets
1070 PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; }
1071 PTR dual_ptr() const { return ptr_dual[ptr()]; }
1072
1073 // This is textually confusing unless one recalls that
1074 // join(t) == dual()->meet(t->dual())->dual().
1075 PTR join_ptr( const PTR in_ptr ) const {
1076 return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ];
1077 }
1078
1079 // Speculative type helper methods.
1080 virtual const TypePtr* speculative() const { return _speculative; }
1081 int inline_depth() const { return _inline_depth; }
1082 virtual ciKlass* speculative_type() const;
1083 virtual ciKlass* speculative_type_not_null() const;
1084 virtual bool speculative_maybe_null() const;
1085 virtual bool speculative_always_null() const;
1086 virtual const TypePtr* remove_speculative() const;
1087 virtual const Type* cleanup_speculative() const;
1088 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1089 virtual bool would_improve_ptr(ProfilePtrKind maybe_null) const;
1090 virtual const TypePtr* with_inline_depth(int depth) const;
1091
1092 virtual bool maybe_null() const { return meet_ptr(Null) == ptr(); }
1093
1094 virtual bool can_be_inline_type() const { return false; }
1095 virtual bool flat_in_array() const { return false; }
1096 virtual bool not_flat_in_array() const { return false; }
1097 virtual bool is_flat() const { return false; }
1098 virtual bool is_not_flat() const { return false; }
1099 virtual bool is_null_free() const { return false; }
1100 virtual bool is_not_null_free() const { return false; }
1101
1102 // Tests for relation to centerline of type lattice:
1103 static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); }
1104 static bool below_centerline(PTR ptr) { return (ptr >= NotNull); }
1105 // Convenience common pre-built types.
1106 static const TypePtr *NULL_PTR;
1107 static const TypePtr *NOTNULL;
1108 static const TypePtr *BOTTOM;
1109 #ifndef PRODUCT
1110 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1111 #endif
1112 };
1113
1114 //------------------------------TypeRawPtr-------------------------------------
1115 // Class of raw pointers, pointers to things other than Oops. Examples
1116 // include the stack pointer, top of heap, card-marking area, handles, etc.
1117 class TypeRawPtr : public TypePtr {
1118 protected:
1119 TypeRawPtr(PTR ptr, address bits) : TypePtr(RawPtr,ptr,Offset(0)), _bits(bits){}
1120 public:
1121 virtual bool eq( const Type *t ) const;
1122 virtual uint hash() const; // Type specific hashing
1123
1124 const address _bits; // Constant value, if applicable
1125
1126 static const TypeRawPtr *make( PTR ptr );
1127 static const TypeRawPtr *make( address bits );
1128
1129 // Return a 'ptr' version of this type
1130 virtual const TypeRawPtr* cast_to_ptr_type(PTR ptr) const;
1131
1132 virtual intptr_t get_con() const;
1133
1134 virtual const TypePtr* add_offset(intptr_t offset) const;
1135 virtual const TypeRawPtr* with_offset(intptr_t offset) const { ShouldNotReachHere(); return nullptr;}
1136
1137 virtual const Type *xmeet( const Type *t ) const;
1138 virtual const Type *xdual() const; // Compute dual right now.
1139 // Convenience common pre-built types.
1140 static const TypeRawPtr *BOTTOM;
1141 static const TypeRawPtr *NOTNULL;
1142 #ifndef PRODUCT
1143 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1144 #endif
1145 };
1146
1147 //------------------------------TypeOopPtr-------------------------------------
1148 // Some kind of oop (Java pointer), either instance or array.
1149 class TypeOopPtr : public TypePtr {
1150 friend class TypeAry;
1151 friend class TypePtr;
1152 friend class TypeInstPtr;
1153 friend class TypeAryPtr;
1154 protected:
1155 TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, bool xk, ciObject* o, Offset offset, Offset field_offset, int instance_id,
1156 const TypePtr* speculative, int inline_depth);
1157 public:
1158 virtual bool eq( const Type *t ) const;
1159 virtual uint hash() const; // Type specific hashing
1160 virtual bool singleton(void) const; // TRUE if type is a singleton
1161 enum {
1162 InstanceTop = -1, // undefined instance
1163 InstanceBot = 0 // any possible instance
1164 };
1165 protected:
1166
1167 // Oop is null, unless this is a constant oop.
1168 ciObject* _const_oop; // Constant oop
1169 // If _klass is null, then so is _sig. This is an unloaded klass.
1170 ciKlass* _klass; // Klass object
1171
1172 const TypeInterfaces* _interfaces;
1173
1174 // Does the type exclude subclasses of the klass? (Inexact == polymorphic.)
1175 bool _klass_is_exact;
1176 bool _is_ptr_to_narrowoop;
1177 bool _is_ptr_to_narrowklass;
1178 bool _is_ptr_to_boxed_value;
1179
1180 // If not InstanceTop or InstanceBot, indicates that this is
1181 // a particular instance of this type which is distinct.
1182 // This is the node index of the allocation node creating this instance.
1183 int _instance_id;
1184
1185 static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact, InterfaceHandling interface_handling);
1186
1187 int dual_instance_id() const;
1188 int meet_instance_id(int uid) const;
1189
1190 const TypeInterfaces* meet_interfaces(const TypeOopPtr* other) const;
1191
1192 // Do not allow interface-vs.-noninterface joins to collapse to top.
1193 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1194
1195 virtual ciKlass* exact_klass_helper() const { return nullptr; }
1196 virtual ciKlass* klass() const { return _klass; }
1197
1198 public:
1199
1200 bool is_java_subtype_of(const TypeOopPtr* other) const {
1201 return is_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1202 }
1203
1204 bool is_same_java_type_as(const TypePtr* other) const {
1205 return is_same_java_type_as_helper(other->is_oopptr());
1206 }
1207
1208 virtual bool is_same_java_type_as_helper(const TypeOopPtr* other) const {
1209 ShouldNotReachHere(); return false;
1210 }
1211
1212 bool maybe_java_subtype_of(const TypeOopPtr* other) const {
1213 return maybe_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1214 }
1215 virtual bool is_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1216 virtual bool maybe_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1223 return make_from_klass_common(klass, true, false, interface_handling);
1224 }
1225 // Same as before, but will produce an exact type, even if
1226 // the klass is not final, as long as it has exactly one implementation.
1227 static const TypeOopPtr* make_from_klass_unique(ciKlass* klass, InterfaceHandling interface_handling= ignore_interfaces) {
1228 return make_from_klass_common(klass, true, true, interface_handling);
1229 }
1230 // Same as before, but does not respects UseUniqueSubclasses.
1231 // Use this only for creating array element types.
1232 static const TypeOopPtr* make_from_klass_raw(ciKlass* klass, InterfaceHandling interface_handling = ignore_interfaces) {
1233 return make_from_klass_common(klass, false, false, interface_handling);
1234 }
1235 // Creates a singleton type given an object.
1236 // If the object cannot be rendered as a constant,
1237 // may return a non-singleton type.
1238 // If require_constant, produce a null if a singleton is not possible.
1239 static const TypeOopPtr* make_from_constant(ciObject* o,
1240 bool require_constant = false);
1241
1242 // Make a generic (unclassed) pointer to an oop.
1243 static const TypeOopPtr* make(PTR ptr, Offset offset, int instance_id,
1244 const TypePtr* speculative = nullptr,
1245 int inline_depth = InlineDepthBottom);
1246
1247 ciObject* const_oop() const { return _const_oop; }
1248 // Exact klass, possibly an interface or an array of interface
1249 ciKlass* exact_klass(bool maybe_null = false) const { assert(klass_is_exact(), ""); ciKlass* k = exact_klass_helper(); assert(k != nullptr || maybe_null, ""); return k; }
1250 ciKlass* unloaded_klass() const { assert(!is_loaded(), "only for unloaded types"); return klass(); }
1251
1252 virtual bool is_loaded() const { return klass()->is_loaded(); }
1253 virtual bool klass_is_exact() const { return _klass_is_exact; }
1254
1255 // Returns true if this pointer points at memory which contains a
1256 // compressed oop references.
1257 bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; }
1258 bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; }
1259 bool is_ptr_to_boxed_value() const { return _is_ptr_to_boxed_value; }
1260 bool is_known_instance() const { return _instance_id > 0; }
1261 int instance_id() const { return _instance_id; }
1262 bool is_known_instance_field() const { return is_known_instance() && _offset.get() >= 0; }
1263
1264 virtual bool can_be_inline_type() const { return (_klass == nullptr || _klass->can_be_inline_klass(_klass_is_exact)); }
1265 virtual bool can_be_inline_array() const { ShouldNotReachHere(); return false; }
1266
1267 virtual intptr_t get_con() const;
1268
1269 virtual const TypeOopPtr* cast_to_ptr_type(PTR ptr) const;
1270
1271 virtual const TypeOopPtr* cast_to_exactness(bool klass_is_exact) const;
1272
1273 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1274
1275 // corresponding pointer to klass, for a given instance
1276 virtual const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1277
1278 virtual const TypeOopPtr* with_offset(intptr_t offset) const;
1279 virtual const TypePtr* add_offset(intptr_t offset) const;
1280
1281 // Speculative type helper methods.
1282 virtual const TypeOopPtr* remove_speculative() const;
1283 virtual const Type* cleanup_speculative() const;
1284 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1285 virtual const TypePtr* with_inline_depth(int depth) const;
1308 return _interfaces;
1309 };
1310
1311 const TypeOopPtr* is_reference_type(const Type* other) const {
1312 return other->isa_oopptr();
1313 }
1314
1315 const TypeAryPtr* is_array_type(const TypeOopPtr* other) const {
1316 return other->isa_aryptr();
1317 }
1318
1319 const TypeInstPtr* is_instance_type(const TypeOopPtr* other) const {
1320 return other->isa_instptr();
1321 }
1322 };
1323
1324 //------------------------------TypeInstPtr------------------------------------
1325 // Class of Java object pointers, pointing either to non-array Java instances
1326 // or to a Klass* (including array klasses).
1327 class TypeInstPtr : public TypeOopPtr {
1328 TypeInstPtr(PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, bool xk, ciObject* o, Offset offset,
1329 bool flat_in_array, int instance_id, const TypePtr* speculative,
1330 int inline_depth);
1331 virtual bool eq( const Type *t ) const;
1332 virtual uint hash() const; // Type specific hashing
1333 bool _flat_in_array; // Type is flat in arrays
1334 ciKlass* exact_klass_helper() const;
1335
1336 public:
1337
1338 // Instance klass, ignoring any interface
1339 ciInstanceKlass* instance_klass() const {
1340 assert(!(klass()->is_loaded() && klass()->is_interface()), "");
1341 return klass()->as_instance_klass();
1342 }
1343
1344 bool is_same_java_type_as_helper(const TypeOopPtr* other) const;
1345 bool is_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1346 bool maybe_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1347
1348 // Make a pointer to a constant oop.
1349 static const TypeInstPtr *make(ciObject* o) {
1350 ciKlass* k = o->klass();
1351 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1352 return make(TypePtr::Constant, k, interfaces, true, o, Offset(0));
1353 }
1354 // Make a pointer to a constant oop with offset.
1355 static const TypeInstPtr *make(ciObject* o, Offset offset) {
1356 ciKlass* k = o->klass();
1357 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1358 return make(TypePtr::Constant, k, interfaces, true, o, offset);
1359 }
1360
1361 // Make a pointer to some value of type klass.
1362 static const TypeInstPtr *make(PTR ptr, ciKlass* klass, InterfaceHandling interface_handling = ignore_interfaces) {
1363 const TypeInterfaces* interfaces = TypePtr::interfaces(klass, true, true, false, interface_handling);
1364 return make(ptr, klass, interfaces, false, nullptr, Offset(0));
1365 }
1366
1367 // Make a pointer to some non-polymorphic value of exactly type klass.
1368 static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) {
1369 const TypeInterfaces* interfaces = TypePtr::interfaces(klass, true, false, false, ignore_interfaces);
1370 return make(ptr, klass, interfaces, true, nullptr, Offset(0));
1371 }
1372
1373 // Make a pointer to some value of type klass with offset.
1374 static const TypeInstPtr *make(PTR ptr, ciKlass* klass, Offset offset) {
1375 const TypeInterfaces* interfaces = TypePtr::interfaces(klass, true, false, false, ignore_interfaces);
1376 return make(ptr, klass, interfaces, false, nullptr, offset);
1377 }
1378
1379 // Make a pointer to an oop.
1380 static const TypeInstPtr* make(PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, bool xk, ciObject* o, Offset offset,
1381 bool flat_in_array = false,
1382 int instance_id = InstanceBot,
1383 const TypePtr* speculative = nullptr,
1384 int inline_depth = InlineDepthBottom);
1385
1386 static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset, int instance_id = InstanceBot) {
1387 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1388 return make(ptr, k, interfaces, xk, o, offset, false, instance_id);
1389 }
1390
1391 /** Create constant type for a constant boxed value */
1392 const Type* get_const_boxed_value() const;
1393
1394 // If this is a java.lang.Class constant, return the type for it or null.
1395 // Pass to Type::get_const_type to turn it to a type, which will usually
1396 // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
1397 ciType* java_mirror_type() const;
1398
1399 virtual const TypeInstPtr* cast_to_ptr_type(PTR ptr) const;
1400
1401 virtual const TypeInstPtr* cast_to_exactness(bool klass_is_exact) const;
1402
1403 virtual const TypeInstPtr* cast_to_instance_id(int instance_id) const;
1404
1405 virtual const TypePtr* add_offset(intptr_t offset) const;
1406 virtual const TypeInstPtr* with_offset(intptr_t offset) const;
1407
1408 // Speculative type helper methods.
1409 virtual const TypeInstPtr* remove_speculative() const;
1410 virtual const TypePtr* with_inline_depth(int depth) const;
1411 virtual const TypePtr* with_instance_id(int instance_id) const;
1412
1413 virtual const TypeInstPtr* cast_to_flat_in_array() const;
1414 virtual bool flat_in_array() const { return _flat_in_array; }
1415 virtual bool not_flat_in_array() const { return !can_be_inline_type() || (_klass->is_inlinetype() && !flat_in_array()); }
1416
1417 // the core of the computation of the meet of 2 types
1418 virtual const Type *xmeet_helper(const Type *t) const;
1419 virtual const TypeInstPtr *xmeet_unloaded(const TypeInstPtr *tinst, const TypeInterfaces* interfaces) const;
1420 virtual const Type *xdual() const; // Compute dual right now.
1421
1422 const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1423
1424 virtual bool can_be_inline_array() const;
1425
1426 // Convenience common pre-built types.
1427 static const TypeInstPtr *NOTNULL;
1428 static const TypeInstPtr *BOTTOM;
1429 static const TypeInstPtr *MIRROR;
1430 static const TypeInstPtr *MARK;
1431 static const TypeInstPtr *KLASS;
1432 #ifndef PRODUCT
1433 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1434 #endif
1435
1436 private:
1437 virtual bool is_meet_subtype_of_helper(const TypeOopPtr* other, bool this_xk, bool other_xk) const;
1438
1439 virtual bool is_meet_same_type_as(const TypePtr* other) const {
1440 return _klass->equals(other->is_instptr()->_klass) && _interfaces->eq(other->is_instptr()->_interfaces);
1441 }
1442
1443 };
1444
1445 //------------------------------TypeAryPtr-------------------------------------
1446 // Class of Java array pointers
1447 class TypeAryPtr : public TypeOopPtr {
1448 friend class Type;
1449 friend class TypePtr;
1450 friend class TypeInstPtr;
1451
1452 TypeAryPtr(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk,
1453 Offset offset, Offset field_offset, int instance_id, bool is_autobox_cache,
1454 const TypePtr* speculative, int inline_depth)
1455 : TypeOopPtr(AryPtr, ptr, k, _array_interfaces, xk, o, offset, field_offset, instance_id, speculative, inline_depth),
1456 _ary(ary),
1457 _is_autobox_cache(is_autobox_cache),
1458 _field_offset(field_offset)
1459 {
1460 int dummy;
1461 bool top_or_bottom = (base_element_type(dummy) == Type::TOP || base_element_type(dummy) == Type::BOTTOM);
1462
1463 if (UseCompressedOops && (elem()->make_oopptr() != nullptr && !top_or_bottom) &&
1464 _offset.get() != 0 && _offset.get() != arrayOopDesc::length_offset_in_bytes() &&
1465 _offset.get() != arrayOopDesc::klass_offset_in_bytes()) {
1466 _is_ptr_to_narrowoop = true;
1467 }
1468
1469 }
1470 virtual bool eq( const Type *t ) const;
1471 virtual uint hash() const; // Type specific hashing
1472 const TypeAry *_ary; // Array we point into
1473 const bool _is_autobox_cache;
1474 // For flat inline type arrays, each field of the inline type in
1475 // the array has its own memory slice so we need to keep track of
1476 // which field is accessed
1477 const Offset _field_offset;
1478 Offset meet_field_offset(const Type::Offset offset) const;
1479 Offset dual_field_offset() const;
1480
1481 ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const;
1482
1483 // A pointer to delay allocation to Type::Initialize_shared()
1484
1485 static const TypeInterfaces* _array_interfaces;
1486 ciKlass* exact_klass_helper() const;
1487 // Only guaranteed non null for array of basic types
1488 ciKlass* klass() const;
1489
1490 public:
1491
1492 bool is_same_java_type_as_helper(const TypeOopPtr* other) const;
1493 bool is_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1494 bool maybe_java_subtype_of_helper(const TypeOopPtr* other, bool this_exact, bool other_exact) const;
1495
1496 // returns base element type, an instance klass (and not interface) for object arrays
1497 const Type* base_element_type(int& dims) const;
1498
1499 // Accessors
1500 bool is_loaded() const { return (_ary->_elem->make_oopptr() ? _ary->_elem->make_oopptr()->is_loaded() : true); }
1501
1502 const TypeAry* ary() const { return _ary; }
1503 const Type* elem() const { return _ary->_elem; }
1504 const TypeInt* size() const { return _ary->_size; }
1505 bool is_stable() const { return _ary->_stable; }
1506
1507 // Inline type array properties
1508 bool is_flat() const { return _ary->_flat; }
1509 bool is_not_flat() const { return _ary->_not_flat; }
1510 bool is_null_free() const { return is_flat() || (_ary->_elem->make_ptr() != nullptr && _ary->_elem->make_ptr()->is_inlinetypeptr() && (_ary->_elem->make_ptr()->ptr() == NotNull || _ary->_elem->make_ptr()->ptr() == AnyNull)); }
1511 bool is_not_null_free() const { return _ary->_not_null_free; }
1512
1513 bool is_autobox_cache() const { return _is_autobox_cache; }
1514
1515 static const TypeAryPtr* make(PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, Offset offset,
1516 Offset field_offset = Offset::bottom,
1517 int instance_id = InstanceBot,
1518 const TypePtr* speculative = nullptr,
1519 int inline_depth = InlineDepthBottom);
1520 // Constant pointer to array
1521 static const TypeAryPtr* make(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, Offset offset,
1522 Offset field_offset = Offset::bottom,
1523 int instance_id = InstanceBot,
1524 const TypePtr* speculative = nullptr,
1525 int inline_depth = InlineDepthBottom,
1526 bool is_autobox_cache = false);
1527
1528 // Return a 'ptr' version of this type
1529 virtual const TypeAryPtr* cast_to_ptr_type(PTR ptr) const;
1530
1531 virtual const TypeAryPtr* cast_to_exactness(bool klass_is_exact) const;
1532
1533 virtual const TypeAryPtr* cast_to_instance_id(int instance_id) const;
1534
1535 virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
1536 virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
1537
1538 virtual bool empty(void) const; // TRUE if type is vacuous
1539 virtual const TypePtr *add_offset( intptr_t offset ) const;
1540 virtual const TypeAryPtr *with_offset( intptr_t offset ) const;
1541 const TypeAryPtr* with_ary(const TypeAry* ary) const;
1542
1543 // Speculative type helper methods.
1544 virtual const TypeAryPtr* remove_speculative() const;
1545 virtual const Type* cleanup_speculative() const;
1546 virtual const TypePtr* with_inline_depth(int depth) const;
1547 virtual const TypePtr* with_instance_id(int instance_id) const;
1548
1549 // the core of the computation of the meet of 2 types
1550 virtual const Type *xmeet_helper(const Type *t) const;
1551 virtual const Type *xdual() const; // Compute dual right now.
1552
1553 // Inline type array properties
1554 const TypeAryPtr* cast_to_not_flat(bool not_flat = true) const;
1555 const TypeAryPtr* cast_to_not_null_free(bool not_null_free = true) const;
1556 const TypeAryPtr* update_properties(const TypeAryPtr* new_type) const;
1557 jint flat_layout_helper() const;
1558 int flat_elem_size() const;
1559 int flat_log_elem_size() const;
1560
1561 const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
1562 int stable_dimension() const;
1563
1564 const TypeAryPtr* cast_to_autobox_cache() const;
1565
1566 static jint max_array_length(BasicType etype);
1567
1568 int flat_offset() const;
1569 const Offset field_offset() const { return _field_offset; }
1570 const TypeAryPtr* with_field_offset(int offset) const;
1571 const TypePtr* add_field_offset_and_offset(intptr_t offset) const;
1572
1573 virtual bool can_be_inline_type() const { return false; }
1574 virtual const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1575
1576 virtual bool can_be_inline_array() const;
1577
1578 // Convenience common pre-built types.
1579 static const TypeAryPtr *RANGE;
1580 static const TypeAryPtr *OOPS;
1581 static const TypeAryPtr *NARROWOOPS;
1582 static const TypeAryPtr *BYTES;
1583 static const TypeAryPtr *SHORTS;
1584 static const TypeAryPtr *CHARS;
1585 static const TypeAryPtr *INTS;
1586 static const TypeAryPtr *LONGS;
1587 static const TypeAryPtr *FLOATS;
1588 static const TypeAryPtr *DOUBLES;
1589 static const TypeAryPtr *INLINES;
1590 // selects one of the above:
1591 static const TypeAryPtr *get_array_body_type(BasicType elem) {
1592 assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != nullptr, "bad elem type");
1593 return _array_body_type[elem];
1594 }
1595 static const TypeAryPtr *_array_body_type[T_CONFLICT+1];
1596 // sharpen the type of an int which is used as an array size
1597 #ifndef PRODUCT
1598 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1599 #endif
1600 private:
1601 virtual bool is_meet_subtype_of_helper(const TypeOopPtr* other, bool this_xk, bool other_xk) const;
1602 };
1603
1604 //------------------------------TypeMetadataPtr-------------------------------------
1605 // Some kind of metadata, either Method*, MethodData* or CPCacheOop
1606 class TypeMetadataPtr : public TypePtr {
1607 protected:
1608 TypeMetadataPtr(PTR ptr, ciMetadata* metadata, Offset offset);
1609 // Do not allow interface-vs.-noninterface joins to collapse to top.
1610 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1611 public:
1612 virtual bool eq( const Type *t ) const;
1613 virtual uint hash() const; // Type specific hashing
1614 virtual bool singleton(void) const; // TRUE if type is a singleton
1615
1616 private:
1617 ciMetadata* _metadata;
1618
1619 public:
1620 static const TypeMetadataPtr* make(PTR ptr, ciMetadata* m, Offset offset);
1621
1622 static const TypeMetadataPtr* make(ciMethod* m);
1623 static const TypeMetadataPtr* make(ciMethodData* m);
1624
1625 ciMetadata* metadata() const { return _metadata; }
1626
1627 virtual const TypeMetadataPtr* cast_to_ptr_type(PTR ptr) const;
1628
1629 virtual const TypePtr *add_offset( intptr_t offset ) const;
1630
1631 virtual const Type *xmeet( const Type *t ) const;
1632 virtual const Type *xdual() const; // Compute dual right now.
1633
1634 virtual intptr_t get_con() const;
1635
1636 // Convenience common pre-built types.
1637 static const TypeMetadataPtr *BOTTOM;
1638
1639 #ifndef PRODUCT
1640 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1641 #endif
1642 };
1643
1644 //------------------------------TypeKlassPtr-----------------------------------
1645 // Class of Java Klass pointers
1646 class TypeKlassPtr : public TypePtr {
1647 friend class TypeInstKlassPtr;
1648 friend class TypeAryKlassPtr;
1649 friend class TypePtr;
1650 protected:
1651 TypeKlassPtr(TYPES t, PTR ptr, ciKlass* klass, const TypeInterfaces* interfaces, Offset offset);
1652
1653 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1654
1655 public:
1656 virtual bool eq( const Type *t ) const;
1657 virtual uint hash() const;
1658 virtual bool singleton(void) const; // TRUE if type is a singleton
1659
1660 protected:
1661
1662 ciKlass* _klass;
1663 const TypeInterfaces* _interfaces;
1664 const TypeInterfaces* meet_interfaces(const TypeKlassPtr* other) const;
1665 virtual bool must_be_exact() const { ShouldNotReachHere(); return false; }
1666 virtual ciKlass* exact_klass_helper() const;
1667 virtual ciKlass* klass() const { return _klass; }
1668
1669 public:
1670
1671 bool is_java_subtype_of(const TypeKlassPtr* other) const {
1672 return is_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1673 }
1674 bool is_same_java_type_as(const TypePtr* other) const {
1675 return is_same_java_type_as_helper(other->is_klassptr());
1676 }
1677
1678 bool maybe_java_subtype_of(const TypeKlassPtr* other) const {
1679 return maybe_java_subtype_of_helper(other, klass_is_exact(), other->klass_is_exact());
1680 }
1681 virtual bool is_same_java_type_as_helper(const TypeKlassPtr* other) const { ShouldNotReachHere(); return false; }
1682 virtual bool is_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1683 virtual bool maybe_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const { ShouldNotReachHere(); return false; }
1684
1685 // Exact klass, possibly an interface or an array of interface
1686 ciKlass* exact_klass(bool maybe_null = false) const { assert(klass_is_exact(), ""); ciKlass* k = exact_klass_helper(); assert(k != nullptr || maybe_null, ""); return k; }
1687 virtual bool klass_is_exact() const { return _ptr == Constant; }
1688
1689 static const TypeKlassPtr* make(ciKlass* klass, InterfaceHandling interface_handling = ignore_interfaces);
1690 static const TypeKlassPtr *make(PTR ptr, ciKlass* klass, Offset offset, InterfaceHandling interface_handling = ignore_interfaces);
1691
1692 virtual bool is_loaded() const { return _klass->is_loaded(); }
1693
1694 virtual const TypeKlassPtr* cast_to_ptr_type(PTR ptr) const { ShouldNotReachHere(); return nullptr; }
1695
1696 virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const { ShouldNotReachHere(); return nullptr; }
1697
1698 // corresponding pointer to instance, for a given class
1699 virtual const TypeOopPtr* as_instance_type(bool klass_change = true) const { ShouldNotReachHere(); return nullptr; }
1700
1701 virtual const TypePtr *add_offset( intptr_t offset ) const { ShouldNotReachHere(); return nullptr; }
1702 virtual const Type *xmeet( const Type *t ) const { ShouldNotReachHere(); return nullptr; }
1703 virtual const Type *xdual() const { ShouldNotReachHere(); return nullptr; }
1704
1705 virtual intptr_t get_con() const;
1706
1707 virtual const TypeKlassPtr* with_offset(intptr_t offset) const { ShouldNotReachHere(); return nullptr; }
1708
1709 virtual bool can_be_inline_array() const { ShouldNotReachHere(); return false; }
1710 virtual const TypeKlassPtr* try_improve() const { return this; }
1711
1712 #ifndef PRODUCT
1713 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1714 #endif
1715 private:
1716 virtual bool is_meet_subtype_of(const TypePtr* other) const {
1717 return is_meet_subtype_of_helper(other->is_klassptr(), klass_is_exact(), other->is_klassptr()->klass_is_exact());
1718 }
1719
1720 virtual bool is_meet_subtype_of_helper(const TypeKlassPtr* other, bool this_xk, bool other_xk) const {
1721 ShouldNotReachHere(); return false;
1722 }
1723
1724 virtual const TypeInterfaces* interfaces() const {
1725 return _interfaces;
1726 };
1727
1728 const TypeKlassPtr* is_reference_type(const Type* other) const {
1729 return other->isa_klassptr();
1730 }
1731
1732 const TypeAryKlassPtr* is_array_type(const TypeKlassPtr* other) const {
1733 return other->isa_aryklassptr();
1734 }
1735
1736 const TypeInstKlassPtr* is_instance_type(const TypeKlassPtr* other) const {
1737 return other->isa_instklassptr();
1738 }
1739 };
1740
1741 // Instance klass pointer, mirrors TypeInstPtr
1742 class TypeInstKlassPtr : public TypeKlassPtr {
1743
1744 TypeInstKlassPtr(PTR ptr, ciKlass* klass, const TypeInterfaces* interfaces, Offset offset, bool flat_in_array)
1745 : TypeKlassPtr(InstKlassPtr, ptr, klass, interfaces, offset), _flat_in_array(flat_in_array) {
1746 assert(klass->is_instance_klass() && (!klass->is_loaded() || !klass->is_interface()), "");
1747 }
1748
1749 virtual bool must_be_exact() const;
1750
1751 const bool _flat_in_array; // Type is flat in arrays
1752
1753 public:
1754 // Instance klass ignoring any interface
1755 ciInstanceKlass* instance_klass() const {
1756 assert(!klass()->is_interface(), "");
1757 return klass()->as_instance_klass();
1758 }
1759
1760 bool is_same_java_type_as_helper(const TypeKlassPtr* other) const;
1761 bool is_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1762 bool maybe_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1763
1764 virtual bool can_be_inline_type() const { return (_klass == nullptr || _klass->can_be_inline_klass(klass_is_exact())); }
1765
1766 static const TypeInstKlassPtr *make(ciKlass* k, InterfaceHandling interface_handling) {
1767 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, true, false, interface_handling);
1768 return make(TypePtr::Constant, k, interfaces, Offset(0));
1769 }
1770 static const TypeInstKlassPtr* make(PTR ptr, ciKlass* k, const TypeInterfaces* interfaces, Offset offset, bool flat_in_array = false);
1771
1772 static const TypeInstKlassPtr* make(PTR ptr, ciKlass* k, Offset offset) {
1773 const TypeInterfaces* interfaces = TypePtr::interfaces(k, true, false, false, ignore_interfaces);
1774 return make(ptr, k, interfaces, offset);
1775 }
1776
1777 virtual const TypeInstKlassPtr* cast_to_ptr_type(PTR ptr) const;
1778
1779 virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const;
1780
1781 // corresponding pointer to instance, for a given class
1782 virtual const TypeOopPtr* as_instance_type(bool klass_change = true) const;
1783 virtual uint hash() const;
1784 virtual bool eq(const Type *t) const;
1785
1786 virtual const TypePtr *add_offset( intptr_t offset ) const;
1787 virtual const Type *xmeet( const Type *t ) const;
1788 virtual const Type *xdual() const;
1789 virtual const TypeInstKlassPtr* with_offset(intptr_t offset) const;
1790
1791 virtual const TypeKlassPtr* try_improve() const;
1792
1793 virtual bool flat_in_array() const { return _flat_in_array; }
1794 virtual bool not_flat_in_array() const { return !_klass->can_be_inline_klass() || (_klass->is_inlinetype() && !flat_in_array()); }
1795
1796 virtual bool can_be_inline_array() const;
1797
1798 // Convenience common pre-built types.
1799 static const TypeInstKlassPtr* OBJECT; // Not-null object klass or below
1800 static const TypeInstKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
1801 private:
1802 virtual bool is_meet_subtype_of_helper(const TypeKlassPtr* other, bool this_xk, bool other_xk) const;
1803 };
1804
1805 // Array klass pointer, mirrors TypeAryPtr
1806 class TypeAryKlassPtr : public TypeKlassPtr {
1807 friend class TypeInstKlassPtr;
1808 friend class Type;
1809 friend class TypePtr;
1810
1811 const Type *_elem;
1812 const bool _not_flat; // Array is never flat
1813 const bool _not_null_free; // Array is never null-free
1814 const bool _null_free;
1815
1816 static const TypeInterfaces* _array_interfaces;
1817 TypeAryKlassPtr(PTR ptr, const Type *elem, ciKlass* klass, Offset offset, bool not_flat, int not_null_free, bool null_free)
1818 : TypeKlassPtr(AryKlassPtr, ptr, klass, _array_interfaces, offset), _elem(elem), _not_flat(not_flat), _not_null_free(not_null_free), _null_free(null_free) {
1819 assert(klass == nullptr || klass->is_type_array_klass() || klass->is_flat_array_klass() || !klass->as_obj_array_klass()->base_element_klass()->is_interface(), "");
1820 }
1821
1822 virtual ciKlass* exact_klass_helper() const;
1823 // Only guaranteed non null for array of basic types
1824 virtual ciKlass* klass() const;
1825
1826 virtual bool must_be_exact() const;
1827
1828 bool dual_null_free() const {
1829 return _null_free;
1830 }
1831
1832 bool meet_null_free(bool other) const {
1833 return _null_free && other;
1834 }
1835
1836 public:
1837
1838 // returns base element type, an instance klass (and not interface) for object arrays
1839 const Type* base_element_type(int& dims) const;
1840
1841 static const TypeAryKlassPtr* make(PTR ptr, ciKlass* k, Offset offset, InterfaceHandling interface_handling, bool not_flat, bool not_null_free, bool null_free);
1842
1843 bool is_same_java_type_as_helper(const TypeKlassPtr* other) const;
1844 bool is_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1845 bool maybe_java_subtype_of_helper(const TypeKlassPtr* other, bool this_exact, bool other_exact) const;
1846
1847 bool is_loaded() const { return (_elem->isa_klassptr() ? _elem->is_klassptr()->is_loaded() : true); }
1848
1849 static const TypeAryKlassPtr* make(PTR ptr, const Type* elem, ciKlass* k, Offset offset, bool not_flat, bool not_null_free, bool null_free);
1850 static const TypeAryKlassPtr* make(PTR ptr, ciKlass* k, Offset offset, InterfaceHandling interface_handling);
1851 static const TypeAryKlassPtr* make(ciKlass* klass, InterfaceHandling interface_handling);
1852
1853 const Type *elem() const { return _elem; }
1854
1855 virtual bool eq(const Type *t) const;
1856 virtual uint hash() const; // Type specific hashing
1857
1858 virtual const TypeAryKlassPtr* cast_to_ptr_type(PTR ptr) const;
1859
1860 virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const;
1861
1862 const TypeAryKlassPtr* cast_to_null_free() const;
1863
1864 // corresponding pointer to instance, for a given class
1865 virtual const TypeOopPtr* as_instance_type(bool klass_change = true) const;
1866
1867 virtual const TypePtr *add_offset( intptr_t offset ) const;
1868 virtual const Type *xmeet( const Type *t ) const;
1869 virtual const Type *xdual() const; // Compute dual right now.
1870
1871 virtual const TypeAryKlassPtr* with_offset(intptr_t offset) const;
1872
1873 virtual bool empty(void) const {
1874 return TypeKlassPtr::empty() || _elem->empty();
1875 }
1876
1877 bool is_flat() const { return klass() != nullptr && klass()->is_flat_array_klass(); }
1878 bool is_not_flat() const { return _not_flat; }
1879 bool is_null_free() const { return _null_free; }
1880 bool is_not_null_free() const { return _not_null_free; }
1881 virtual bool can_be_inline_array() const;
1882
1883 #ifndef PRODUCT
1884 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1885 #endif
1886 private:
1887 virtual bool is_meet_subtype_of_helper(const TypeKlassPtr* other, bool this_xk, bool other_xk) const;
1888 };
1889
1890 class TypeNarrowPtr : public Type {
1891 protected:
1892 const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR
1893
1894 TypeNarrowPtr(TYPES t, const TypePtr* ptrtype): Type(t),
1895 _ptrtype(ptrtype) {
1896 assert(ptrtype->offset() == 0 ||
1897 ptrtype->offset() == OffsetBot ||
1898 ptrtype->offset() == OffsetTop, "no real offsets");
1899 }
1900
1901 virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const = 0;
1902 virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0;
1998 }
1999
2000 virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const {
2001 return (const TypeNarrowPtr*)((new TypeNarrowKlass(t))->hashcons());
2002 }
2003
2004 public:
2005 static const TypeNarrowKlass *make( const TypePtr* type);
2006
2007 // static const TypeNarrowKlass *BOTTOM;
2008 static const TypeNarrowKlass *NULL_PTR;
2009
2010 #ifndef PRODUCT
2011 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
2012 #endif
2013 };
2014
2015 //------------------------------TypeFunc---------------------------------------
2016 // Class of Array Types
2017 class TypeFunc : public Type {
2018 TypeFunc(const TypeTuple *domain_sig, const TypeTuple *domain_cc, const TypeTuple *range_sig, const TypeTuple *range_cc)
2019 : Type(Function), _domain_sig(domain_sig), _domain_cc(domain_cc), _range_sig(range_sig), _range_cc(range_cc) {}
2020 virtual bool eq( const Type *t ) const;
2021 virtual uint hash() const; // Type specific hashing
2022 virtual bool singleton(void) const; // TRUE if type is a singleton
2023 virtual bool empty(void) const; // TRUE if type is vacuous
2024
2025 // Domains of inputs: inline type arguments are not passed by
2026 // reference, instead each field of the inline type is passed as an
2027 // argument. We maintain 2 views of the argument list here: one
2028 // based on the signature (with an inline type argument as a single
2029 // slot), one based on the actual calling convention (with a value
2030 // type argument as a list of its fields).
2031 const TypeTuple* const _domain_sig;
2032 const TypeTuple* const _domain_cc;
2033 // Range of results. Similar to domains: an inline type result can be
2034 // returned in registers in which case range_cc lists all fields and
2035 // is the actual calling convention.
2036 const TypeTuple* const _range_sig;
2037 const TypeTuple* const _range_cc;
2038
2039 public:
2040 // Constants are shared among ADLC and VM
2041 enum { Control = AdlcVMDeps::Control,
2042 I_O = AdlcVMDeps::I_O,
2043 Memory = AdlcVMDeps::Memory,
2044 FramePtr = AdlcVMDeps::FramePtr,
2045 ReturnAdr = AdlcVMDeps::ReturnAdr,
2046 Parms = AdlcVMDeps::Parms
2047 };
2048
2049
2050 // Accessors:
2051 const TypeTuple* domain_sig() const { return _domain_sig; }
2052 const TypeTuple* domain_cc() const { return _domain_cc; }
2053 const TypeTuple* range_sig() const { return _range_sig; }
2054 const TypeTuple* range_cc() const { return _range_cc; }
2055
2056 static const TypeFunc* make(ciMethod* method, bool is_osr_compilation = false);
2057 static const TypeFunc *make(const TypeTuple* domain_sig, const TypeTuple* domain_cc,
2058 const TypeTuple* range_sig, const TypeTuple* range_cc);
2059 static const TypeFunc *make(const TypeTuple* domain, const TypeTuple* range);
2060
2061 virtual const Type *xmeet( const Type *t ) const;
2062 virtual const Type *xdual() const; // Compute dual right now.
2063
2064 BasicType return_type() const;
2065
2066 bool returns_inline_type_as_fields() const { return range_sig() != range_cc(); }
2067
2068 #ifndef PRODUCT
2069 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
2070 #endif
2071 // Convenience common pre-built types.
2072 };
2073
2074 //------------------------------accessors--------------------------------------
2075 inline bool Type::is_ptr_to_narrowoop() const {
2076 #ifdef _LP64
2077 return (isa_oopptr() != nullptr && is_oopptr()->is_ptr_to_narrowoop_nv());
2078 #else
2079 return false;
2080 #endif
2081 }
2082
2083 inline bool Type::is_ptr_to_narrowklass() const {
2084 #ifdef _LP64
2085 return (isa_oopptr() != nullptr && is_oopptr()->is_ptr_to_narrowklass_nv());
2086 #else
2087 return false;
2303 return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->isa_oopptr() : isa_oopptr();
2304 }
2305
2306 inline const TypeNarrowOop* Type::make_narrowoop() const {
2307 return (_base == NarrowOop) ? is_narrowoop() :
2308 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : nullptr);
2309 }
2310
2311 inline const TypeNarrowKlass* Type::make_narrowklass() const {
2312 return (_base == NarrowKlass) ? is_narrowklass() :
2313 (isa_ptr() ? TypeNarrowKlass::make(is_ptr()) : nullptr);
2314 }
2315
2316 inline bool Type::is_floatingpoint() const {
2317 if( (_base == FloatCon) || (_base == FloatBot) ||
2318 (_base == DoubleCon) || (_base == DoubleBot) )
2319 return true;
2320 return false;
2321 }
2322
2323 inline bool Type::is_inlinetypeptr() const {
2324 return isa_instptr() != nullptr && is_instptr()->instance_klass()->is_inlinetype();
2325 }
2326
2327 inline ciInlineKlass* Type::inline_klass() const {
2328 return make_ptr()->is_instptr()->instance_klass()->as_inline_klass();
2329 }
2330
2331
2332 // ===============================================================
2333 // Things that need to be 64-bits in the 64-bit build but
2334 // 32-bits in the 32-bit build. Done this way to get full
2335 // optimization AND strong typing.
2336 #ifdef _LP64
2337
2338 // For type queries and asserts
2339 #define is_intptr_t is_long
2340 #define isa_intptr_t isa_long
2341 #define find_intptr_t_type find_long_type
2342 #define find_intptr_t_con find_long_con
2343 #define TypeX TypeLong
2344 #define Type_X Type::Long
2345 #define TypeX_X TypeLong::LONG
2346 #define TypeX_ZERO TypeLong::ZERO
2347 // For 'ideal_reg' machine registers
2348 #define Op_RegX Op_RegL
2349 // For phase->intcon variants
2350 #define MakeConX longcon
2351 #define ConXNode ConLNode
2352 // For array index arithmetic
2353 #define MulXNode MulLNode
2354 #define AndXNode AndLNode
2355 #define OrXNode OrLNode
2356 #define CmpXNode CmpLNode
2357 #define CmpUXNode CmpULNode
2358 #define SubXNode SubLNode
2359 #define LShiftXNode LShiftLNode
2360 // For object size computation:
2361 #define AddXNode AddLNode
2362 #define RShiftXNode RShiftLNode
2363 // For card marks and hashcodes
2364 #define URShiftXNode URShiftLNode
2365 // For shenandoahSupport
2366 #define LoadXNode LoadLNode
2367 #define StoreXNode StoreLNode
2368 // Opcodes
2369 #define Op_LShiftX Op_LShiftL
2370 #define Op_AndX Op_AndL
2371 #define Op_AddX Op_AddL
2372 #define Op_SubX Op_SubL
2373 #define Op_XorX Op_XorL
2374 #define Op_URShiftX Op_URShiftL
2375 #define Op_LoadX Op_LoadL
2376 #define Op_StoreX Op_StoreL
2377 // conversions
2378 #define ConvI2X(x) ConvI2L(x)
2379 #define ConvL2X(x) (x)
2380 #define ConvX2I(x) ConvL2I(x)
2381 #define ConvX2L(x) (x)
2382 #define ConvX2UL(x) (x)
2383
2384 #else
2385
2386 // For type queries and asserts
2387 #define is_intptr_t is_int
2388 #define isa_intptr_t isa_int
2389 #define find_intptr_t_type find_int_type
2390 #define find_intptr_t_con find_int_con
2391 #define TypeX TypeInt
2392 #define Type_X Type::Int
2393 #define TypeX_X TypeInt::INT
2394 #define TypeX_ZERO TypeInt::ZERO
2395 // For 'ideal_reg' machine registers
2396 #define Op_RegX Op_RegI
2397 // For phase->intcon variants
2398 #define MakeConX intcon
2399 #define ConXNode ConINode
2400 // For array index arithmetic
2401 #define MulXNode MulINode
2402 #define AndXNode AndINode
2403 #define OrXNode OrINode
2404 #define CmpXNode CmpINode
2405 #define CmpUXNode CmpUNode
2406 #define SubXNode SubINode
2407 #define LShiftXNode LShiftINode
2408 // For object size computation:
2409 #define AddXNode AddINode
2410 #define RShiftXNode RShiftINode
2411 // For card marks and hashcodes
2412 #define URShiftXNode URShiftINode
2413 // For shenandoahSupport
2414 #define LoadXNode LoadINode
2415 #define StoreXNode StoreINode
2416 // Opcodes
2417 #define Op_LShiftX Op_LShiftI
2418 #define Op_AndX Op_AndI
2419 #define Op_AddX Op_AddI
2420 #define Op_SubX Op_SubI
2421 #define Op_XorX Op_XorI
2422 #define Op_URShiftX Op_URShiftI
2423 #define Op_LoadX Op_LoadI
2424 #define Op_StoreX Op_StoreI
2425 // conversions
2426 #define ConvI2X(x) (x)
2427 #define ConvL2X(x) ConvL2I(x)
2428 #define ConvX2I(x) (x)
2429 #define ConvX2L(x) ConvI2L(x)
2430 #define ConvX2UL(x) ConvI2UL(x)
2431
2432 #endif
2433
2434 #endif // SHARE_OPTO_TYPE_HPP
|