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