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