1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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 *
1011 virtual ciKlass* klass() const { return _klass; }
1012 bool klass_is_exact() const { return _klass_is_exact; }
1013
1014 // Returns true if this pointer points at memory which contains a
1015 // compressed oop references.
1016 bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; }
1017 bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; }
1018 bool is_ptr_to_boxed_value() const { return _is_ptr_to_boxed_value; }
1019 bool is_known_instance() const { return _instance_id > 0; }
1020 int instance_id() const { return _instance_id; }
1021 bool is_known_instance_field() const { return is_known_instance() && _offset >= 0; }
1022
1023 virtual intptr_t get_con() const;
1024
1025 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1026
1027 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1028
1029 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1030
1031 // corresponding pointer to klass, for a given instance
1032 const TypeKlassPtr* as_klass_type() const;
1033
1034 virtual const TypePtr *add_offset( intptr_t offset ) const;
1035
1036 // Speculative type helper methods.
1037 virtual const Type* remove_speculative() const;
1038 virtual const Type* cleanup_speculative() const;
1039 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1040 virtual const TypePtr* with_inline_depth(int depth) const;
1041
1042 virtual const Type *xdual() const; // Compute dual right now.
1043 // the core of the computation of the meet for TypeOopPtr and for its subclasses
1044 virtual const Type *xmeet_helper(const Type *t) const;
1045
1046 // Convenience common pre-built type.
1047 static const TypeOopPtr *BOTTOM;
1048 #ifndef PRODUCT
1049 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1050 #endif
1093 // Make a pointer to an oop.
1094 static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset,
1095 int instance_id = InstanceBot,
1096 const TypePtr* speculative = NULL,
1097 int inline_depth = InlineDepthBottom);
1098
1099 /** Create constant type for a constant boxed value */
1100 const Type* get_const_boxed_value() const;
1101
1102 // If this is a java.lang.Class constant, return the type for it or NULL.
1103 // Pass to Type::get_const_type to turn it to a type, which will usually
1104 // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
1105 ciType* java_mirror_type() const;
1106
1107 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1108
1109 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1110
1111 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1112
1113 virtual const TypePtr *add_offset( intptr_t offset ) const;
1114
1115 // Speculative type helper methods.
1116 virtual const Type* remove_speculative() const;
1117 virtual const TypePtr* with_inline_depth(int depth) const;
1118
1119 // the core of the computation of the meet of 2 types
1120 virtual const Type *xmeet_helper(const Type *t) const;
1121 virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const;
1122 virtual const Type *xdual() const; // Compute dual right now.
1123
1124 // Convenience common pre-built types.
1125 static const TypeInstPtr *NOTNULL;
1126 static const TypeInstPtr *BOTTOM;
1127 static const TypeInstPtr *MIRROR;
1128 static const TypeInstPtr *MARK;
1129 static const TypeInstPtr *KLASS;
1130 #ifndef PRODUCT
1131 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1132 #endif
1176
1177 bool is_autobox_cache() const { return _is_autobox_cache; }
1178
1179 static const TypeAryPtr *make(PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset,
1180 int instance_id = InstanceBot,
1181 const TypePtr* speculative = NULL,
1182 int inline_depth = InlineDepthBottom);
1183 // Constant pointer to array
1184 static const TypeAryPtr *make(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset,
1185 int instance_id = InstanceBot,
1186 const TypePtr* speculative = NULL,
1187 int inline_depth = InlineDepthBottom, bool is_autobox_cache = false);
1188
1189 // Return a 'ptr' version of this type
1190 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1191
1192 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1193
1194 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1195
1196 virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
1197 virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
1198
1199 virtual bool empty(void) const; // TRUE if type is vacuous
1200 virtual const TypePtr *add_offset( intptr_t offset ) const;
1201
1202 // Speculative type helper methods.
1203 virtual const Type* remove_speculative() const;
1204 virtual const TypePtr* with_inline_depth(int depth) const;
1205
1206 // the core of the computation of the meet of 2 types
1207 virtual const Type *xmeet_helper(const Type *t) const;
1208 virtual const Type *xdual() const; // Compute dual right now.
1209
1210 const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
1211 int stable_dimension() const;
1212
1213 const TypeAryPtr* cast_to_autobox_cache(bool cache) const;
1214
1215 // Convenience common pre-built types.
1753 // For 'ideal_reg' machine registers
1754 #define Op_RegX Op_RegL
1755 // For phase->intcon variants
1756 #define MakeConX longcon
1757 #define ConXNode ConLNode
1758 // For array index arithmetic
1759 #define MulXNode MulLNode
1760 #define AndXNode AndLNode
1761 #define OrXNode OrLNode
1762 #define CmpXNode CmpLNode
1763 #define SubXNode SubLNode
1764 #define LShiftXNode LShiftLNode
1765 // For object size computation:
1766 #define AddXNode AddLNode
1767 #define RShiftXNode RShiftLNode
1768 // For card marks and hashcodes
1769 #define URShiftXNode URShiftLNode
1770 // UseOptoBiasInlining
1771 #define XorXNode XorLNode
1772 #define StoreXConditionalNode StoreLConditionalNode
1773 // Opcodes
1774 #define Op_LShiftX Op_LShiftL
1775 #define Op_AndX Op_AndL
1776 #define Op_AddX Op_AddL
1777 #define Op_SubX Op_SubL
1778 #define Op_XorX Op_XorL
1779 #define Op_URShiftX Op_URShiftL
1780 // conversions
1781 #define ConvI2X(x) ConvI2L(x)
1782 #define ConvL2X(x) (x)
1783 #define ConvX2I(x) ConvL2I(x)
1784 #define ConvX2L(x) (x)
1785 #define ConvX2UL(x) (x)
1786
1787 #else
1788
1789 // For type queries and asserts
1790 #define is_intptr_t is_int
1791 #define isa_intptr_t isa_int
1792 #define find_intptr_t_type find_int_type
1798 // For 'ideal_reg' machine registers
1799 #define Op_RegX Op_RegI
1800 // For phase->intcon variants
1801 #define MakeConX intcon
1802 #define ConXNode ConINode
1803 // For array index arithmetic
1804 #define MulXNode MulINode
1805 #define AndXNode AndINode
1806 #define OrXNode OrINode
1807 #define CmpXNode CmpINode
1808 #define SubXNode SubINode
1809 #define LShiftXNode LShiftINode
1810 // For object size computation:
1811 #define AddXNode AddINode
1812 #define RShiftXNode RShiftINode
1813 // For card marks and hashcodes
1814 #define URShiftXNode URShiftINode
1815 // UseOptoBiasInlining
1816 #define XorXNode XorINode
1817 #define StoreXConditionalNode StoreIConditionalNode
1818 // Opcodes
1819 #define Op_LShiftX Op_LShiftI
1820 #define Op_AndX Op_AndI
1821 #define Op_AddX Op_AddI
1822 #define Op_SubX Op_SubI
1823 #define Op_XorX Op_XorI
1824 #define Op_URShiftX Op_URShiftI
1825 // conversions
1826 #define ConvI2X(x) (x)
1827 #define ConvL2X(x) ConvL2I(x)
1828 #define ConvX2I(x) (x)
1829 #define ConvX2L(x) ConvI2L(x)
1830 #define ConvX2UL(x) ConvI2UL(x)
1831
1832 #endif
1833
1834 #endif // SHARE_VM_OPTO_TYPE_HPP
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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 *
1011 virtual ciKlass* klass() const { return _klass; }
1012 bool klass_is_exact() const { return _klass_is_exact; }
1013
1014 // Returns true if this pointer points at memory which contains a
1015 // compressed oop references.
1016 bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; }
1017 bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; }
1018 bool is_ptr_to_boxed_value() const { return _is_ptr_to_boxed_value; }
1019 bool is_known_instance() const { return _instance_id > 0; }
1020 int instance_id() const { return _instance_id; }
1021 bool is_known_instance_field() const { return is_known_instance() && _offset >= 0; }
1022
1023 virtual intptr_t get_con() const;
1024
1025 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1026
1027 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1028
1029 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1030
1031 virtual const TypeOopPtr *cast_to_nonconst() const;
1032
1033 // corresponding pointer to klass, for a given instance
1034 const TypeKlassPtr* as_klass_type() const;
1035
1036 virtual const TypePtr *add_offset( intptr_t offset ) const;
1037
1038 // Speculative type helper methods.
1039 virtual const Type* remove_speculative() const;
1040 virtual const Type* cleanup_speculative() const;
1041 virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1042 virtual const TypePtr* with_inline_depth(int depth) const;
1043
1044 virtual const Type *xdual() const; // Compute dual right now.
1045 // the core of the computation of the meet for TypeOopPtr and for its subclasses
1046 virtual const Type *xmeet_helper(const Type *t) const;
1047
1048 // Convenience common pre-built type.
1049 static const TypeOopPtr *BOTTOM;
1050 #ifndef PRODUCT
1051 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1052 #endif
1095 // Make a pointer to an oop.
1096 static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset,
1097 int instance_id = InstanceBot,
1098 const TypePtr* speculative = NULL,
1099 int inline_depth = InlineDepthBottom);
1100
1101 /** Create constant type for a constant boxed value */
1102 const Type* get_const_boxed_value() const;
1103
1104 // If this is a java.lang.Class constant, return the type for it or NULL.
1105 // Pass to Type::get_const_type to turn it to a type, which will usually
1106 // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
1107 ciType* java_mirror_type() const;
1108
1109 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1110
1111 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1112
1113 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1114
1115 virtual const TypeOopPtr *cast_to_nonconst() const;
1116
1117 virtual const TypePtr *add_offset( intptr_t offset ) const;
1118
1119 // Speculative type helper methods.
1120 virtual const Type* remove_speculative() const;
1121 virtual const TypePtr* with_inline_depth(int depth) const;
1122
1123 // the core of the computation of the meet of 2 types
1124 virtual const Type *xmeet_helper(const Type *t) const;
1125 virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const;
1126 virtual const Type *xdual() const; // Compute dual right now.
1127
1128 // Convenience common pre-built types.
1129 static const TypeInstPtr *NOTNULL;
1130 static const TypeInstPtr *BOTTOM;
1131 static const TypeInstPtr *MIRROR;
1132 static const TypeInstPtr *MARK;
1133 static const TypeInstPtr *KLASS;
1134 #ifndef PRODUCT
1135 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1136 #endif
1180
1181 bool is_autobox_cache() const { return _is_autobox_cache; }
1182
1183 static const TypeAryPtr *make(PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset,
1184 int instance_id = InstanceBot,
1185 const TypePtr* speculative = NULL,
1186 int inline_depth = InlineDepthBottom);
1187 // Constant pointer to array
1188 static const TypeAryPtr *make(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset,
1189 int instance_id = InstanceBot,
1190 const TypePtr* speculative = NULL,
1191 int inline_depth = InlineDepthBottom, bool is_autobox_cache = false);
1192
1193 // Return a 'ptr' version of this type
1194 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1195
1196 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1197
1198 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1199
1200 virtual const TypeOopPtr *cast_to_nonconst() const;
1201
1202 virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
1203 virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
1204
1205 virtual bool empty(void) const; // TRUE if type is vacuous
1206 virtual const TypePtr *add_offset( intptr_t offset ) const;
1207
1208 // Speculative type helper methods.
1209 virtual const Type* remove_speculative() const;
1210 virtual const TypePtr* with_inline_depth(int depth) const;
1211
1212 // the core of the computation of the meet of 2 types
1213 virtual const Type *xmeet_helper(const Type *t) const;
1214 virtual const Type *xdual() const; // Compute dual right now.
1215
1216 const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
1217 int stable_dimension() const;
1218
1219 const TypeAryPtr* cast_to_autobox_cache(bool cache) const;
1220
1221 // Convenience common pre-built types.
1759 // For 'ideal_reg' machine registers
1760 #define Op_RegX Op_RegL
1761 // For phase->intcon variants
1762 #define MakeConX longcon
1763 #define ConXNode ConLNode
1764 // For array index arithmetic
1765 #define MulXNode MulLNode
1766 #define AndXNode AndLNode
1767 #define OrXNode OrLNode
1768 #define CmpXNode CmpLNode
1769 #define SubXNode SubLNode
1770 #define LShiftXNode LShiftLNode
1771 // For object size computation:
1772 #define AddXNode AddLNode
1773 #define RShiftXNode RShiftLNode
1774 // For card marks and hashcodes
1775 #define URShiftXNode URShiftLNode
1776 // UseOptoBiasInlining
1777 #define XorXNode XorLNode
1778 #define StoreXConditionalNode StoreLConditionalNode
1779 #define LoadXNode LoadLNode
1780 #define StoreXNode StoreLNode
1781 // Opcodes
1782 #define Op_LShiftX Op_LShiftL
1783 #define Op_AndX Op_AndL
1784 #define Op_AddX Op_AddL
1785 #define Op_SubX Op_SubL
1786 #define Op_XorX Op_XorL
1787 #define Op_URShiftX Op_URShiftL
1788 // conversions
1789 #define ConvI2X(x) ConvI2L(x)
1790 #define ConvL2X(x) (x)
1791 #define ConvX2I(x) ConvL2I(x)
1792 #define ConvX2L(x) (x)
1793 #define ConvX2UL(x) (x)
1794
1795 #else
1796
1797 // For type queries and asserts
1798 #define is_intptr_t is_int
1799 #define isa_intptr_t isa_int
1800 #define find_intptr_t_type find_int_type
1806 // For 'ideal_reg' machine registers
1807 #define Op_RegX Op_RegI
1808 // For phase->intcon variants
1809 #define MakeConX intcon
1810 #define ConXNode ConINode
1811 // For array index arithmetic
1812 #define MulXNode MulINode
1813 #define AndXNode AndINode
1814 #define OrXNode OrINode
1815 #define CmpXNode CmpINode
1816 #define SubXNode SubINode
1817 #define LShiftXNode LShiftINode
1818 // For object size computation:
1819 #define AddXNode AddINode
1820 #define RShiftXNode RShiftINode
1821 // For card marks and hashcodes
1822 #define URShiftXNode URShiftINode
1823 // UseOptoBiasInlining
1824 #define XorXNode XorINode
1825 #define StoreXConditionalNode StoreIConditionalNode
1826 #define LoadXNode LoadINode
1827 #define StoreXNode StoreINode
1828 // Opcodes
1829 #define Op_LShiftX Op_LShiftI
1830 #define Op_AndX Op_AndI
1831 #define Op_AddX Op_AddI
1832 #define Op_SubX Op_SubI
1833 #define Op_XorX Op_XorI
1834 #define Op_URShiftX Op_URShiftI
1835 // conversions
1836 #define ConvI2X(x) (x)
1837 #define ConvL2X(x) ConvL2I(x)
1838 #define ConvX2I(x) (x)
1839 #define ConvX2L(x) ConvI2L(x)
1840 #define ConvX2UL(x) ConvI2UL(x)
1841
1842 #endif
1843
1844 #endif // SHARE_VM_OPTO_TYPE_HPP
|