< prev index next >

src/hotspot/share/opto/type.cpp

Print this page

 980     typerr(t);
 981     return Type::BOTTOM;
 982 
 983   case Top:                     // Top of the lattice
 984     return this;
 985   }
 986 
 987   // The type is unchanged
 988   return this;
 989 }
 990 
 991 //-----------------------------filter------------------------------------------
 992 const Type *Type::filter_helper(const Type *kills, bool include_speculative) const {
 993   const Type* ft = join_helper(kills, include_speculative);
 994   if (ft->empty())
 995     return Type::TOP;           // Canonical empty value
 996   return ft;
 997 }
 998 
 999 //------------------------------xdual------------------------------------------
1000 
1001 const Type *Type::xdual() const {
1002   // Note: the base() accessor asserts the sanity of _base.
1003   assert(_type_info[base()].dual_type != Bad, "implement with v-call");
1004   return new Type(_type_info[_base].dual_type);
1005 }
1006 
1007 //------------------------------has_memory-------------------------------------
1008 bool Type::has_memory() const {
1009   Type::TYPES tx = base();
1010   if (tx == Memory) return true;
1011   if (tx == Tuple) {
1012     const TypeTuple *t = is_tuple();
1013     for (uint i=0; i < t->cnt(); i++) {
1014       tx = t->field_at(i)->base();
1015       if (tx == Memory)  return true;
1016     }
1017   }
1018   return false;
1019 }
1020 

2342   if (_elem->isa_narrowoop())
2343     tap = _elem->make_ptr()->isa_aryptr();
2344   else
2345     tap = _elem->isa_aryptr();
2346   if (tap)
2347     return tap->ary()->ary_must_be_exact();
2348   return false;
2349 }
2350 
2351 //==============================TypeVect=======================================
2352 // Convenience common pre-built types.
2353 const TypeVect *TypeVect::VECTA = NULL; // vector length agnostic
2354 const TypeVect *TypeVect::VECTS = NULL; //  32-bit vectors
2355 const TypeVect *TypeVect::VECTD = NULL; //  64-bit vectors
2356 const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors
2357 const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors
2358 const TypeVect *TypeVect::VECTZ = NULL; // 512-bit vectors
2359 const TypeVect *TypeVect::VECTMASK = NULL; // predicate/mask vector
2360 
2361 //------------------------------make-------------------------------------------
2362 const TypeVect* TypeVect::make(const Type *elem, uint length) {



2363   BasicType elem_bt = elem->array_element_basic_type();
2364   assert(is_java_primitive(elem_bt), "only primitive types in vector");
2365   assert(Matcher::vector_size_supported(elem_bt, length), "length in range");
2366   int size = length * type2aelembytes(elem_bt);
2367   switch (Matcher::vector_ideal_reg(size)) {
2368   case Op_VecA:
2369     return (TypeVect*)(new TypeVectA(elem, length))->hashcons();
2370   case Op_VecS:
2371     return (TypeVect*)(new TypeVectS(elem, length))->hashcons();
2372   case Op_RegL:
2373   case Op_VecD:
2374   case Op_RegD:
2375     return (TypeVect*)(new TypeVectD(elem, length))->hashcons();
2376   case Op_VecX:
2377     return (TypeVect*)(new TypeVectX(elem, length))->hashcons();
2378   case Op_VecY:
2379     return (TypeVect*)(new TypeVectY(elem, length))->hashcons();
2380   case Op_VecZ:
2381     return (TypeVect*)(new TypeVectZ(elem, length))->hashcons();
2382   }
2383  ShouldNotReachHere();
2384   return NULL;
2385 }
2386 
2387 const TypeVect *TypeVect::makemask(const Type* elem, uint length) {
2388   if (Matcher::has_predicated_vectors()) {


2389     const TypeVect* mtype = Matcher::predicate_reg_type(elem, length);
2390     return (TypeVect*)(const_cast<TypeVect*>(mtype))->hashcons();
2391   } else {
2392     return make(elem, length);
2393   }
2394 }
2395 
2396 //------------------------------meet-------------------------------------------
2397 // Compute the MEET of two types.  It returns a new Type object.
2398 const Type *TypeVect::xmeet( const Type *t ) const {
2399   // Perform a fast test for common case; meeting the same types together.
2400   if( this == t ) return this;  // Meeting same type-rep?
2401 
2402   // Current "this->_base" is Vector
2403   switch (t->base()) {          // switch on original type
2404 
2405   case Bottom:                  // Ye Olde Default
2406     return t;
2407 
2408   default:                      // All else is a mistake

 980     typerr(t);
 981     return Type::BOTTOM;
 982 
 983   case Top:                     // Top of the lattice
 984     return this;
 985   }
 986 
 987   // The type is unchanged
 988   return this;
 989 }
 990 
 991 //-----------------------------filter------------------------------------------
 992 const Type *Type::filter_helper(const Type *kills, bool include_speculative) const {
 993   const Type* ft = join_helper(kills, include_speculative);
 994   if (ft->empty())
 995     return Type::TOP;           // Canonical empty value
 996   return ft;
 997 }
 998 
 999 //------------------------------xdual------------------------------------------

1000 const Type *Type::xdual() const {
1001   // Note: the base() accessor asserts the sanity of _base.
1002   assert(_type_info[base()].dual_type != Bad, "implement with v-call");
1003   return new Type(_type_info[_base].dual_type);
1004 }
1005 
1006 //------------------------------has_memory-------------------------------------
1007 bool Type::has_memory() const {
1008   Type::TYPES tx = base();
1009   if (tx == Memory) return true;
1010   if (tx == Tuple) {
1011     const TypeTuple *t = is_tuple();
1012     for (uint i=0; i < t->cnt(); i++) {
1013       tx = t->field_at(i)->base();
1014       if (tx == Memory)  return true;
1015     }
1016   }
1017   return false;
1018 }
1019 

2341   if (_elem->isa_narrowoop())
2342     tap = _elem->make_ptr()->isa_aryptr();
2343   else
2344     tap = _elem->isa_aryptr();
2345   if (tap)
2346     return tap->ary()->ary_must_be_exact();
2347   return false;
2348 }
2349 
2350 //==============================TypeVect=======================================
2351 // Convenience common pre-built types.
2352 const TypeVect *TypeVect::VECTA = NULL; // vector length agnostic
2353 const TypeVect *TypeVect::VECTS = NULL; //  32-bit vectors
2354 const TypeVect *TypeVect::VECTD = NULL; //  64-bit vectors
2355 const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors
2356 const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors
2357 const TypeVect *TypeVect::VECTZ = NULL; // 512-bit vectors
2358 const TypeVect *TypeVect::VECTMASK = NULL; // predicate/mask vector
2359 
2360 //------------------------------make-------------------------------------------
2361 const TypeVect* TypeVect::make(const Type *elem, uint length, bool is_mask) {
2362   if (is_mask) {
2363     return makemask(elem, length);
2364   }
2365   BasicType elem_bt = elem->array_element_basic_type();
2366   assert(is_java_primitive(elem_bt), "only primitive types in vector");
2367   assert(Matcher::vector_size_supported(elem_bt, length), "length in range");
2368   int size = length * type2aelembytes(elem_bt);
2369   switch (Matcher::vector_ideal_reg(size)) {
2370   case Op_VecA:
2371     return (TypeVect*)(new TypeVectA(elem, length))->hashcons();
2372   case Op_VecS:
2373     return (TypeVect*)(new TypeVectS(elem, length))->hashcons();
2374   case Op_RegL:
2375   case Op_VecD:
2376   case Op_RegD:
2377     return (TypeVect*)(new TypeVectD(elem, length))->hashcons();
2378   case Op_VecX:
2379     return (TypeVect*)(new TypeVectX(elem, length))->hashcons();
2380   case Op_VecY:
2381     return (TypeVect*)(new TypeVectY(elem, length))->hashcons();
2382   case Op_VecZ:
2383     return (TypeVect*)(new TypeVectZ(elem, length))->hashcons();
2384   }
2385  ShouldNotReachHere();
2386   return NULL;
2387 }
2388 
2389 const TypeVect *TypeVect::makemask(const Type* elem, uint length) {
2390   BasicType elem_bt = elem->array_element_basic_type();
2391   if (Matcher::has_predicated_vectors() &&
2392       Matcher::match_rule_supported_vector_masked(Op_VectorLoadMask, length, elem_bt)) {
2393     const TypeVect* mtype = Matcher::predicate_reg_type(elem, length);
2394     return (TypeVect*)(const_cast<TypeVect*>(mtype))->hashcons();
2395   } else {
2396     return make(elem, length);
2397   }
2398 }
2399 
2400 //------------------------------meet-------------------------------------------
2401 // Compute the MEET of two types.  It returns a new Type object.
2402 const Type *TypeVect::xmeet( const Type *t ) const {
2403   // Perform a fast test for common case; meeting the same types together.
2404   if( this == t ) return this;  // Meeting same type-rep?
2405 
2406   // Current "this->_base" is Vector
2407   switch (t->base()) {          // switch on original type
2408 
2409   case Bottom:                  // Ye Olde Default
2410     return t;
2411 
2412   default:                      // All else is a mistake
< prev index next >