178 const Type *meet_helper(const Type *t, bool include_speculative) const;
179 void check_symmetrical(const Type* t, const Type* mt, const VerifyMeet& verify) const NOT_DEBUG_RETURN;
180
181 protected:
182 // Each class of type is also identified by its base.
183 const TYPES _base; // Enum of Types type
184
185 Type( TYPES t ) : _dual(nullptr), _base(t) {} // Simple types
186 // ~Type(); // Use fast deallocation
187 const Type *hashcons(); // Hash-cons the type
188 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
189 const Type *join_helper(const Type *t, bool include_speculative) const {
190 assert_type_verify_empty();
191 return dual()->meet_helper(t->dual(), include_speculative)->dual();
192 }
193
194 void assert_type_verify_empty() const NOT_DEBUG_RETURN;
195
196 public:
197
198 inline void* operator new( size_t x ) throw() {
199 Compile* compile = Compile::current();
200 compile->set_type_last_size(x);
201 return compile->type_arena()->AmallocWords(x);
202 }
203 inline void operator delete( void* ptr ) {
204 Compile* compile = Compile::current();
205 compile->type_arena()->Afree(ptr,compile->type_last_size());
206 }
207
208 // Initialize the type system for a particular compilation.
209 static void Initialize(Compile* compile);
210
211 // Initialize the types shared by all compilations.
212 static void Initialize_shared(Compile* compile);
213
214 TYPES base() const {
215 assert(_base > Bad && _base < lastype, "sanity");
216 return _base;
217 }
1416 };
1417
1418 //------------------------------TypeAryPtr-------------------------------------
1419 // Class of Java array pointers
1420 class TypeAryPtr : public TypeOopPtr {
1421 friend class Type;
1422 friend class TypePtr;
1423
1424 TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk,
1425 int offset, int instance_id, bool is_autobox_cache,
1426 const TypePtr* speculative, int inline_depth)
1427 : TypeOopPtr(AryPtr,ptr,k,_array_interfaces,xk,o,offset, instance_id, speculative, inline_depth),
1428 _ary(ary),
1429 _is_autobox_cache(is_autobox_cache)
1430 {
1431 int dummy;
1432 bool top_or_bottom = (base_element_type(dummy) == Type::TOP || base_element_type(dummy) == Type::BOTTOM);
1433
1434 if (UseCompressedOops && (elem()->make_oopptr() != nullptr && !top_or_bottom) &&
1435 _offset != 0 && _offset != arrayOopDesc::length_offset_in_bytes() &&
1436 _offset != arrayOopDesc::klass_offset_in_bytes()) {
1437 _is_ptr_to_narrowoop = true;
1438 }
1439
1440 }
1441 virtual bool eq( const Type *t ) const;
1442 virtual uint hash() const; // Type specific hashing
1443 const TypeAry *_ary; // Array we point into
1444 const bool _is_autobox_cache;
1445
1446 ciKlass* compute_klass() const;
1447
1448 // A pointer to delay allocation to Type::Initialize_shared()
1449
1450 static const TypeInterfaces* _array_interfaces;
1451 ciKlass* exact_klass_helper() const;
1452 // Only guaranteed non null for array of basic types
1453 ciKlass* klass() const;
1454
1455 public:
1456
|
178 const Type *meet_helper(const Type *t, bool include_speculative) const;
179 void check_symmetrical(const Type* t, const Type* mt, const VerifyMeet& verify) const NOT_DEBUG_RETURN;
180
181 protected:
182 // Each class of type is also identified by its base.
183 const TYPES _base; // Enum of Types type
184
185 Type( TYPES t ) : _dual(nullptr), _base(t) {} // Simple types
186 // ~Type(); // Use fast deallocation
187 const Type *hashcons(); // Hash-cons the type
188 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
189 const Type *join_helper(const Type *t, bool include_speculative) const {
190 assert_type_verify_empty();
191 return dual()->meet_helper(t->dual(), include_speculative)->dual();
192 }
193
194 void assert_type_verify_empty() const NOT_DEBUG_RETURN;
195
196 public:
197
198 // This is used as a marker to identify narrow Klass* loads, which
199 // are really extracted from the mark-word, but we still want to
200 // distinguish it.
201 static int klass_offset() {
202 if (UseCompactObjectHeaders) {
203 return 1;
204 } else {
205 return oopDesc::klass_offset_in_bytes();
206 }
207 }
208
209 inline void* operator new( size_t x ) throw() {
210 Compile* compile = Compile::current();
211 compile->set_type_last_size(x);
212 return compile->type_arena()->AmallocWords(x);
213 }
214 inline void operator delete( void* ptr ) {
215 Compile* compile = Compile::current();
216 compile->type_arena()->Afree(ptr,compile->type_last_size());
217 }
218
219 // Initialize the type system for a particular compilation.
220 static void Initialize(Compile* compile);
221
222 // Initialize the types shared by all compilations.
223 static void Initialize_shared(Compile* compile);
224
225 TYPES base() const {
226 assert(_base > Bad && _base < lastype, "sanity");
227 return _base;
228 }
1427 };
1428
1429 //------------------------------TypeAryPtr-------------------------------------
1430 // Class of Java array pointers
1431 class TypeAryPtr : public TypeOopPtr {
1432 friend class Type;
1433 friend class TypePtr;
1434
1435 TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk,
1436 int offset, int instance_id, bool is_autobox_cache,
1437 const TypePtr* speculative, int inline_depth)
1438 : TypeOopPtr(AryPtr,ptr,k,_array_interfaces,xk,o,offset, instance_id, speculative, inline_depth),
1439 _ary(ary),
1440 _is_autobox_cache(is_autobox_cache)
1441 {
1442 int dummy;
1443 bool top_or_bottom = (base_element_type(dummy) == Type::TOP || base_element_type(dummy) == Type::BOTTOM);
1444
1445 if (UseCompressedOops && (elem()->make_oopptr() != nullptr && !top_or_bottom) &&
1446 _offset != 0 && _offset != arrayOopDesc::length_offset_in_bytes() &&
1447 _offset != Type::klass_offset()) {
1448 _is_ptr_to_narrowoop = true;
1449 }
1450
1451 }
1452 virtual bool eq( const Type *t ) const;
1453 virtual uint hash() const; // Type specific hashing
1454 const TypeAry *_ary; // Array we point into
1455 const bool _is_autobox_cache;
1456
1457 ciKlass* compute_klass() const;
1458
1459 // A pointer to delay allocation to Type::Initialize_shared()
1460
1461 static const TypeInterfaces* _array_interfaces;
1462 ciKlass* exact_klass_helper() const;
1463 // Only guaranteed non null for array of basic types
1464 ciKlass* klass() const;
1465
1466 public:
1467
|