57 { Bad, T_LONG, "long:", false, Op_RegL, relocInfo::none }, // Long
58 { Half, T_VOID, "half", false, 0, relocInfo::none }, // Half
59 { Bad, T_NARROWOOP, "narrowoop:", false, Op_RegN, relocInfo::none }, // NarrowOop
60 { Bad, T_NARROWKLASS,"narrowklass:", false, Op_RegN, relocInfo::none }, // NarrowKlass
61 { Bad, T_ILLEGAL, "tuple:", false, Node::NotAMachineReg, relocInfo::none }, // Tuple
62 { Bad, T_ARRAY, "array:", false, Node::NotAMachineReg, relocInfo::none }, // Array
63
64 #if defined(PPC64)
65 { Bad, T_ILLEGAL, "vectors:", false, 0, relocInfo::none }, // VectorS
66 { Bad, T_ILLEGAL, "vectord:", false, Op_RegL, relocInfo::none }, // VectorD
67 { Bad, T_ILLEGAL, "vectorx:", false, Op_VecX, relocInfo::none }, // VectorX
68 { Bad, T_ILLEGAL, "vectory:", false, 0, relocInfo::none }, // VectorY
69 { Bad, T_ILLEGAL, "vectorz:", false, 0, relocInfo::none }, // VectorZ
70 #elif defined(S390)
71 { Bad, T_ILLEGAL, "vectors:", false, 0, relocInfo::none }, // VectorS
72 { Bad, T_ILLEGAL, "vectord:", false, Op_RegL, relocInfo::none }, // VectorD
73 { Bad, T_ILLEGAL, "vectorx:", false, 0, relocInfo::none }, // VectorX
74 { Bad, T_ILLEGAL, "vectory:", false, 0, relocInfo::none }, // VectorY
75 { Bad, T_ILLEGAL, "vectorz:", false, 0, relocInfo::none }, // VectorZ
76 #else // all other
77 { Bad, T_ILLEGAL, "vectors:", false, Op_VecS, relocInfo::none }, // VectorS
78 { Bad, T_ILLEGAL, "vectord:", false, Op_VecD, relocInfo::none }, // VectorD
79 { Bad, T_ILLEGAL, "vectorx:", false, Op_VecX, relocInfo::none }, // VectorX
80 { Bad, T_ILLEGAL, "vectory:", false, Op_VecY, relocInfo::none }, // VectorY
81 { Bad, T_ILLEGAL, "vectorz:", false, Op_VecZ, relocInfo::none }, // VectorZ
82 #endif
83 { Bad, T_ADDRESS, "anyptr:", false, Op_RegP, relocInfo::none }, // AnyPtr
84 { Bad, T_ADDRESS, "rawptr:", false, Op_RegP, relocInfo::none }, // RawPtr
85 { Bad, T_OBJECT, "oop:", true, Op_RegP, relocInfo::oop_type }, // OopPtr
86 { Bad, T_OBJECT, "inst:", true, Op_RegP, relocInfo::oop_type }, // InstPtr
87 { Bad, T_OBJECT, "ary:", true, Op_RegP, relocInfo::oop_type }, // AryPtr
88 { Bad, T_METADATA, "metadata:", false, Op_RegP, relocInfo::metadata_type }, // MetadataPtr
89 { Bad, T_METADATA, "klass:", false, Op_RegP, relocInfo::metadata_type }, // KlassPtr
90 { Bad, T_OBJECT, "func", false, 0, relocInfo::none }, // Function
91 { Abio, T_ILLEGAL, "abIO", false, 0, relocInfo::none }, // Abio
92 { Return_Address, T_ADDRESS, "return_address",false, Op_RegP, relocInfo::none }, // Return_Address
93 { Memory, T_ILLEGAL, "memory", false, 0, relocInfo::none }, // Memory
94 { FloatBot, T_FLOAT, "float_top", false, Op_RegF, relocInfo::none }, // FloatTop
95 { FloatCon, T_FLOAT, "ftcon:", false, Op_RegF, relocInfo::none }, // FloatCon
96 { FloatTop, T_FLOAT, "float", false, Op_RegF, relocInfo::none }, // FloatBot
629 _const_basic_type[T_CONFLICT] = Type::BOTTOM; // why not?
630
631 _zero_type[T_NARROWOOP] = TypeNarrowOop::NULL_PTR;
632 _zero_type[T_NARROWKLASS] = TypeNarrowKlass::NULL_PTR;
633 _zero_type[T_BOOLEAN] = TypeInt::ZERO; // false == 0
634 _zero_type[T_CHAR] = TypeInt::ZERO; // '\0' == 0
635 _zero_type[T_BYTE] = TypeInt::ZERO; // 0x00 == 0
636 _zero_type[T_SHORT] = TypeInt::ZERO; // 0x0000 == 0
637 _zero_type[T_INT] = TypeInt::ZERO;
638 _zero_type[T_LONG] = TypeLong::ZERO;
639 _zero_type[T_FLOAT] = TypeF::ZERO;
640 _zero_type[T_DOUBLE] = TypeD::ZERO;
641 _zero_type[T_OBJECT] = TypePtr::NULL_PTR;
642 _zero_type[T_ARRAY] = TypePtr::NULL_PTR; // null array is null oop
643 _zero_type[T_ADDRESS] = TypePtr::NULL_PTR; // raw pointers use the same null
644 _zero_type[T_VOID] = Type::TOP; // the only void value is no value at all
645
646 // get_zero_type() should not happen for T_CONFLICT
647 _zero_type[T_CONFLICT]= NULL;
648
649 // Vector predefined types, it needs initialized _const_basic_type[].
650 if (Matcher::vector_size_supported(T_BYTE,4)) {
651 TypeVect::VECTS = TypeVect::make(T_BYTE,4);
652 }
653 if (Matcher::vector_size_supported(T_FLOAT,2)) {
654 TypeVect::VECTD = TypeVect::make(T_FLOAT,2);
655 }
656 if (Matcher::vector_size_supported(T_FLOAT,4)) {
657 TypeVect::VECTX = TypeVect::make(T_FLOAT,4);
658 }
659 if (Matcher::vector_size_supported(T_FLOAT,8)) {
660 TypeVect::VECTY = TypeVect::make(T_FLOAT,8);
661 }
662 if (Matcher::vector_size_supported(T_FLOAT,16)) {
663 TypeVect::VECTZ = TypeVect::make(T_FLOAT,16);
664 }
665 mreg2type[Op_VecS] = TypeVect::VECTS;
666 mreg2type[Op_VecD] = TypeVect::VECTD;
667 mreg2type[Op_VecX] = TypeVect::VECTX;
668 mreg2type[Op_VecY] = TypeVect::VECTY;
669 mreg2type[Op_VecZ] = TypeVect::VECTZ;
670
671 // Restore working type arena.
672 current->set_type_arena(save);
673 current->set_type_dict(NULL);
674 }
675
676 //------------------------------Initialize-------------------------------------
677 void Type::Initialize(Compile* current) {
678 assert(current->type_arena() != NULL, "must have created type arena");
679
680 if (_shared_type_dict == NULL) {
681 Initialize_shared(current);
682 }
683
684 Arena* type_arena = current->type_arena();
964 const Type* ft = join_helper(kills, include_speculative);
965 if (ft->empty())
966 return Type::TOP; // Canonical empty value
967 return ft;
968 }
969
970 //------------------------------xdual------------------------------------------
971 // Compute dual right now.
972 const Type::TYPES Type::dual_type[Type::lastype] = {
973 Bad, // Bad
974 Control, // Control
975 Bottom, // Top
976 Bad, // Int - handled in v-call
977 Bad, // Long - handled in v-call
978 Half, // Half
979 Bad, // NarrowOop - handled in v-call
980 Bad, // NarrowKlass - handled in v-call
981
982 Bad, // Tuple - handled in v-call
983 Bad, // Array - handled in v-call
984 Bad, // VectorS - handled in v-call
985 Bad, // VectorD - handled in v-call
986 Bad, // VectorX - handled in v-call
987 Bad, // VectorY - handled in v-call
988 Bad, // VectorZ - handled in v-call
989
990 Bad, // AnyPtr - handled in v-call
991 Bad, // RawPtr - handled in v-call
992 Bad, // OopPtr - handled in v-call
993 Bad, // InstPtr - handled in v-call
994 Bad, // AryPtr - handled in v-call
995
996 Bad, // MetadataPtr - handled in v-call
997 Bad, // KlassPtr - handled in v-call
998
999 Bad, // Function - handled in v-call
1000 Abio, // Abio
1001 Return_Address,// Return_Address
1002 Memory, // Memory
1003 FloatBot, // FloatTop
1864
1865 bool TypeLong::empty(void) const {
1866 return _lo > _hi;
1867 }
1868
1869 //=============================================================================
1870 // Convenience common pre-built types.
1871 const TypeTuple *TypeTuple::IFBOTH; // Return both arms of IF as reachable
1872 const TypeTuple *TypeTuple::IFFALSE;
1873 const TypeTuple *TypeTuple::IFTRUE;
1874 const TypeTuple *TypeTuple::IFNEITHER;
1875 const TypeTuple *TypeTuple::LOOPBODY;
1876 const TypeTuple *TypeTuple::MEMBAR;
1877 const TypeTuple *TypeTuple::STORECONDITIONAL;
1878 const TypeTuple *TypeTuple::START_I2C;
1879 const TypeTuple *TypeTuple::INT_PAIR;
1880 const TypeTuple *TypeTuple::LONG_PAIR;
1881 const TypeTuple *TypeTuple::INT_CC_PAIR;
1882 const TypeTuple *TypeTuple::LONG_CC_PAIR;
1883
1884
1885 //------------------------------make-------------------------------------------
1886 // Make a TypeTuple from the range of a method signature
1887 const TypeTuple *TypeTuple::make_range(ciSignature* sig) {
1888 ciType* return_type = sig->return_type();
1889 uint arg_cnt = return_type->size();
1890 const Type **field_array = fields(arg_cnt);
1891 switch (return_type->basic_type()) {
1892 case T_LONG:
1893 field_array[TypeFunc::Parms] = TypeLong::LONG;
1894 field_array[TypeFunc::Parms+1] = Type::HALF;
1895 break;
1896 case T_DOUBLE:
1897 field_array[TypeFunc::Parms] = Type::DOUBLE;
1898 field_array[TypeFunc::Parms+1] = Type::HALF;
1899 break;
1900 case T_OBJECT:
1901 case T_ARRAY:
1902 case T_BOOLEAN:
1903 case T_CHAR:
1904 case T_FLOAT:
2235 if (!tklass->is_loaded()) return false; // unloaded class
2236 const TypeInstPtr* tinst;
2237 if (_elem->isa_narrowoop())
2238 tinst = _elem->make_ptr()->isa_instptr();
2239 else
2240 tinst = _elem->isa_instptr();
2241 if (tinst)
2242 return tklass->as_instance_klass()->is_final();
2243 const TypeAryPtr* tap;
2244 if (_elem->isa_narrowoop())
2245 tap = _elem->make_ptr()->isa_aryptr();
2246 else
2247 tap = _elem->isa_aryptr();
2248 if (tap)
2249 return tap->ary()->ary_must_be_exact();
2250 return false;
2251 }
2252
2253 //==============================TypeVect=======================================
2254 // Convenience common pre-built types.
2255 const TypeVect *TypeVect::VECTS = NULL; // 32-bit vectors
2256 const TypeVect *TypeVect::VECTD = NULL; // 64-bit vectors
2257 const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors
2258 const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors
2259 const TypeVect *TypeVect::VECTZ = NULL; // 512-bit vectors
2260
2261 //------------------------------make-------------------------------------------
2262 const TypeVect* TypeVect::make(const Type *elem, uint length) {
2263 BasicType elem_bt = elem->array_element_basic_type();
2264 assert(is_java_primitive(elem_bt), "only primitive types in vector");
2265 assert(length > 1 && is_power_of_2(length), "vector length is power of 2");
2266 assert(Matcher::vector_size_supported(elem_bt, length), "length in range");
2267 int size = length * type2aelembytes(elem_bt);
2268 switch (Matcher::vector_ideal_reg(size)) {
2269 case Op_VecS:
2270 return (TypeVect*)(new TypeVectS(elem, length))->hashcons();
2271 case Op_RegL:
2272 case Op_VecD:
2273 case Op_RegD:
2274 return (TypeVect*)(new TypeVectD(elem, length))->hashcons();
2275 case Op_VecX:
2276 return (TypeVect*)(new TypeVectX(elem, length))->hashcons();
2277 case Op_VecY:
2278 return (TypeVect*)(new TypeVectY(elem, length))->hashcons();
2279 case Op_VecZ:
2280 return (TypeVect*)(new TypeVectZ(elem, length))->hashcons();
2281 }
2282 ShouldNotReachHere();
2283 return NULL;
2284 }
2285
2286 //------------------------------meet-------------------------------------------
2287 // Compute the MEET of two types. It returns a new Type object.
2288 const Type *TypeVect::xmeet( const Type *t ) const {
2289 // Perform a fast test for common case; meeting the same types together.
2290 if( this == t ) return this; // Meeting same type-rep?
2291
2292 // Current "this->_base" is Vector
2293 switch (t->base()) { // switch on original type
2294
2295 case Bottom: // Ye Olde Default
2296 return t;
2297
2298 default: // All else is a mistake
2299 typerr(t);
2300
2301 case VectorS:
2302 case VectorD:
2303 case VectorX:
2304 case VectorY:
2305 case VectorZ: { // Meeting 2 vectors?
2306 const TypeVect* v = t->is_vect();
2307 assert( base() == v->base(), "");
2308 assert(length() == v->length(), "");
2309 assert(element_basic_type() == v->element_basic_type(), "");
2310 return TypeVect::make(_elem->xmeet(v->_elem), _length);
2311 }
2312 case Top:
2313 break;
2314 }
2315 return this;
2316 }
2317
2318 //------------------------------xdual------------------------------------------
2319 // Dual: compute field-by-field dual
2320 const Type *TypeVect::xdual() const {
2335 }
2336
2337 //------------------------------singleton--------------------------------------
2338 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple
2339 // constants (Ldi nodes). Vector is singleton if all elements are the same
2340 // constant value (when vector is created with Replicate code).
2341 bool TypeVect::singleton(void) const {
2342 // There is no Con node for vectors yet.
2343 // return _elem->singleton();
2344 return false;
2345 }
2346
2347 bool TypeVect::empty(void) const {
2348 return _elem->empty();
2349 }
2350
2351 //------------------------------dump2------------------------------------------
2352 #ifndef PRODUCT
2353 void TypeVect::dump2(Dict &d, uint depth, outputStream *st) const {
2354 switch (base()) {
2355 case VectorS:
2356 st->print("vectors["); break;
2357 case VectorD:
2358 st->print("vectord["); break;
2359 case VectorX:
2360 st->print("vectorx["); break;
2361 case VectorY:
2362 st->print("vectory["); break;
2363 case VectorZ:
2364 st->print("vectorz["); break;
2365 default:
2366 ShouldNotReachHere();
2367 }
2368 st->print("%d]:{", _length);
2369 _elem->dump2(d, depth, st);
2370 st->print("}");
2371 }
2372 #endif
2373
2374
|
57 { Bad, T_LONG, "long:", false, Op_RegL, relocInfo::none }, // Long
58 { Half, T_VOID, "half", false, 0, relocInfo::none }, // Half
59 { Bad, T_NARROWOOP, "narrowoop:", false, Op_RegN, relocInfo::none }, // NarrowOop
60 { Bad, T_NARROWKLASS,"narrowklass:", false, Op_RegN, relocInfo::none }, // NarrowKlass
61 { Bad, T_ILLEGAL, "tuple:", false, Node::NotAMachineReg, relocInfo::none }, // Tuple
62 { Bad, T_ARRAY, "array:", false, Node::NotAMachineReg, relocInfo::none }, // Array
63
64 #if defined(PPC64)
65 { Bad, T_ILLEGAL, "vectors:", false, 0, relocInfo::none }, // VectorS
66 { Bad, T_ILLEGAL, "vectord:", false, Op_RegL, relocInfo::none }, // VectorD
67 { Bad, T_ILLEGAL, "vectorx:", false, Op_VecX, relocInfo::none }, // VectorX
68 { Bad, T_ILLEGAL, "vectory:", false, 0, relocInfo::none }, // VectorY
69 { Bad, T_ILLEGAL, "vectorz:", false, 0, relocInfo::none }, // VectorZ
70 #elif defined(S390)
71 { Bad, T_ILLEGAL, "vectors:", false, 0, relocInfo::none }, // VectorS
72 { Bad, T_ILLEGAL, "vectord:", false, Op_RegL, relocInfo::none }, // VectorD
73 { Bad, T_ILLEGAL, "vectorx:", false, 0, relocInfo::none }, // VectorX
74 { Bad, T_ILLEGAL, "vectory:", false, 0, relocInfo::none }, // VectorY
75 { Bad, T_ILLEGAL, "vectorz:", false, 0, relocInfo::none }, // VectorZ
76 #else // all other
77 { Bad, T_ILLEGAL, "vectora:", false, Op_VecA, relocInfo::none }, // VectorA.
78 { Bad, T_ILLEGAL, "vectors:", false, Op_VecS, relocInfo::none }, // VectorS
79 { Bad, T_ILLEGAL, "vectord:", false, Op_VecD, relocInfo::none }, // VectorD
80 { Bad, T_ILLEGAL, "vectorx:", false, Op_VecX, relocInfo::none }, // VectorX
81 { Bad, T_ILLEGAL, "vectory:", false, Op_VecY, relocInfo::none }, // VectorY
82 { Bad, T_ILLEGAL, "vectorz:", false, Op_VecZ, relocInfo::none }, // VectorZ
83 #endif
84 { Bad, T_ADDRESS, "anyptr:", false, Op_RegP, relocInfo::none }, // AnyPtr
85 { Bad, T_ADDRESS, "rawptr:", false, Op_RegP, relocInfo::none }, // RawPtr
86 { Bad, T_OBJECT, "oop:", true, Op_RegP, relocInfo::oop_type }, // OopPtr
87 { Bad, T_OBJECT, "inst:", true, Op_RegP, relocInfo::oop_type }, // InstPtr
88 { Bad, T_OBJECT, "ary:", true, Op_RegP, relocInfo::oop_type }, // AryPtr
89 { Bad, T_METADATA, "metadata:", false, Op_RegP, relocInfo::metadata_type }, // MetadataPtr
90 { Bad, T_METADATA, "klass:", false, Op_RegP, relocInfo::metadata_type }, // KlassPtr
91 { Bad, T_OBJECT, "func", false, 0, relocInfo::none }, // Function
92 { Abio, T_ILLEGAL, "abIO", false, 0, relocInfo::none }, // Abio
93 { Return_Address, T_ADDRESS, "return_address",false, Op_RegP, relocInfo::none }, // Return_Address
94 { Memory, T_ILLEGAL, "memory", false, 0, relocInfo::none }, // Memory
95 { FloatBot, T_FLOAT, "float_top", false, Op_RegF, relocInfo::none }, // FloatTop
96 { FloatCon, T_FLOAT, "ftcon:", false, Op_RegF, relocInfo::none }, // FloatCon
97 { FloatTop, T_FLOAT, "float", false, Op_RegF, relocInfo::none }, // FloatBot
630 _const_basic_type[T_CONFLICT] = Type::BOTTOM; // why not?
631
632 _zero_type[T_NARROWOOP] = TypeNarrowOop::NULL_PTR;
633 _zero_type[T_NARROWKLASS] = TypeNarrowKlass::NULL_PTR;
634 _zero_type[T_BOOLEAN] = TypeInt::ZERO; // false == 0
635 _zero_type[T_CHAR] = TypeInt::ZERO; // '\0' == 0
636 _zero_type[T_BYTE] = TypeInt::ZERO; // 0x00 == 0
637 _zero_type[T_SHORT] = TypeInt::ZERO; // 0x0000 == 0
638 _zero_type[T_INT] = TypeInt::ZERO;
639 _zero_type[T_LONG] = TypeLong::ZERO;
640 _zero_type[T_FLOAT] = TypeF::ZERO;
641 _zero_type[T_DOUBLE] = TypeD::ZERO;
642 _zero_type[T_OBJECT] = TypePtr::NULL_PTR;
643 _zero_type[T_ARRAY] = TypePtr::NULL_PTR; // null array is null oop
644 _zero_type[T_ADDRESS] = TypePtr::NULL_PTR; // raw pointers use the same null
645 _zero_type[T_VOID] = Type::TOP; // the only void value is no value at all
646
647 // get_zero_type() should not happen for T_CONFLICT
648 _zero_type[T_CONFLICT]= NULL;
649
650 if (Matcher::supports_scalable_vector()) {
651 TypeVect::VECTA = TypeVect::make(T_BYTE, Matcher::scalable_vector_reg_size(T_BYTE));
652 }
653
654 // Vector predefined types, it needs initialized _const_basic_type[].
655 if (Matcher::vector_size_supported(T_BYTE,4)) {
656 TypeVect::VECTS = TypeVect::make(T_BYTE,4);
657 }
658 if (Matcher::vector_size_supported(T_FLOAT,2)) {
659 TypeVect::VECTD = TypeVect::make(T_FLOAT,2);
660 }
661 if (Matcher::vector_size_supported(T_FLOAT,4)) {
662 TypeVect::VECTX = TypeVect::make(T_FLOAT,4);
663 }
664 if (Matcher::vector_size_supported(T_FLOAT,8)) {
665 TypeVect::VECTY = TypeVect::make(T_FLOAT,8);
666 }
667 if (Matcher::vector_size_supported(T_FLOAT,16)) {
668 TypeVect::VECTZ = TypeVect::make(T_FLOAT,16);
669 }
670
671 mreg2type[Op_VecA] = TypeVect::VECTA;
672 mreg2type[Op_VecS] = TypeVect::VECTS;
673 mreg2type[Op_VecD] = TypeVect::VECTD;
674 mreg2type[Op_VecX] = TypeVect::VECTX;
675 mreg2type[Op_VecY] = TypeVect::VECTY;
676 mreg2type[Op_VecZ] = TypeVect::VECTZ;
677
678 // Restore working type arena.
679 current->set_type_arena(save);
680 current->set_type_dict(NULL);
681 }
682
683 //------------------------------Initialize-------------------------------------
684 void Type::Initialize(Compile* current) {
685 assert(current->type_arena() != NULL, "must have created type arena");
686
687 if (_shared_type_dict == NULL) {
688 Initialize_shared(current);
689 }
690
691 Arena* type_arena = current->type_arena();
971 const Type* ft = join_helper(kills, include_speculative);
972 if (ft->empty())
973 return Type::TOP; // Canonical empty value
974 return ft;
975 }
976
977 //------------------------------xdual------------------------------------------
978 // Compute dual right now.
979 const Type::TYPES Type::dual_type[Type::lastype] = {
980 Bad, // Bad
981 Control, // Control
982 Bottom, // Top
983 Bad, // Int - handled in v-call
984 Bad, // Long - handled in v-call
985 Half, // Half
986 Bad, // NarrowOop - handled in v-call
987 Bad, // NarrowKlass - handled in v-call
988
989 Bad, // Tuple - handled in v-call
990 Bad, // Array - handled in v-call
991 Bad, // VectorA - handled in v-call
992 Bad, // VectorS - handled in v-call
993 Bad, // VectorD - handled in v-call
994 Bad, // VectorX - handled in v-call
995 Bad, // VectorY - handled in v-call
996 Bad, // VectorZ - handled in v-call
997
998 Bad, // AnyPtr - handled in v-call
999 Bad, // RawPtr - handled in v-call
1000 Bad, // OopPtr - handled in v-call
1001 Bad, // InstPtr - handled in v-call
1002 Bad, // AryPtr - handled in v-call
1003
1004 Bad, // MetadataPtr - handled in v-call
1005 Bad, // KlassPtr - handled in v-call
1006
1007 Bad, // Function - handled in v-call
1008 Abio, // Abio
1009 Return_Address,// Return_Address
1010 Memory, // Memory
1011 FloatBot, // FloatTop
1872
1873 bool TypeLong::empty(void) const {
1874 return _lo > _hi;
1875 }
1876
1877 //=============================================================================
1878 // Convenience common pre-built types.
1879 const TypeTuple *TypeTuple::IFBOTH; // Return both arms of IF as reachable
1880 const TypeTuple *TypeTuple::IFFALSE;
1881 const TypeTuple *TypeTuple::IFTRUE;
1882 const TypeTuple *TypeTuple::IFNEITHER;
1883 const TypeTuple *TypeTuple::LOOPBODY;
1884 const TypeTuple *TypeTuple::MEMBAR;
1885 const TypeTuple *TypeTuple::STORECONDITIONAL;
1886 const TypeTuple *TypeTuple::START_I2C;
1887 const TypeTuple *TypeTuple::INT_PAIR;
1888 const TypeTuple *TypeTuple::LONG_PAIR;
1889 const TypeTuple *TypeTuple::INT_CC_PAIR;
1890 const TypeTuple *TypeTuple::LONG_CC_PAIR;
1891
1892 //------------------------------make-------------------------------------------
1893 // Make a TypeTuple from the range of a method signature
1894 const TypeTuple *TypeTuple::make_range(ciSignature* sig) {
1895 ciType* return_type = sig->return_type();
1896 uint arg_cnt = return_type->size();
1897 const Type **field_array = fields(arg_cnt);
1898 switch (return_type->basic_type()) {
1899 case T_LONG:
1900 field_array[TypeFunc::Parms] = TypeLong::LONG;
1901 field_array[TypeFunc::Parms+1] = Type::HALF;
1902 break;
1903 case T_DOUBLE:
1904 field_array[TypeFunc::Parms] = Type::DOUBLE;
1905 field_array[TypeFunc::Parms+1] = Type::HALF;
1906 break;
1907 case T_OBJECT:
1908 case T_ARRAY:
1909 case T_BOOLEAN:
1910 case T_CHAR:
1911 case T_FLOAT:
2242 if (!tklass->is_loaded()) return false; // unloaded class
2243 const TypeInstPtr* tinst;
2244 if (_elem->isa_narrowoop())
2245 tinst = _elem->make_ptr()->isa_instptr();
2246 else
2247 tinst = _elem->isa_instptr();
2248 if (tinst)
2249 return tklass->as_instance_klass()->is_final();
2250 const TypeAryPtr* tap;
2251 if (_elem->isa_narrowoop())
2252 tap = _elem->make_ptr()->isa_aryptr();
2253 else
2254 tap = _elem->isa_aryptr();
2255 if (tap)
2256 return tap->ary()->ary_must_be_exact();
2257 return false;
2258 }
2259
2260 //==============================TypeVect=======================================
2261 // Convenience common pre-built types.
2262 const TypeVect *TypeVect::VECTA = NULL; // vector length agnostic
2263 const TypeVect *TypeVect::VECTS = NULL; // 32-bit vectors
2264 const TypeVect *TypeVect::VECTD = NULL; // 64-bit vectors
2265 const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors
2266 const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors
2267 const TypeVect *TypeVect::VECTZ = NULL; // 512-bit vectors
2268
2269 //------------------------------make-------------------------------------------
2270 const TypeVect* TypeVect::make(const Type *elem, uint length) {
2271 BasicType elem_bt = elem->array_element_basic_type();
2272 assert(is_java_primitive(elem_bt), "only primitive types in vector");
2273 assert(Matcher::vector_size_supported(elem_bt, length), "length in range");
2274 int size = length * type2aelembytes(elem_bt);
2275 switch (Matcher::vector_ideal_reg(size)) {
2276 case Op_VecA:
2277 return (TypeVect*)(new TypeVectA(elem, length))->hashcons();
2278 case Op_VecS:
2279 return (TypeVect*)(new TypeVectS(elem, length))->hashcons();
2280 case Op_RegL:
2281 case Op_VecD:
2282 case Op_RegD:
2283 return (TypeVect*)(new TypeVectD(elem, length))->hashcons();
2284 case Op_VecX:
2285 return (TypeVect*)(new TypeVectX(elem, length))->hashcons();
2286 case Op_VecY:
2287 return (TypeVect*)(new TypeVectY(elem, length))->hashcons();
2288 case Op_VecZ:
2289 return (TypeVect*)(new TypeVectZ(elem, length))->hashcons();
2290 }
2291 ShouldNotReachHere();
2292 return NULL;
2293 }
2294
2295 //------------------------------meet-------------------------------------------
2296 // Compute the MEET of two types. It returns a new Type object.
2297 const Type *TypeVect::xmeet( const Type *t ) const {
2298 // Perform a fast test for common case; meeting the same types together.
2299 if( this == t ) return this; // Meeting same type-rep?
2300
2301 // Current "this->_base" is Vector
2302 switch (t->base()) { // switch on original type
2303
2304 case Bottom: // Ye Olde Default
2305 return t;
2306
2307 default: // All else is a mistake
2308 typerr(t);
2309 case VectorA:
2310 case VectorS:
2311 case VectorD:
2312 case VectorX:
2313 case VectorY:
2314 case VectorZ: { // Meeting 2 vectors?
2315 const TypeVect* v = t->is_vect();
2316 assert( base() == v->base(), "");
2317 assert(length() == v->length(), "");
2318 assert(element_basic_type() == v->element_basic_type(), "");
2319 return TypeVect::make(_elem->xmeet(v->_elem), _length);
2320 }
2321 case Top:
2322 break;
2323 }
2324 return this;
2325 }
2326
2327 //------------------------------xdual------------------------------------------
2328 // Dual: compute field-by-field dual
2329 const Type *TypeVect::xdual() const {
2344 }
2345
2346 //------------------------------singleton--------------------------------------
2347 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple
2348 // constants (Ldi nodes). Vector is singleton if all elements are the same
2349 // constant value (when vector is created with Replicate code).
2350 bool TypeVect::singleton(void) const {
2351 // There is no Con node for vectors yet.
2352 // return _elem->singleton();
2353 return false;
2354 }
2355
2356 bool TypeVect::empty(void) const {
2357 return _elem->empty();
2358 }
2359
2360 //------------------------------dump2------------------------------------------
2361 #ifndef PRODUCT
2362 void TypeVect::dump2(Dict &d, uint depth, outputStream *st) const {
2363 switch (base()) {
2364 case VectorA:
2365 st->print("vectora["); break;
2366 case VectorS:
2367 st->print("vectors["); break;
2368 case VectorD:
2369 st->print("vectord["); break;
2370 case VectorX:
2371 st->print("vectorx["); break;
2372 case VectorY:
2373 st->print("vectory["); break;
2374 case VectorZ:
2375 st->print("vectorz["); break;
2376 default:
2377 ShouldNotReachHere();
2378 }
2379 st->print("%d]:{", _length);
2380 _elem->dump2(d, depth, st);
2381 st->print("}");
2382 }
2383 #endif
2384
2385
|