355 static const Type *BOTTOM;
356 static const Type *CONTROL;
357 static const Type *DOUBLE;
358 static const Type *FLOAT;
359 static const Type *HALF;
360 static const Type *MEMORY;
361 static const Type *MULTI;
362 static const Type *RETURN_ADDRESS;
363 static const Type *TOP;
364
365 // Mapping from compiler type to VM BasicType
366 BasicType basic_type() const { return _type_info[_base].basic_type; }
367 int ideal_reg() const { return _type_info[_base].ideal_reg; }
368 const char* msg() const { return _type_info[_base].msg; }
369 bool isa_oop_ptr() const { return _type_info[_base].isa_oop; }
370 relocInfo::relocType reloc() const { return _type_info[_base].reloc; }
371
372 // Mapping from CI type system to compiler type:
373 static const Type* get_typeflow_type(ciType* type);
374
375 private:
376 // support arrays
377 static const BasicType _basic_type[];
378 static const Type* _zero_type[T_CONFLICT+1];
379 static const Type* _const_basic_type[T_CONFLICT+1];
380 };
381
382 //------------------------------TypeF------------------------------------------
383 // Class of Float-Constant Types.
384 class TypeF : public Type {
385 TypeF( float f ) : Type(FloatCon), _f(f) {};
386 public:
387 virtual bool eq( const Type *t ) const;
388 virtual int hash() const; // Type specific hashing
389 virtual bool singleton(void) const; // TRUE if type is a singleton
390 virtual bool empty(void) const; // TRUE if type is vacuous
391 public:
392 const float _f; // Float constant
393
394 static const TypeF *make(float f);
571 virtual const Type *xdual() const; // Compute dual right now.
572 // Convenience common pre-built types.
573 static const TypeTuple *IFBOTH;
574 static const TypeTuple *IFFALSE;
575 static const TypeTuple *IFTRUE;
576 static const TypeTuple *IFNEITHER;
577 static const TypeTuple *LOOPBODY;
578 static const TypeTuple *MEMBAR;
579 static const TypeTuple *STORECONDITIONAL;
580 static const TypeTuple *START_I2C;
581 static const TypeTuple *INT_PAIR;
582 static const TypeTuple *LONG_PAIR;
583 #ifndef PRODUCT
584 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
585 #endif
586 };
587
588 //------------------------------TypeAry----------------------------------------
589 // Class of Array Types
590 class TypeAry : public Type {
591 TypeAry( const Type *elem, const TypeInt *size) : Type(Array),
592 _elem(elem), _size(size) {}
593 public:
594 virtual bool eq( const Type *t ) const;
595 virtual int hash() const; // Type specific hashing
596 virtual bool singleton(void) const; // TRUE if type is a singleton
597 virtual bool empty(void) const; // TRUE if type is vacuous
598
599 private:
600 const Type *_elem; // Element type of array
601 const TypeInt *_size; // Elements in array
602 friend class TypeAryPtr;
603
604 public:
605 static const TypeAry *make( const Type *elem, const TypeInt *size);
606
607 virtual const Type *xmeet( const Type *t ) const;
608 virtual const Type *xdual() const; // Compute dual right now.
609 bool ary_must_be_exact() const; // true if arrays of such are never generic
610 #ifdef ASSERT
611 // One type is interface, the other is oop
612 virtual bool interface_vs_oop(const Type *t) const;
613 #endif
614 #ifndef PRODUCT
615 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
616 #endif
617 };
618
619 //------------------------------TypeVect---------------------------------------
620 // Class of Vector Types
621 class TypeVect : public Type {
622 const Type* _elem; // Vector's element type
623 const uint _length; // Elements in vector (power of 2)
624
625 protected:
971 else tty->print("<NULL>");
972 tty->cr();
973 assert(false, "unexpected TypeAryPtr::_klass");
974 }
975 }
976 #endif
977 }
978 virtual bool eq( const Type *t ) const;
979 virtual int hash() const; // Type specific hashing
980 const TypeAry *_ary; // Array we point into
981 const bool _is_autobox_cache;
982
983 ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const;
984
985 public:
986 // Accessors
987 ciKlass* klass() const;
988 const TypeAry* ary() const { return _ary; }
989 const Type* elem() const { return _ary->_elem; }
990 const TypeInt* size() const { return _ary->_size; }
991
992 bool is_autobox_cache() const { return _is_autobox_cache; }
993
994 static const TypeAryPtr *make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot);
995 // Constant pointer to array
996 static const TypeAryPtr *make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot, bool is_autobox_cache = false);
997
998 // Return a 'ptr' version of this type
999 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1000
1001 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1002
1003 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1004
1005 virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
1006 virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
1007
1008 virtual bool empty(void) const; // TRUE if type is vacuous
1009 virtual const TypePtr *add_offset( intptr_t offset ) const;
1010
1011 virtual const Type *xmeet( const Type *t ) const;
1012 virtual const Type *xdual() const; // Compute dual right now.
1013
1014 // Convenience common pre-built types.
1015 static const TypeAryPtr *RANGE;
1016 static const TypeAryPtr *OOPS;
1017 static const TypeAryPtr *NARROWOOPS;
1018 static const TypeAryPtr *BYTES;
1019 static const TypeAryPtr *SHORTS;
1020 static const TypeAryPtr *CHARS;
1021 static const TypeAryPtr *INTS;
1022 static const TypeAryPtr *LONGS;
1023 static const TypeAryPtr *FLOATS;
1024 static const TypeAryPtr *DOUBLES;
1025 // selects one of the above:
1026 static const TypeAryPtr *get_array_body_type(BasicType elem) {
1027 assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != NULL, "bad elem type");
1028 return _array_body_type[elem];
1029 }
1030 static const TypeAryPtr *_array_body_type[T_CONFLICT+1];
1031 // sharpen the type of an int which is used as an array size
1032 #ifdef ASSERT
1033 // One type is interface, the other is oop
|
355 static const Type *BOTTOM;
356 static const Type *CONTROL;
357 static const Type *DOUBLE;
358 static const Type *FLOAT;
359 static const Type *HALF;
360 static const Type *MEMORY;
361 static const Type *MULTI;
362 static const Type *RETURN_ADDRESS;
363 static const Type *TOP;
364
365 // Mapping from compiler type to VM BasicType
366 BasicType basic_type() const { return _type_info[_base].basic_type; }
367 int ideal_reg() const { return _type_info[_base].ideal_reg; }
368 const char* msg() const { return _type_info[_base].msg; }
369 bool isa_oop_ptr() const { return _type_info[_base].isa_oop; }
370 relocInfo::relocType reloc() const { return _type_info[_base].reloc; }
371
372 // Mapping from CI type system to compiler type:
373 static const Type* get_typeflow_type(ciType* type);
374
375 static const Type* make_from_constant(ciConstant constant,
376 bool require_constant = false,
377 bool is_autobox_cache = false);
378
379 private:
380 // support arrays
381 static const BasicType _basic_type[];
382 static const Type* _zero_type[T_CONFLICT+1];
383 static const Type* _const_basic_type[T_CONFLICT+1];
384 };
385
386 //------------------------------TypeF------------------------------------------
387 // Class of Float-Constant Types.
388 class TypeF : public Type {
389 TypeF( float f ) : Type(FloatCon), _f(f) {};
390 public:
391 virtual bool eq( const Type *t ) const;
392 virtual int hash() const; // Type specific hashing
393 virtual bool singleton(void) const; // TRUE if type is a singleton
394 virtual bool empty(void) const; // TRUE if type is vacuous
395 public:
396 const float _f; // Float constant
397
398 static const TypeF *make(float f);
575 virtual const Type *xdual() const; // Compute dual right now.
576 // Convenience common pre-built types.
577 static const TypeTuple *IFBOTH;
578 static const TypeTuple *IFFALSE;
579 static const TypeTuple *IFTRUE;
580 static const TypeTuple *IFNEITHER;
581 static const TypeTuple *LOOPBODY;
582 static const TypeTuple *MEMBAR;
583 static const TypeTuple *STORECONDITIONAL;
584 static const TypeTuple *START_I2C;
585 static const TypeTuple *INT_PAIR;
586 static const TypeTuple *LONG_PAIR;
587 #ifndef PRODUCT
588 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
589 #endif
590 };
591
592 //------------------------------TypeAry----------------------------------------
593 // Class of Array Types
594 class TypeAry : public Type {
595 TypeAry(const Type* elem, const TypeInt* size, bool stable) : Type(Array),
596 _elem(elem), _size(size), _stable(stable) {}
597 public:
598 virtual bool eq( const Type *t ) const;
599 virtual int hash() const; // Type specific hashing
600 virtual bool singleton(void) const; // TRUE if type is a singleton
601 virtual bool empty(void) const; // TRUE if type is vacuous
602
603 private:
604 const Type *_elem; // Element type of array
605 const TypeInt *_size; // Elements in array
606 const bool _stable; // Are elements @Stable?
607 friend class TypeAryPtr;
608
609 public:
610 static const TypeAry* make(const Type* elem, const TypeInt* size, bool stable = false);
611
612 virtual const Type *xmeet( const Type *t ) const;
613 virtual const Type *xdual() const; // Compute dual right now.
614 bool ary_must_be_exact() const; // true if arrays of such are never generic
615 #ifdef ASSERT
616 // One type is interface, the other is oop
617 virtual bool interface_vs_oop(const Type *t) const;
618 #endif
619 #ifndef PRODUCT
620 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping
621 #endif
622 };
623
624 //------------------------------TypeVect---------------------------------------
625 // Class of Vector Types
626 class TypeVect : public Type {
627 const Type* _elem; // Vector's element type
628 const uint _length; // Elements in vector (power of 2)
629
630 protected:
976 else tty->print("<NULL>");
977 tty->cr();
978 assert(false, "unexpected TypeAryPtr::_klass");
979 }
980 }
981 #endif
982 }
983 virtual bool eq( const Type *t ) const;
984 virtual int hash() const; // Type specific hashing
985 const TypeAry *_ary; // Array we point into
986 const bool _is_autobox_cache;
987
988 ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const;
989
990 public:
991 // Accessors
992 ciKlass* klass() const;
993 const TypeAry* ary() const { return _ary; }
994 const Type* elem() const { return _ary->_elem; }
995 const TypeInt* size() const { return _ary->_size; }
996 bool is_stable() const { return _ary->_stable; }
997
998 bool is_autobox_cache() const { return _is_autobox_cache; }
999
1000 static const TypeAryPtr *make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot);
1001 // Constant pointer to array
1002 static const TypeAryPtr *make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot, bool is_autobox_cache = false);
1003
1004 // Return a 'ptr' version of this type
1005 virtual const Type *cast_to_ptr_type(PTR ptr) const;
1006
1007 virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1008
1009 virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1010
1011 virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
1012 virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
1013
1014 virtual bool empty(void) const; // TRUE if type is vacuous
1015 virtual const TypePtr *add_offset( intptr_t offset ) const;
1016
1017 virtual const Type *xmeet( const Type *t ) const;
1018 virtual const Type *xdual() const; // Compute dual right now.
1019
1020 const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
1021 int stable_dimension() const;
1022
1023 // Convenience common pre-built types.
1024 static const TypeAryPtr *RANGE;
1025 static const TypeAryPtr *OOPS;
1026 static const TypeAryPtr *NARROWOOPS;
1027 static const TypeAryPtr *BYTES;
1028 static const TypeAryPtr *SHORTS;
1029 static const TypeAryPtr *CHARS;
1030 static const TypeAryPtr *INTS;
1031 static const TypeAryPtr *LONGS;
1032 static const TypeAryPtr *FLOATS;
1033 static const TypeAryPtr *DOUBLES;
1034 // selects one of the above:
1035 static const TypeAryPtr *get_array_body_type(BasicType elem) {
1036 assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != NULL, "bad elem type");
1037 return _array_body_type[elem];
1038 }
1039 static const TypeAryPtr *_array_body_type[T_CONFLICT+1];
1040 // sharpen the type of an int which is used as an array size
1041 #ifdef ASSERT
1042 // One type is interface, the other is oop
|