--- old/src/share/vm/opto/type.hpp Sat Jun 2 20:04:22 2012 +++ new/src/share/vm/opto/type.hpp Sat Jun 2 20:04:22 2012 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,11 @@ class TypeNarrowOop; class TypeAry; class TypeTuple; +class TypeVect; +class TypeVectS; +class TypeVectD; +class TypeVectX; +class TypeVectY; class TypePtr; class TypeRawPtr; class TypeOopPtr; @@ -78,6 +83,10 @@ Tuple, // Method signature or object layout Array, // Array types + VectorS, // 32bit Vector types + VectorD, // 64bit Vector types + VectorX, // 128bit Vector types + VectorY, // 256bit Vector types AnyPtr, // Any old raw, klass, inst, or array pointer RawPtr, // Raw (non-oop) pointers @@ -222,6 +231,8 @@ const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer const TypeAry *is_ary() const; // Array, NOT array pointer + const TypeVect *is_vect() const; // Vector + const TypeVect *isa_vect() const; // Returns NULL if not a Vector const TypePtr *is_ptr() const; // Asserts it is a ptr type const TypePtr *isa_ptr() const; // Returns NULL if not ptr type const TypeRawPtr *isa_rawptr() const; // NOT Java oop @@ -574,6 +585,69 @@ #endif }; +//------------------------------TypeVect--------------------------------------- +// Class of Vector Types +class TypeVect : public Type { + const Type* _elem; // Vector's element type + const uint _length; // Elements in vector (power of 2) + +protected: + TypeVect(TYPES t, const Type* elem, uint length) : Type(t), + _elem(elem), _length(length) {} + +public: + const Type* element_type() const { return _elem; } + BasicType element_basic_type() const { return _elem->array_element_basic_type(); } + uint length() const { return _length; } + uint length_in_bytes() const { + return _length * type2aelembytes(element_basic_type()); + } + + virtual bool eq(const Type *t) const; + virtual int hash() const; // Type specific hashing + virtual bool singleton(void) const; // TRUE if type is a singleton + virtual bool empty(void) const; // TRUE if type is vacuous + + static const TypeVect *make(const BasicType elem_bt, uint length) { + // Use bottom primitive type. + return make(get_const_basic_type(elem_bt), length); + } + // Used directly by Replicate nodes to construct singleton vector. + static const TypeVect *make(const Type* elem, uint length); + + virtual const Type *xmeet( const Type *t) const; + virtual const Type *xdual() const; // Compute dual right now. + + static const TypeVect *VECTS; + static const TypeVect *VECTD; + static const TypeVect *VECTX; + static const TypeVect *VECTY; + +#ifndef PRODUCT + virtual void dump2(Dict &d, uint, outputStream *st) const; // Specialized per-Type dumping +#endif +}; + +class TypeVectS : public TypeVect { + friend class TypeVect; + TypeVectS(const Type* elem, uint length) : TypeVect(VectorS, elem, length) {} +}; + +class TypeVectD : public TypeVect { + friend class TypeVect; + TypeVectD(const Type* elem, uint length) : TypeVect(VectorD, elem, length) {} +}; + +class TypeVectX : public TypeVect { + friend class TypeVect; + TypeVectX(const Type* elem, uint length) : TypeVect(VectorX, elem, length) {} +}; + +class TypeVectY : public TypeVect { + friend class TypeVect; + TypeVectY(const Type* elem, uint length) : TypeVect(VectorY, elem, length) {} +}; + //------------------------------TypePtr---------------------------------------- // Class of machine Pointer Types: raw data, instances or arrays. // If the _base enum is AnyPtr, then this refers to all of the above. @@ -1113,6 +1187,15 @@ return (TypeAry*)this; } +inline const TypeVect *Type::is_vect() const { + assert( _base >= VectorS && _base <= VectorY, "Not a Vector" ); + return (TypeVect*)this; +} + +inline const TypeVect *Type::isa_vect() const { + return (_base >= VectorS && _base <= VectorY) ? (TypeVect*)this : NULL; +} + inline const TypePtr *Type::is_ptr() const { // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer");