1.1 --- a/src/share/vm/opto/type.hpp Thu Jun 14 14:59:52 2012 -0700 1.2 +++ b/src/share/vm/opto/type.hpp Fri Jun 15 01:25:19 2012 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -51,6 +51,11 @@ 1.11 class TypeNarrowOop; 1.12 class TypeAry; 1.13 class TypeTuple; 1.14 +class TypeVect; 1.15 +class TypeVectS; 1.16 +class TypeVectD; 1.17 +class TypeVectX; 1.18 +class TypeVectY; 1.19 class TypePtr; 1.20 class TypeRawPtr; 1.21 class TypeOopPtr; 1.22 @@ -78,6 +83,10 @@ 1.23 1.24 Tuple, // Method signature or object layout 1.25 Array, // Array types 1.26 + VectorS, // 32bit Vector types 1.27 + VectorD, // 64bit Vector types 1.28 + VectorX, // 128bit Vector types 1.29 + VectorY, // 256bit Vector types 1.30 1.31 AnyPtr, // Any old raw, klass, inst, or array pointer 1.32 RawPtr, // Raw (non-oop) pointers 1.33 @@ -222,6 +231,8 @@ 1.34 const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon 1.35 const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer 1.36 const TypeAry *is_ary() const; // Array, NOT array pointer 1.37 + const TypeVect *is_vect() const; // Vector 1.38 + const TypeVect *isa_vect() const; // Returns NULL if not a Vector 1.39 const TypePtr *is_ptr() const; // Asserts it is a ptr type 1.40 const TypePtr *isa_ptr() const; // Returns NULL if not ptr type 1.41 const TypeRawPtr *isa_rawptr() const; // NOT Java oop 1.42 @@ -574,6 +585,69 @@ 1.43 #endif 1.44 }; 1.45 1.46 +//------------------------------TypeVect--------------------------------------- 1.47 +// Class of Vector Types 1.48 +class TypeVect : public Type { 1.49 + const Type* _elem; // Vector's element type 1.50 + const uint _length; // Elements in vector (power of 2) 1.51 + 1.52 +protected: 1.53 + TypeVect(TYPES t, const Type* elem, uint length) : Type(t), 1.54 + _elem(elem), _length(length) {} 1.55 + 1.56 +public: 1.57 + const Type* element_type() const { return _elem; } 1.58 + BasicType element_basic_type() const { return _elem->array_element_basic_type(); } 1.59 + uint length() const { return _length; } 1.60 + uint length_in_bytes() const { 1.61 + return _length * type2aelembytes(element_basic_type()); 1.62 + } 1.63 + 1.64 + virtual bool eq(const Type *t) const; 1.65 + virtual int hash() const; // Type specific hashing 1.66 + virtual bool singleton(void) const; // TRUE if type is a singleton 1.67 + virtual bool empty(void) const; // TRUE if type is vacuous 1.68 + 1.69 + static const TypeVect *make(const BasicType elem_bt, uint length) { 1.70 + // Use bottom primitive type. 1.71 + return make(get_const_basic_type(elem_bt), length); 1.72 + } 1.73 + // Used directly by Replicate nodes to construct singleton vector. 1.74 + static const TypeVect *make(const Type* elem, uint length); 1.75 + 1.76 + virtual const Type *xmeet( const Type *t) const; 1.77 + virtual const Type *xdual() const; // Compute dual right now. 1.78 + 1.79 + static const TypeVect *VECTS; 1.80 + static const TypeVect *VECTD; 1.81 + static const TypeVect *VECTX; 1.82 + static const TypeVect *VECTY; 1.83 + 1.84 +#ifndef PRODUCT 1.85 + virtual void dump2(Dict &d, uint, outputStream *st) const; // Specialized per-Type dumping 1.86 +#endif 1.87 +}; 1.88 + 1.89 +class TypeVectS : public TypeVect { 1.90 + friend class TypeVect; 1.91 + TypeVectS(const Type* elem, uint length) : TypeVect(VectorS, elem, length) {} 1.92 +}; 1.93 + 1.94 +class TypeVectD : public TypeVect { 1.95 + friend class TypeVect; 1.96 + TypeVectD(const Type* elem, uint length) : TypeVect(VectorD, elem, length) {} 1.97 +}; 1.98 + 1.99 +class TypeVectX : public TypeVect { 1.100 + friend class TypeVect; 1.101 + TypeVectX(const Type* elem, uint length) : TypeVect(VectorX, elem, length) {} 1.102 +}; 1.103 + 1.104 +class TypeVectY : public TypeVect { 1.105 + friend class TypeVect; 1.106 + TypeVectY(const Type* elem, uint length) : TypeVect(VectorY, elem, length) {} 1.107 +}; 1.108 + 1.109 //------------------------------TypePtr---------------------------------------- 1.110 // Class of machine Pointer Types: raw data, instances or arrays. 1.111 // If the _base enum is AnyPtr, then this refers to all of the above. 1.112 @@ -1113,6 +1187,15 @@ 1.113 return (TypeAry*)this; 1.114 } 1.115 1.116 +inline const TypeVect *Type::is_vect() const { 1.117 + assert( _base >= VectorS && _base <= VectorY, "Not a Vector" ); 1.118 + return (TypeVect*)this; 1.119 +} 1.120 + 1.121 +inline const TypeVect *Type::isa_vect() const { 1.122 + return (_base >= VectorS && _base <= VectorY) ? (TypeVect*)this : NULL; 1.123 +} 1.124 + 1.125 inline const TypePtr *Type::is_ptr() const { 1.126 // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. 1.127 assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer");