< prev index next >

src/share/vm/opto/type.cpp

Print this page




  51 Dict* Type::_shared_type_dict = NULL;
  52 
  53 // Array which maps compiler types to Basic Types
  54 Type::TypeInfo Type::_type_info[Type::lastype] = {
  55   { Bad,             T_ILLEGAL,    "bad",           false, Node::NotAMachineReg, relocInfo::none          },  // Bad
  56   { Control,         T_ILLEGAL,    "control",       false, 0,                    relocInfo::none          },  // Control
  57   { Bottom,          T_VOID,       "top",           false, 0,                    relocInfo::none          },  // Top
  58   { Bad,             T_INT,        "int:",          false, Op_RegI,              relocInfo::none          },  // Int
  59   { Bad,             T_LONG,       "long:",         false, Op_RegL,              relocInfo::none          },  // Long
  60   { Half,            T_VOID,       "half",          false, 0,                    relocInfo::none          },  // Half
  61   { Bad,             T_NARROWOOP,  "narrowoop:",    false, Op_RegN,              relocInfo::none          },  // NarrowOop
  62   { Bad,             T_NARROWKLASS,"narrowklass:",  false, Op_RegN,              relocInfo::none          },  // NarrowKlass
  63   { Bad,             T_ILLEGAL,    "tuple:",        false, Node::NotAMachineReg, relocInfo::none          },  // Tuple
  64   { Bad,             T_ARRAY,      "array:",        false, Node::NotAMachineReg, relocInfo::none          },  // Array
  65 
  66 #ifdef SPARC
  67   { Bad,             T_ILLEGAL,    "vectors:",      false, 0,                    relocInfo::none          },  // VectorS
  68   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_RegD,              relocInfo::none          },  // VectorD
  69   { Bad,             T_ILLEGAL,    "vectorx:",      false, 0,                    relocInfo::none          },  // VectorX
  70   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY

  71 #elif defined(PPC64)
  72   { Bad,             T_ILLEGAL,    "vectors:",      false, 0,                    relocInfo::none          },  // VectorS
  73   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_RegL,              relocInfo::none          },  // VectorD
  74   { Bad,             T_ILLEGAL,    "vectorx:",      false, 0,                    relocInfo::none          },  // VectorX
  75   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY

  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 #endif
  82   { Bad,             T_ADDRESS,    "anyptr:",       false, Op_RegP,              relocInfo::none          },  // AnyPtr
  83   { Bad,             T_ADDRESS,    "rawptr:",       false, Op_RegP,              relocInfo::none          },  // RawPtr
  84   { Bad,             T_OBJECT,     "oop:",          true,  Op_RegP,              relocInfo::oop_type      },  // OopPtr
  85   { Bad,             T_OBJECT,     "inst:",         true,  Op_RegP,              relocInfo::oop_type      },  // InstPtr
  86   { Bad,             T_OBJECT,     "ary:",          true,  Op_RegP,              relocInfo::oop_type      },  // AryPtr
  87   { Bad,             T_METADATA,   "metadata:",     false, Op_RegP,              relocInfo::metadata_type },  // MetadataPtr
  88   { Bad,             T_METADATA,   "klass:",        false, Op_RegP,              relocInfo::metadata_type },  // KlassPtr
  89   { Bad,             T_OBJECT,     "func",          false, 0,                    relocInfo::none          },  // Function
  90   { Abio,            T_ILLEGAL,    "abIO",          false, 0,                    relocInfo::none          },  // Abio
  91   { Return_Address,  T_ADDRESS,    "return_address",false, Op_RegP,              relocInfo::none          },  // Return_Address
  92   { Memory,          T_ILLEGAL,    "memory",        false, 0,                    relocInfo::none          },  // Memory
  93   { FloatBot,        T_FLOAT,      "float_top",     false, Op_RegF,              relocInfo::none          },  // FloatTop
  94   { FloatCon,        T_FLOAT,      "ftcon:",        false, Op_RegF,              relocInfo::none          },  // FloatCon
  95   { FloatTop,        T_FLOAT,      "float",         false, Op_RegF,              relocInfo::none          },  // FloatBot
  96   { DoubleBot,       T_DOUBLE,     "double_top",    false, Op_RegD,              relocInfo::none          },  // DoubleTop
  97   { DoubleCon,       T_DOUBLE,     "dblcon:",       false, Op_RegD,              relocInfo::none          },  // DoubleCon
  98   { DoubleTop,       T_DOUBLE,     "double",        false, Op_RegD,              relocInfo::none          },  // DoubleBot
  99   { Top,             T_ILLEGAL,    "bottom",        false, 0,                    relocInfo::none          }   // Bottom
 100 };


 486   _zero_type[T_ARRAY]       = TypePtr::NULL_PTR; // null array is null oop
 487   _zero_type[T_ADDRESS]     = TypePtr::NULL_PTR; // raw pointers use the same null
 488   _zero_type[T_VOID]        = Type::TOP;         // the only void value is no value at all
 489 
 490   // get_zero_type() should not happen for T_CONFLICT
 491   _zero_type[T_CONFLICT]= NULL;
 492 
 493   // Vector predefined types, it needs initialized _const_basic_type[].
 494   if (Matcher::vector_size_supported(T_BYTE,4)) {
 495     TypeVect::VECTS = TypeVect::make(T_BYTE,4);
 496   }
 497   if (Matcher::vector_size_supported(T_FLOAT,2)) {
 498     TypeVect::VECTD = TypeVect::make(T_FLOAT,2);
 499   }
 500   if (Matcher::vector_size_supported(T_FLOAT,4)) {
 501     TypeVect::VECTX = TypeVect::make(T_FLOAT,4);
 502   }
 503   if (Matcher::vector_size_supported(T_FLOAT,8)) {
 504     TypeVect::VECTY = TypeVect::make(T_FLOAT,8);
 505   }



 506   mreg2type[Op_VecS] = TypeVect::VECTS;
 507   mreg2type[Op_VecD] = TypeVect::VECTD;
 508   mreg2type[Op_VecX] = TypeVect::VECTX;
 509   mreg2type[Op_VecY] = TypeVect::VECTY;

 510 
 511   // Restore working type arena.
 512   current->set_type_arena(save);
 513   current->set_type_dict(NULL);
 514 }
 515 
 516 //------------------------------Initialize-------------------------------------
 517 void Type::Initialize(Compile* current) {
 518   assert(current->type_arena() != NULL, "must have created type arena");
 519 
 520   if (_shared_type_dict == NULL) {
 521     Initialize_shared(current);
 522   }
 523 
 524   Arena* type_arena = current->type_arena();
 525 
 526   // Create the hash-cons'ing dictionary with top-level storage allocation
 527   Dict *tdic = new (type_arena) Dict( (CmpKey)Type::cmp,(Hash)Type::uhash, type_arena, 128 );
 528   current->set_type_dict(tdic);
 529 


 781 }
 782 
 783 //------------------------------xdual------------------------------------------
 784 // Compute dual right now.
 785 const Type::TYPES Type::dual_type[Type::lastype] = {
 786   Bad,          // Bad
 787   Control,      // Control
 788   Bottom,       // Top
 789   Bad,          // Int - handled in v-call
 790   Bad,          // Long - handled in v-call
 791   Half,         // Half
 792   Bad,          // NarrowOop - handled in v-call
 793   Bad,          // NarrowKlass - handled in v-call
 794 
 795   Bad,          // Tuple - handled in v-call
 796   Bad,          // Array - handled in v-call
 797   Bad,          // VectorS - handled in v-call
 798   Bad,          // VectorD - handled in v-call
 799   Bad,          // VectorX - handled in v-call
 800   Bad,          // VectorY - handled in v-call

 801 
 802   Bad,          // AnyPtr - handled in v-call
 803   Bad,          // RawPtr - handled in v-call
 804   Bad,          // OopPtr - handled in v-call
 805   Bad,          // InstPtr - handled in v-call
 806   Bad,          // AryPtr - handled in v-call
 807 
 808   Bad,          //  MetadataPtr - handled in v-call
 809   Bad,          // KlassPtr - handled in v-call
 810 
 811   Bad,          // Function - handled in v-call
 812   Abio,         // Abio
 813   Return_Address,// Return_Address
 814   Memory,       // Memory
 815   FloatBot,     // FloatTop
 816   FloatCon,     // FloatCon
 817   FloatTop,     // FloatBot
 818   DoubleBot,    // DoubleTop
 819   DoubleCon,    // DoubleCon
 820   DoubleTop,    // DoubleBot


2034   else
2035     tinst = _elem->isa_instptr();
2036   if (tinst)
2037     return tklass->as_instance_klass()->is_final();
2038   const TypeAryPtr*  tap;
2039   if (_elem->isa_narrowoop())
2040     tap = _elem->make_ptr()->isa_aryptr();
2041   else
2042     tap = _elem->isa_aryptr();
2043   if (tap)
2044     return tap->ary()->ary_must_be_exact();
2045   return false;
2046 }
2047 
2048 //==============================TypeVect=======================================
2049 // Convenience common pre-built types.
2050 const TypeVect *TypeVect::VECTS = NULL; //  32-bit vectors
2051 const TypeVect *TypeVect::VECTD = NULL; //  64-bit vectors
2052 const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors
2053 const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors

2054 
2055 //------------------------------make-------------------------------------------
2056 const TypeVect* TypeVect::make(const Type *elem, uint length) {
2057   BasicType elem_bt = elem->array_element_basic_type();
2058   assert(is_java_primitive(elem_bt), "only primitive types in vector");
2059   assert(length > 1 && is_power_of_2(length), "vector length is power of 2");
2060   assert(Matcher::vector_size_supported(elem_bt, length), "length in range");
2061   int size = length * type2aelembytes(elem_bt);
2062   switch (Matcher::vector_ideal_reg(size)) {
2063   case Op_VecS:
2064     return (TypeVect*)(new TypeVectS(elem, length))->hashcons();
2065   case Op_RegL:
2066   case Op_VecD:
2067   case Op_RegD:
2068     return (TypeVect*)(new TypeVectD(elem, length))->hashcons();
2069   case Op_VecX:
2070     return (TypeVect*)(new TypeVectX(elem, length))->hashcons();
2071   case Op_VecY:
2072     return (TypeVect*)(new TypeVectY(elem, length))->hashcons();


2073   }
2074  ShouldNotReachHere();
2075   return NULL;
2076 }
2077 
2078 //------------------------------meet-------------------------------------------
2079 // Compute the MEET of two types.  It returns a new Type object.
2080 const Type *TypeVect::xmeet( const Type *t ) const {
2081   // Perform a fast test for common case; meeting the same types together.
2082   if( this == t ) return this;  // Meeting same type-rep?
2083 
2084   // Current "this->_base" is Vector
2085   switch (t->base()) {          // switch on original type
2086 
2087   case Bottom:                  // Ye Olde Default
2088     return t;
2089 
2090   default:                      // All else is a mistake
2091     typerr(t);
2092 
2093   case VectorS:
2094   case VectorD:
2095   case VectorX:
2096   case VectorY: {                // Meeting 2 vectors?

2097     const TypeVect* v = t->is_vect();
2098     assert(  base() == v->base(), "");
2099     assert(length() == v->length(), "");
2100     assert(element_basic_type() == v->element_basic_type(), "");
2101     return TypeVect::make(_elem->xmeet(v->_elem), _length);
2102   }
2103   case Top:
2104     break;
2105   }
2106   return this;
2107 }
2108 
2109 //------------------------------xdual------------------------------------------
2110 // Dual: compute field-by-field dual
2111 const Type *TypeVect::xdual() const {
2112   return new TypeVect(base(), _elem->dual(), _length);
2113 }
2114 
2115 //------------------------------eq---------------------------------------------
2116 // Structural equality check for Type representations


2134 //  return _elem->singleton();
2135   return false;
2136 }
2137 
2138 bool TypeVect::empty(void) const {
2139   return _elem->empty();
2140 }
2141 
2142 //------------------------------dump2------------------------------------------
2143 #ifndef PRODUCT
2144 void TypeVect::dump2(Dict &d, uint depth, outputStream *st) const {
2145   switch (base()) {
2146   case VectorS:
2147     st->print("vectors["); break;
2148   case VectorD:
2149     st->print("vectord["); break;
2150   case VectorX:
2151     st->print("vectorx["); break;
2152   case VectorY:
2153     st->print("vectory["); break;


2154   default:
2155     ShouldNotReachHere();
2156   }
2157   st->print("%d]:{", _length);
2158   _elem->dump2(d, depth, st);
2159   st->print("}");
2160 }
2161 #endif
2162 
2163 
2164 //=============================================================================
2165 // Convenience common pre-built types.
2166 const TypePtr *TypePtr::NULL_PTR;
2167 const TypePtr *TypePtr::NOTNULL;
2168 const TypePtr *TypePtr::BOTTOM;
2169 
2170 //------------------------------meet-------------------------------------------
2171 // Meet over the PTR enum
2172 const TypePtr::PTR TypePtr::ptr_meet[TypePtr::lastPTR][TypePtr::lastPTR] = {
2173   //              TopPTR,    AnyNull,   Constant, Null,   NotNull, BotPTR,




  51 Dict* Type::_shared_type_dict = NULL;
  52 
  53 // Array which maps compiler types to Basic Types
  54 Type::TypeInfo Type::_type_info[Type::lastype] = {
  55   { Bad,             T_ILLEGAL,    "bad",           false, Node::NotAMachineReg, relocInfo::none          },  // Bad
  56   { Control,         T_ILLEGAL,    "control",       false, 0,                    relocInfo::none          },  // Control
  57   { Bottom,          T_VOID,       "top",           false, 0,                    relocInfo::none          },  // Top
  58   { Bad,             T_INT,        "int:",          false, Op_RegI,              relocInfo::none          },  // Int
  59   { Bad,             T_LONG,       "long:",         false, Op_RegL,              relocInfo::none          },  // Long
  60   { Half,            T_VOID,       "half",          false, 0,                    relocInfo::none          },  // Half
  61   { Bad,             T_NARROWOOP,  "narrowoop:",    false, Op_RegN,              relocInfo::none          },  // NarrowOop
  62   { Bad,             T_NARROWKLASS,"narrowklass:",  false, Op_RegN,              relocInfo::none          },  // NarrowKlass
  63   { Bad,             T_ILLEGAL,    "tuple:",        false, Node::NotAMachineReg, relocInfo::none          },  // Tuple
  64   { Bad,             T_ARRAY,      "array:",        false, Node::NotAMachineReg, relocInfo::none          },  // Array
  65 
  66 #ifdef SPARC
  67   { Bad,             T_ILLEGAL,    "vectors:",      false, 0,                    relocInfo::none          },  // VectorS
  68   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_RegD,              relocInfo::none          },  // VectorD
  69   { Bad,             T_ILLEGAL,    "vectorx:",      false, 0,                    relocInfo::none          },  // VectorX
  70   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY
  71   { Bad,             T_ILLEGAL,    "vectorz:",      false, 0,                    relocInfo::none          },  // VectorZ
  72 #elif defined(PPC64)
  73   { Bad,             T_ILLEGAL,    "vectors:",      false, 0,                    relocInfo::none          },  // VectorS
  74   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_RegL,              relocInfo::none          },  // VectorD
  75   { Bad,             T_ILLEGAL,    "vectorx:",      false, 0,                    relocInfo::none          },  // VectorX
  76   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY
  77   { Bad,             T_ILLEGAL,    "vectorz:",      false, 0,                    relocInfo::none          },  // VectorZ
  78 #else // all other
  79   { Bad,             T_ILLEGAL,    "vectors:",      false, Op_VecS,              relocInfo::none          },  // VectorS
  80   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_VecD,              relocInfo::none          },  // VectorD
  81   { Bad,             T_ILLEGAL,    "vectorx:",      false, Op_VecX,              relocInfo::none          },  // VectorX
  82   { Bad,             T_ILLEGAL,    "vectory:",      false, Op_VecY,              relocInfo::none          },  // VectorY
  83   { Bad,             T_ILLEGAL,    "vectorz:",      false, Op_VecZ,              relocInfo::none          },  // VectorZ
  84 #endif
  85   { Bad,             T_ADDRESS,    "anyptr:",       false, Op_RegP,              relocInfo::none          },  // AnyPtr
  86   { Bad,             T_ADDRESS,    "rawptr:",       false, Op_RegP,              relocInfo::none          },  // RawPtr
  87   { Bad,             T_OBJECT,     "oop:",          true,  Op_RegP,              relocInfo::oop_type      },  // OopPtr
  88   { Bad,             T_OBJECT,     "inst:",         true,  Op_RegP,              relocInfo::oop_type      },  // InstPtr
  89   { Bad,             T_OBJECT,     "ary:",          true,  Op_RegP,              relocInfo::oop_type      },  // AryPtr
  90   { Bad,             T_METADATA,   "metadata:",     false, Op_RegP,              relocInfo::metadata_type },  // MetadataPtr
  91   { Bad,             T_METADATA,   "klass:",        false, Op_RegP,              relocInfo::metadata_type },  // KlassPtr
  92   { Bad,             T_OBJECT,     "func",          false, 0,                    relocInfo::none          },  // Function
  93   { Abio,            T_ILLEGAL,    "abIO",          false, 0,                    relocInfo::none          },  // Abio
  94   { Return_Address,  T_ADDRESS,    "return_address",false, Op_RegP,              relocInfo::none          },  // Return_Address
  95   { Memory,          T_ILLEGAL,    "memory",        false, 0,                    relocInfo::none          },  // Memory
  96   { FloatBot,        T_FLOAT,      "float_top",     false, Op_RegF,              relocInfo::none          },  // FloatTop
  97   { FloatCon,        T_FLOAT,      "ftcon:",        false, Op_RegF,              relocInfo::none          },  // FloatCon
  98   { FloatTop,        T_FLOAT,      "float",         false, Op_RegF,              relocInfo::none          },  // FloatBot
  99   { DoubleBot,       T_DOUBLE,     "double_top",    false, Op_RegD,              relocInfo::none          },  // DoubleTop
 100   { DoubleCon,       T_DOUBLE,     "dblcon:",       false, Op_RegD,              relocInfo::none          },  // DoubleCon
 101   { DoubleTop,       T_DOUBLE,     "double",        false, Op_RegD,              relocInfo::none          },  // DoubleBot
 102   { Top,             T_ILLEGAL,    "bottom",        false, 0,                    relocInfo::none          }   // Bottom
 103 };


 489   _zero_type[T_ARRAY]       = TypePtr::NULL_PTR; // null array is null oop
 490   _zero_type[T_ADDRESS]     = TypePtr::NULL_PTR; // raw pointers use the same null
 491   _zero_type[T_VOID]        = Type::TOP;         // the only void value is no value at all
 492 
 493   // get_zero_type() should not happen for T_CONFLICT
 494   _zero_type[T_CONFLICT]= NULL;
 495 
 496   // Vector predefined types, it needs initialized _const_basic_type[].
 497   if (Matcher::vector_size_supported(T_BYTE,4)) {
 498     TypeVect::VECTS = TypeVect::make(T_BYTE,4);
 499   }
 500   if (Matcher::vector_size_supported(T_FLOAT,2)) {
 501     TypeVect::VECTD = TypeVect::make(T_FLOAT,2);
 502   }
 503   if (Matcher::vector_size_supported(T_FLOAT,4)) {
 504     TypeVect::VECTX = TypeVect::make(T_FLOAT,4);
 505   }
 506   if (Matcher::vector_size_supported(T_FLOAT,8)) {
 507     TypeVect::VECTY = TypeVect::make(T_FLOAT,8);
 508   }
 509   if (Matcher::vector_size_supported(T_FLOAT,16)) {
 510     TypeVect::VECTZ = TypeVect::make(T_FLOAT,16);
 511   }
 512   mreg2type[Op_VecS] = TypeVect::VECTS;
 513   mreg2type[Op_VecD] = TypeVect::VECTD;
 514   mreg2type[Op_VecX] = TypeVect::VECTX;
 515   mreg2type[Op_VecY] = TypeVect::VECTY;
 516   mreg2type[Op_VecZ] = TypeVect::VECTZ;
 517 
 518   // Restore working type arena.
 519   current->set_type_arena(save);
 520   current->set_type_dict(NULL);
 521 }
 522 
 523 //------------------------------Initialize-------------------------------------
 524 void Type::Initialize(Compile* current) {
 525   assert(current->type_arena() != NULL, "must have created type arena");
 526 
 527   if (_shared_type_dict == NULL) {
 528     Initialize_shared(current);
 529   }
 530 
 531   Arena* type_arena = current->type_arena();
 532 
 533   // Create the hash-cons'ing dictionary with top-level storage allocation
 534   Dict *tdic = new (type_arena) Dict( (CmpKey)Type::cmp,(Hash)Type::uhash, type_arena, 128 );
 535   current->set_type_dict(tdic);
 536 


 788 }
 789 
 790 //------------------------------xdual------------------------------------------
 791 // Compute dual right now.
 792 const Type::TYPES Type::dual_type[Type::lastype] = {
 793   Bad,          // Bad
 794   Control,      // Control
 795   Bottom,       // Top
 796   Bad,          // Int - handled in v-call
 797   Bad,          // Long - handled in v-call
 798   Half,         // Half
 799   Bad,          // NarrowOop - handled in v-call
 800   Bad,          // NarrowKlass - handled in v-call
 801 
 802   Bad,          // Tuple - handled in v-call
 803   Bad,          // Array - handled in v-call
 804   Bad,          // VectorS - handled in v-call
 805   Bad,          // VectorD - handled in v-call
 806   Bad,          // VectorX - handled in v-call
 807   Bad,          // VectorY - handled in v-call
 808   Bad,          // VectorZ - handled in v-call
 809 
 810   Bad,          // AnyPtr - handled in v-call
 811   Bad,          // RawPtr - handled in v-call
 812   Bad,          // OopPtr - handled in v-call
 813   Bad,          // InstPtr - handled in v-call
 814   Bad,          // AryPtr - handled in v-call
 815 
 816   Bad,          //  MetadataPtr - handled in v-call
 817   Bad,          // KlassPtr - handled in v-call
 818 
 819   Bad,          // Function - handled in v-call
 820   Abio,         // Abio
 821   Return_Address,// Return_Address
 822   Memory,       // Memory
 823   FloatBot,     // FloatTop
 824   FloatCon,     // FloatCon
 825   FloatTop,     // FloatBot
 826   DoubleBot,    // DoubleTop
 827   DoubleCon,    // DoubleCon
 828   DoubleTop,    // DoubleBot


2042   else
2043     tinst = _elem->isa_instptr();
2044   if (tinst)
2045     return tklass->as_instance_klass()->is_final();
2046   const TypeAryPtr*  tap;
2047   if (_elem->isa_narrowoop())
2048     tap = _elem->make_ptr()->isa_aryptr();
2049   else
2050     tap = _elem->isa_aryptr();
2051   if (tap)
2052     return tap->ary()->ary_must_be_exact();
2053   return false;
2054 }
2055 
2056 //==============================TypeVect=======================================
2057 // Convenience common pre-built types.
2058 const TypeVect *TypeVect::VECTS = NULL; //  32-bit vectors
2059 const TypeVect *TypeVect::VECTD = NULL; //  64-bit vectors
2060 const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors
2061 const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors
2062 const TypeVect *TypeVect::VECTZ = NULL; // 512-bit vectors
2063 
2064 //------------------------------make-------------------------------------------
2065 const TypeVect* TypeVect::make(const Type *elem, uint length) {
2066   BasicType elem_bt = elem->array_element_basic_type();
2067   assert(is_java_primitive(elem_bt), "only primitive types in vector");
2068   assert(length > 1 && is_power_of_2(length), "vector length is power of 2");
2069   assert(Matcher::vector_size_supported(elem_bt, length), "length in range");
2070   int size = length * type2aelembytes(elem_bt);
2071   switch (Matcher::vector_ideal_reg(size)) {
2072   case Op_VecS:
2073     return (TypeVect*)(new TypeVectS(elem, length))->hashcons();
2074   case Op_RegL:
2075   case Op_VecD:
2076   case Op_RegD:
2077     return (TypeVect*)(new TypeVectD(elem, length))->hashcons();
2078   case Op_VecX:
2079     return (TypeVect*)(new TypeVectX(elem, length))->hashcons();
2080   case Op_VecY:
2081     return (TypeVect*)(new TypeVectY(elem, length))->hashcons();
2082   case Op_VecZ:
2083     return (TypeVect*)(new TypeVectZ(elem, length))->hashcons();
2084   }
2085  ShouldNotReachHere();
2086   return NULL;
2087 }
2088 
2089 //------------------------------meet-------------------------------------------
2090 // Compute the MEET of two types.  It returns a new Type object.
2091 const Type *TypeVect::xmeet( const Type *t ) const {
2092   // Perform a fast test for common case; meeting the same types together.
2093   if( this == t ) return this;  // Meeting same type-rep?
2094 
2095   // Current "this->_base" is Vector
2096   switch (t->base()) {          // switch on original type
2097 
2098   case Bottom:                  // Ye Olde Default
2099     return t;
2100 
2101   default:                      // All else is a mistake
2102     typerr(t);
2103 
2104   case VectorS:
2105   case VectorD:
2106   case VectorX:
2107   case VectorY:
2108   case VectorZ: {                // Meeting 2 vectors?
2109     const TypeVect* v = t->is_vect();
2110     assert(  base() == v->base(), "");
2111     assert(length() == v->length(), "");
2112     assert(element_basic_type() == v->element_basic_type(), "");
2113     return TypeVect::make(_elem->xmeet(v->_elem), _length);
2114   }
2115   case Top:
2116     break;
2117   }
2118   return this;
2119 }
2120 
2121 //------------------------------xdual------------------------------------------
2122 // Dual: compute field-by-field dual
2123 const Type *TypeVect::xdual() const {
2124   return new TypeVect(base(), _elem->dual(), _length);
2125 }
2126 
2127 //------------------------------eq---------------------------------------------
2128 // Structural equality check for Type representations


2146 //  return _elem->singleton();
2147   return false;
2148 }
2149 
2150 bool TypeVect::empty(void) const {
2151   return _elem->empty();
2152 }
2153 
2154 //------------------------------dump2------------------------------------------
2155 #ifndef PRODUCT
2156 void TypeVect::dump2(Dict &d, uint depth, outputStream *st) const {
2157   switch (base()) {
2158   case VectorS:
2159     st->print("vectors["); break;
2160   case VectorD:
2161     st->print("vectord["); break;
2162   case VectorX:
2163     st->print("vectorx["); break;
2164   case VectorY:
2165     st->print("vectory["); break;
2166   case VectorZ:
2167     st->print("vectorz["); break;
2168   default:
2169     ShouldNotReachHere();
2170   }
2171   st->print("%d]:{", _length);
2172   _elem->dump2(d, depth, st);
2173   st->print("}");
2174 }
2175 #endif
2176 
2177 
2178 //=============================================================================
2179 // Convenience common pre-built types.
2180 const TypePtr *TypePtr::NULL_PTR;
2181 const TypePtr *TypePtr::NOTNULL;
2182 const TypePtr *TypePtr::BOTTOM;
2183 
2184 //------------------------------meet-------------------------------------------
2185 // Meet over the PTR enum
2186 const TypePtr::PTR TypePtr::ptr_meet[TypePtr::lastPTR][TypePtr::lastPTR] = {
2187   //              TopPTR,    AnyNull,   Constant, Null,   NotNull, BotPTR,


< prev index next >