1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
76 Half, // Placeholder half of doubleword |
81 Half, // Placeholder half of doubleword |
77 NarrowOop, // Compressed oop pointer |
82 NarrowOop, // Compressed oop pointer |
78 |
83 |
79 Tuple, // Method signature or object layout |
84 Tuple, // Method signature or object layout |
80 Array, // Array types |
85 Array, // Array types |
|
86 VectorS, // 32bit Vector types |
|
87 VectorD, // 64bit Vector types |
|
88 VectorX, // 128bit Vector types |
|
89 VectorY, // 256bit Vector types |
81 |
90 |
82 AnyPtr, // Any old raw, klass, inst, or array pointer |
91 AnyPtr, // Any old raw, klass, inst, or array pointer |
83 RawPtr, // Raw (non-oop) pointers |
92 RawPtr, // Raw (non-oop) pointers |
84 OopPtr, // Any and all Java heap entities |
93 OopPtr, // Any and all Java heap entities |
85 InstPtr, // Instance pointers (non-array objects) |
94 InstPtr, // Instance pointers (non-array objects) |
220 const TypeD *isa_double_constant() const; // Returns NULL if not a DoubleCon |
229 const TypeD *isa_double_constant() const; // Returns NULL if not a DoubleCon |
221 const TypeF *is_float_constant() const; // Asserts it is a FloatCon |
230 const TypeF *is_float_constant() const; // Asserts it is a FloatCon |
222 const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon |
231 const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon |
223 const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer |
232 const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer |
224 const TypeAry *is_ary() const; // Array, NOT array pointer |
233 const TypeAry *is_ary() const; // Array, NOT array pointer |
|
234 const TypeVect *is_vect() const; // Vector |
|
235 const TypeVect *isa_vect() const; // Returns NULL if not a Vector |
225 const TypePtr *is_ptr() const; // Asserts it is a ptr type |
236 const TypePtr *is_ptr() const; // Asserts it is a ptr type |
226 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type |
237 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type |
227 const TypeRawPtr *isa_rawptr() const; // NOT Java oop |
238 const TypeRawPtr *isa_rawptr() const; // NOT Java oop |
228 const TypeRawPtr *is_rawptr() const; // Asserts is rawptr |
239 const TypeRawPtr *is_rawptr() const; // Asserts is rawptr |
229 const TypeNarrowOop *is_narrowoop() const; // Java-style GC'd pointer |
240 const TypeNarrowOop *is_narrowoop() const; // Java-style GC'd pointer |
572 #ifndef PRODUCT |
583 #ifndef PRODUCT |
573 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping |
584 virtual void dump2( Dict &d, uint, outputStream *st ) const; // Specialized per-Type dumping |
574 #endif |
585 #endif |
575 }; |
586 }; |
576 |
587 |
|
588 //------------------------------TypeVect--------------------------------------- |
|
589 // Class of Vector Types |
|
590 class TypeVect : public Type { |
|
591 const Type* _elem; // Vector's element type |
|
592 const uint _length; // Elements in vector (power of 2) |
|
593 |
|
594 protected: |
|
595 TypeVect(TYPES t, const Type* elem, uint length) : Type(t), |
|
596 _elem(elem), _length(length) {} |
|
597 |
|
598 public: |
|
599 const Type* element_type() const { return _elem; } |
|
600 BasicType element_basic_type() const { return _elem->array_element_basic_type(); } |
|
601 uint length() const { return _length; } |
|
602 uint length_in_bytes() const { |
|
603 return _length * type2aelembytes(element_basic_type()); |
|
604 } |
|
605 |
|
606 virtual bool eq(const Type *t) const; |
|
607 virtual int hash() const; // Type specific hashing |
|
608 virtual bool singleton(void) const; // TRUE if type is a singleton |
|
609 virtual bool empty(void) const; // TRUE if type is vacuous |
|
610 |
|
611 static const TypeVect *make(const BasicType elem_bt, uint length) { |
|
612 // Use bottom primitive type. |
|
613 return make(get_const_basic_type(elem_bt), length); |
|
614 } |
|
615 // Used directly by Replicate nodes to construct singleton vector. |
|
616 static const TypeVect *make(const Type* elem, uint length); |
|
617 |
|
618 virtual const Type *xmeet( const Type *t) const; |
|
619 virtual const Type *xdual() const; // Compute dual right now. |
|
620 |
|
621 static const TypeVect *VECTS; |
|
622 static const TypeVect *VECTD; |
|
623 static const TypeVect *VECTX; |
|
624 static const TypeVect *VECTY; |
|
625 |
|
626 #ifndef PRODUCT |
|
627 virtual void dump2(Dict &d, uint, outputStream *st) const; // Specialized per-Type dumping |
|
628 #endif |
|
629 }; |
|
630 |
|
631 class TypeVectS : public TypeVect { |
|
632 friend class TypeVect; |
|
633 TypeVectS(const Type* elem, uint length) : TypeVect(VectorS, elem, length) {} |
|
634 }; |
|
635 |
|
636 class TypeVectD : public TypeVect { |
|
637 friend class TypeVect; |
|
638 TypeVectD(const Type* elem, uint length) : TypeVect(VectorD, elem, length) {} |
|
639 }; |
|
640 |
|
641 class TypeVectX : public TypeVect { |
|
642 friend class TypeVect; |
|
643 TypeVectX(const Type* elem, uint length) : TypeVect(VectorX, elem, length) {} |
|
644 }; |
|
645 |
|
646 class TypeVectY : public TypeVect { |
|
647 friend class TypeVect; |
|
648 TypeVectY(const Type* elem, uint length) : TypeVect(VectorY, elem, length) {} |
|
649 }; |
|
650 |
577 //------------------------------TypePtr---------------------------------------- |
651 //------------------------------TypePtr---------------------------------------- |
578 // Class of machine Pointer Types: raw data, instances or arrays. |
652 // Class of machine Pointer Types: raw data, instances or arrays. |
579 // If the _base enum is AnyPtr, then this refers to all of the above. |
653 // If the _base enum is AnyPtr, then this refers to all of the above. |
580 // Otherwise the _base will indicate which subset of pointers is affected, |
654 // Otherwise the _base will indicate which subset of pointers is affected, |
581 // and the class will be inherited from. |
655 // and the class will be inherited from. |
1109 } |
1183 } |
1110 |
1184 |
1111 inline const TypeAry *Type::is_ary() const { |
1185 inline const TypeAry *Type::is_ary() const { |
1112 assert( _base == Array , "Not an Array" ); |
1186 assert( _base == Array , "Not an Array" ); |
1113 return (TypeAry*)this; |
1187 return (TypeAry*)this; |
|
1188 } |
|
1189 |
|
1190 inline const TypeVect *Type::is_vect() const { |
|
1191 assert( _base >= VectorS && _base <= VectorY, "Not a Vector" ); |
|
1192 return (TypeVect*)this; |
|
1193 } |
|
1194 |
|
1195 inline const TypeVect *Type::isa_vect() const { |
|
1196 return (_base >= VectorS && _base <= VectorY) ? (TypeVect*)this : NULL; |
1114 } |
1197 } |
1115 |
1198 |
1116 inline const TypePtr *Type::is_ptr() const { |
1199 inline const TypePtr *Type::is_ptr() const { |
1117 // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. |
1200 // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. |
1118 assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer"); |
1201 assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer"); |