< prev index next >

src/hotspot/share/opto/type.cpp

Print this page




 121   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY
 122   { Bad,             T_ILLEGAL,    "vectorz:",      false, 0,                    relocInfo::none          },  // VectorZ
 123 #elif defined(S390)
 124   { Bad,             T_ILLEGAL,    "vectors:",      false, 0,                    relocInfo::none          },  // VectorS
 125   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_RegL,              relocInfo::none          },  // VectorD
 126   { Bad,             T_ILLEGAL,    "vectorx:",      false, 0,                    relocInfo::none          },  // VectorX
 127   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY
 128   { Bad,             T_ILLEGAL,    "vectorz:",      false, 0,                    relocInfo::none          },  // VectorZ
 129 #else // all other
 130   { Bad,             T_ILLEGAL,    "vectors:",      false, Op_VecS,              relocInfo::none          },  // VectorS
 131   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_VecD,              relocInfo::none          },  // VectorD
 132   { Bad,             T_ILLEGAL,    "vectorx:",      false, Op_VecX,              relocInfo::none          },  // VectorX
 133   { Bad,             T_ILLEGAL,    "vectory:",      false, Op_VecY,              relocInfo::none          },  // VectorY
 134   { Bad,             T_ILLEGAL,    "vectorz:",      false, Op_VecZ,              relocInfo::none          },  // VectorZ
 135 #endif
 136   { Bad,             T_VALUETYPE,  "value:",        false, Node::NotAMachineReg, relocInfo::none          },  // ValueType
 137   { Bad,             T_ADDRESS,    "anyptr:",       false, Op_RegP,              relocInfo::none          },  // AnyPtr
 138   { Bad,             T_ADDRESS,    "rawptr:",       false, Op_RegP,              relocInfo::none          },  // RawPtr
 139   { Bad,             T_OBJECT,     "oop:",          true,  Op_RegP,              relocInfo::oop_type      },  // OopPtr
 140   { Bad,             T_OBJECT,     "inst:",         true,  Op_RegP,              relocInfo::oop_type      },  // InstPtr
 141   { Bad,             T_VALUETYPEPTR,"valueptr:",     true,  Op_RegP,              relocInfo::oop_type      },  // ValueTypePtr
 142   { Bad,             T_OBJECT,     "ary:",          true,  Op_RegP,              relocInfo::oop_type      },  // AryPtr
 143   { Bad,             T_METADATA,   "metadata:",     false, Op_RegP,              relocInfo::metadata_type },  // MetadataPtr
 144   { Bad,             T_METADATA,   "klass:",        false, Op_RegP,              relocInfo::metadata_type },  // KlassPtr
 145   { Bad,             T_OBJECT,     "func",          false, 0,                    relocInfo::none          },  // Function
 146   { Abio,            T_ILLEGAL,    "abIO",          false, 0,                    relocInfo::none          },  // Abio
 147   { Return_Address,  T_ADDRESS,    "return_address",false, Op_RegP,              relocInfo::none          },  // Return_Address
 148   { Memory,          T_ILLEGAL,    "memory",        false, 0,                    relocInfo::none          },  // Memory
 149   { FloatBot,        T_FLOAT,      "float_top",     false, Op_RegF,              relocInfo::none          },  // FloatTop
 150   { FloatCon,        T_FLOAT,      "ftcon:",        false, Op_RegF,              relocInfo::none          },  // FloatCon
 151   { FloatTop,        T_FLOAT,      "float",         false, Op_RegF,              relocInfo::none          },  // FloatBot
 152   { DoubleBot,       T_DOUBLE,     "double_top",    false, Op_RegD,              relocInfo::none          },  // DoubleTop
 153   { DoubleCon,       T_DOUBLE,     "dblcon:",       false, Op_RegD,              relocInfo::none          },  // DoubleCon
 154   { DoubleTop,       T_DOUBLE,     "double",        false, Op_RegD,              relocInfo::none          },  // DoubleBot
 155   { Top,             T_ILLEGAL,    "bottom",        false, 0,                    relocInfo::none          }   // Bottom
 156 };
 157 
 158 // Map ideal registers (machine types) to ideal types
 159 const Type *Type::mreg2type[_last_machine_leaf];
 160 
 161 // Map basic types to canonical Type* pointers.


 625     TypeAryPtr::OOPS  = TypeAryPtr::NARROWOOPS;
 626   } else
 627 #endif
 628   {
 629     // There is no shared klass for Object[].  See note in TypeAryPtr::klass().
 630     TypeAryPtr::OOPS  = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInstPtr::BOTTOM,TypeInt::POS), NULL /*ciArrayKlass::make(o)*/,  false,  Offset::bottom);
 631   }
 632   TypeAryPtr::BYTES   = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::BYTE      ,TypeInt::POS), ciTypeArrayKlass::make(T_BYTE),   true,  Offset::bottom);
 633   TypeAryPtr::SHORTS  = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::SHORT     ,TypeInt::POS), ciTypeArrayKlass::make(T_SHORT),  true,  Offset::bottom);
 634   TypeAryPtr::CHARS   = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::CHAR      ,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR),   true,  Offset::bottom);
 635   TypeAryPtr::INTS    = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::INT       ,TypeInt::POS), ciTypeArrayKlass::make(T_INT),    true,  Offset::bottom);
 636   TypeAryPtr::LONGS   = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeLong::LONG     ,TypeInt::POS), ciTypeArrayKlass::make(T_LONG),   true,  Offset::bottom);
 637   TypeAryPtr::FLOATS  = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::FLOAT        ,TypeInt::POS), ciTypeArrayKlass::make(T_FLOAT),  true,  Offset::bottom);
 638   TypeAryPtr::DOUBLES = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::DOUBLE       ,TypeInt::POS), ciTypeArrayKlass::make(T_DOUBLE), true,  Offset::bottom);
 639 
 640   // Nobody should ask _array_body_type[T_NARROWOOP]. Use NULL as assert.
 641   TypeAryPtr::_array_body_type[T_NARROWOOP] = NULL;
 642   TypeAryPtr::_array_body_type[T_OBJECT]  = TypeAryPtr::OOPS;
 643   TypeAryPtr::_array_body_type[T_VALUETYPE] = TypeAryPtr::OOPS;
 644   TypeAryPtr::_array_body_type[T_ARRAY]   = TypeAryPtr::OOPS; // arrays are stored in oop arrays
 645   TypeAryPtr::_array_body_type[T_VALUETYPEPTR] = NULL;
 646   TypeAryPtr::_array_body_type[T_BYTE]    = TypeAryPtr::BYTES;
 647   TypeAryPtr::_array_body_type[T_BOOLEAN] = TypeAryPtr::BYTES;  // boolean[] is a byte array
 648   TypeAryPtr::_array_body_type[T_SHORT]   = TypeAryPtr::SHORTS;
 649   TypeAryPtr::_array_body_type[T_CHAR]    = TypeAryPtr::CHARS;
 650   TypeAryPtr::_array_body_type[T_INT]     = TypeAryPtr::INTS;
 651   TypeAryPtr::_array_body_type[T_LONG]    = TypeAryPtr::LONGS;
 652   TypeAryPtr::_array_body_type[T_FLOAT]   = TypeAryPtr::FLOATS;
 653   TypeAryPtr::_array_body_type[T_DOUBLE]  = TypeAryPtr::DOUBLES;
 654 
 655   TypeKlassPtr::OBJECT = TypeKlassPtr::make(TypePtr::NotNull, current->env()->Object_klass(), Offset(0) );
 656   TypeKlassPtr::OBJECT_OR_NULL = TypeKlassPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), Offset(0) );
 657 
 658   const Type **fi2c = TypeTuple::fields(2);
 659   fi2c[TypeFunc::Parms+0] = TypeInstPtr::BOTTOM; // Method*
 660   fi2c[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // argument pointer
 661   TypeTuple::START_I2C = TypeTuple::make(TypeFunc::Parms+2, fi2c);
 662 
 663   const Type **intpair = TypeTuple::fields(2);
 664   intpair[0] = TypeInt::INT;
 665   intpair[1] = TypeInt::INT;


 674   intccpair[0] = TypeInt::INT;
 675   intccpair[1] = TypeInt::CC;
 676   TypeTuple::INT_CC_PAIR = TypeTuple::make(2, intccpair);
 677 
 678   const Type **longccpair = TypeTuple::fields(2);
 679   longccpair[0] = TypeLong::LONG;
 680   longccpair[1] = TypeInt::CC;
 681   TypeTuple::LONG_CC_PAIR = TypeTuple::make(2, longccpair);
 682 
 683   _const_basic_type[T_NARROWOOP]   = TypeNarrowOop::BOTTOM;
 684   _const_basic_type[T_NARROWKLASS] = Type::BOTTOM;
 685   _const_basic_type[T_BOOLEAN]     = TypeInt::BOOL;
 686   _const_basic_type[T_CHAR]        = TypeInt::CHAR;
 687   _const_basic_type[T_BYTE]        = TypeInt::BYTE;
 688   _const_basic_type[T_SHORT]       = TypeInt::SHORT;
 689   _const_basic_type[T_INT]         = TypeInt::INT;
 690   _const_basic_type[T_LONG]        = TypeLong::LONG;
 691   _const_basic_type[T_FLOAT]       = Type::FLOAT;
 692   _const_basic_type[T_DOUBLE]      = Type::DOUBLE;
 693   _const_basic_type[T_OBJECT]      = TypeInstPtr::BOTTOM;
 694   _const_basic_type[T_VALUETYPEPTR]= TypeInstPtr::BOTTOM;
 695   _const_basic_type[T_ARRAY]       = TypeInstPtr::BOTTOM; // there is no separate bottom for arrays
 696   _const_basic_type[T_VALUETYPE]   = TypeInstPtr::BOTTOM;
 697   _const_basic_type[T_VOID]        = TypePtr::NULL_PTR;   // reflection represents void this way
 698   _const_basic_type[T_ADDRESS]     = TypeRawPtr::BOTTOM;  // both interpreter return addresses & random raw ptrs
 699   _const_basic_type[T_CONFLICT]    = Type::BOTTOM;        // why not?
 700 
 701   _zero_type[T_NARROWOOP]   = TypeNarrowOop::NULL_PTR;
 702   _zero_type[T_NARROWKLASS] = TypeNarrowKlass::NULL_PTR;
 703   _zero_type[T_BOOLEAN]     = TypeInt::ZERO;     // false == 0
 704   _zero_type[T_CHAR]        = TypeInt::ZERO;     // '\0' == 0
 705   _zero_type[T_BYTE]        = TypeInt::ZERO;     // 0x00 == 0
 706   _zero_type[T_SHORT]       = TypeInt::ZERO;     // 0x0000 == 0
 707   _zero_type[T_INT]         = TypeInt::ZERO;
 708   _zero_type[T_LONG]        = TypeLong::ZERO;
 709   _zero_type[T_FLOAT]       = TypeF::ZERO;
 710   _zero_type[T_DOUBLE]      = TypeD::ZERO;
 711   _zero_type[T_OBJECT]      = TypePtr::NULL_PTR;
 712   _zero_type[T_VALUETYPEPTR]= TypePtr::NULL_PTR;
 713   _zero_type[T_ARRAY]       = TypePtr::NULL_PTR; // null array is null oop
 714   _zero_type[T_VALUETYPE]   = TypePtr::NULL_PTR;
 715   _zero_type[T_ADDRESS]     = TypePtr::NULL_PTR; // raw pointers use the same null
 716   _zero_type[T_VOID]        = Type::TOP;         // the only void value is no value at all
 717 
 718   // get_zero_type() should not happen for T_CONFLICT
 719   _zero_type[T_CONFLICT]= NULL;
 720 
 721   // Vector predefined types, it needs initialized _const_basic_type[].
 722   if (Matcher::vector_size_supported(T_BYTE,4)) {
 723     TypeVect::VECTS = TypeVect::make(T_BYTE,4);
 724   }
 725   if (Matcher::vector_size_supported(T_FLOAT,2)) {
 726     TypeVect::VECTD = TypeVect::make(T_FLOAT,2);
 727   }
 728   if (Matcher::vector_size_supported(T_FLOAT,4)) {
 729     TypeVect::VECTX = TypeVect::make(T_FLOAT,4);
 730   }
 731   if (Matcher::vector_size_supported(T_FLOAT,8)) {
 732     TypeVect::VECTY = TypeVect::make(T_FLOAT,8);


1023   Bottom,       // Top
1024   Bad,          // Int - handled in v-call
1025   Bad,          // Long - handled in v-call
1026   Half,         // Half
1027   Bad,          // NarrowOop - handled in v-call
1028   Bad,          // NarrowKlass - handled in v-call
1029 
1030   Bad,          // Tuple - handled in v-call
1031   Bad,          // Array - handled in v-call
1032   Bad,          // VectorS - handled in v-call
1033   Bad,          // VectorD - handled in v-call
1034   Bad,          // VectorX - handled in v-call
1035   Bad,          // VectorY - handled in v-call
1036   Bad,          // VectorZ - handled in v-call
1037   Bad,          // ValueType - handled in v-call
1038 
1039   Bad,          // AnyPtr - handled in v-call
1040   Bad,          // RawPtr - handled in v-call
1041   Bad,          // OopPtr - handled in v-call
1042   Bad,          // InstPtr - handled in v-call
1043   Bad,          // ValueTypePtr - handled in v-call
1044   Bad,          // AryPtr - handled in v-call
1045 
1046   Bad,          //  MetadataPtr - handled in v-call
1047   Bad,          // KlassPtr - handled in v-call
1048 
1049   Bad,          // Function - handled in v-call
1050   Abio,         // Abio
1051   Return_Address,// Return_Address
1052   Memory,       // Memory
1053   FloatBot,     // FloatTop
1054   FloatCon,     // FloatCon
1055   FloatTop,     // FloatBot
1056   DoubleBot,    // DoubleTop
1057   DoubleCon,    // DoubleCon
1058   DoubleTop,    // DoubleBot
1059   Top           // Bottom
1060 };
1061 
1062 const Type *Type::xdual() const {
1063   // Note: the base() accessor asserts the sanity of _base.


1910 
1911 bool TypeLong::empty(void) const {
1912   return _lo > _hi;
1913 }
1914 
1915 //=============================================================================
1916 // Convenience common pre-built types.
1917 const TypeTuple *TypeTuple::IFBOTH;     // Return both arms of IF as reachable
1918 const TypeTuple *TypeTuple::IFFALSE;
1919 const TypeTuple *TypeTuple::IFTRUE;
1920 const TypeTuple *TypeTuple::IFNEITHER;
1921 const TypeTuple *TypeTuple::LOOPBODY;
1922 const TypeTuple *TypeTuple::MEMBAR;
1923 const TypeTuple *TypeTuple::STORECONDITIONAL;
1924 const TypeTuple *TypeTuple::START_I2C;
1925 const TypeTuple *TypeTuple::INT_PAIR;
1926 const TypeTuple *TypeTuple::LONG_PAIR;
1927 const TypeTuple *TypeTuple::INT_CC_PAIR;
1928 const TypeTuple *TypeTuple::LONG_CC_PAIR;
1929 
1930 static void collect_value_fields(ciValueKlass* vk, const Type** field_array, uint& pos) {
1931   for (int j = 0; j < vk->nof_nonstatic_fields(); j++) {







1932     ciField* field = vk->nonstatic_field_at(j);
1933     BasicType bt = field->type()->basic_type();
1934     const Type* ft = Type::get_const_type(field->type());
1935     field_array[pos++] = ft;
1936     if (bt == T_LONG || bt == T_DOUBLE) {
1937       field_array[pos++] = Type::HALF;
1938     }
1939   }
1940 }
1941 
1942 //------------------------------make-------------------------------------------
1943 // Make a TypeTuple from the range of a method signature
1944 const TypeTuple *TypeTuple::make_range(ciSignature* sig, bool ret_vt_fields) {
1945   ciType* return_type = sig->return_type();
1946   return make_range(return_type, sig->returns_never_null(), ret_vt_fields);
1947 }
1948 
1949 const TypeTuple *TypeTuple::make_range(ciType* return_type, bool never_null, bool ret_vt_fields) {
1950   uint arg_cnt = 0;
1951   if (ret_vt_fields) {


1981   case T_VALUETYPE:
1982     if (ret_vt_fields) {
1983       ciValueKlass* vk = (ciValueKlass*)return_type;
1984       uint pos = TypeFunc::Parms;
1985       field_array[pos] = TypePtr::BOTTOM;
1986       pos++;
1987       collect_value_fields(vk, field_array, pos);
1988     } else {
1989       field_array[TypeFunc::Parms] = get_const_type(return_type)->join_speculative(never_null ? TypePtr::NOTNULL : TypePtr::BOTTOM);
1990     }
1991     break;
1992   case T_VOID:
1993     break;
1994   default:
1995     ShouldNotReachHere();
1996   }
1997   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt, field_array))->hashcons();
1998 }
1999 
2000 // Make a TypeTuple from the domain of a method signature
2001 const TypeTuple *TypeTuple::make_domain(ciInstanceKlass* recv, ciSignature* sig, bool vt_fields_as_args) {


2002   uint arg_cnt = sig->size();
2003 
2004   int vt_extra = 0;

2005   if (vt_fields_as_args) {
2006     for (int i = 0; i < sig->count(); i++) {
2007       ciType* type = sig->type_at(i);
2008       if (type->basic_type() == T_VALUETYPE) {
2009         assert(type->is_valuetype(), "inconsistent type");
2010         ciValueKlass* vk = (ciValueKlass*)type;
2011         vt_extra += vk->value_arg_slots()-1;
2012       }
2013     }
2014     assert(((int)arg_cnt) + vt_extra >= 0, "negative number of actual arguments?");



2015   }
2016 
2017   uint pos = TypeFunc::Parms;
2018   const Type **field_array;
2019   if (recv != NULL) {
2020     arg_cnt++;
2021     bool vt_fields_for_recv = vt_fields_as_args && recv->is_valuetype();


2022     if (vt_fields_for_recv) {
2023       ciValueKlass* vk = (ciValueKlass*)recv;
2024       vt_extra += vk->value_arg_slots()-1;
2025     }
2026     field_array = fields(arg_cnt + vt_extra);
2027     // Use get_const_type here because it respects UseUniqueSubclasses:
2028     if (vt_fields_for_recv) {
2029       ciValueKlass* vk = (ciValueKlass*)recv;
2030       collect_value_fields(vk, field_array, pos);
2031     } else {
2032       field_array[pos++] = get_const_type(recv)->join_speculative(TypePtr::NOTNULL);
2033     }
2034   } else {
2035     field_array = fields(arg_cnt + vt_extra);
2036   }
2037 
2038   int i = 0;
2039   while (pos < TypeFunc::Parms + arg_cnt + vt_extra) {
2040     ciType* type = sig->type_at(i);
2041 
2042     switch (type->basic_type()) {
2043     case T_LONG:
2044       field_array[pos++] = TypeLong::LONG;
2045       field_array[pos++] = Type::HALF;
2046       break;
2047     case T_DOUBLE:
2048       field_array[pos++] = Type::DOUBLE;
2049       field_array[pos++] = Type::HALF;
2050       break;
2051     case T_OBJECT:
2052     case T_ARRAY:
2053     case T_FLOAT:
2054     case T_INT:
2055       field_array[pos++] = get_const_type(type);
2056       break;
2057     case T_BOOLEAN:
2058     case T_CHAR:
2059     case T_BYTE:
2060     case T_SHORT:
2061       field_array[pos++] = TypeInt::INT;
2062       break;
2063     case T_VALUETYPE: {
2064       assert(type->is_valuetype(), "inconsistent type");
2065       if (vt_fields_as_args) {
2066         ciValueKlass* vk = (ciValueKlass*)type;
2067         collect_value_fields(vk, field_array, pos);
2068       } else {
2069         field_array[pos++] = get_const_type(type)->join_speculative(sig->is_never_null_at(i) ? TypePtr::NOTNULL : TypePtr::BOTTOM);
2070       }
2071       break;
2072     }
2073     default:
2074       ShouldNotReachHere();
2075     }
2076     i++;








2077   }
2078   assert(pos == TypeFunc::Parms + arg_cnt + vt_extra, "wrong number of arguments");
2079 
2080   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt + vt_extra, field_array))->hashcons();
2081 }
2082 
2083 const TypeTuple *TypeTuple::make( uint cnt, const Type **fields ) {
2084   return (TypeTuple*)(new TypeTuple(cnt,fields))->hashcons();
2085 }
2086 
2087 //------------------------------fields-----------------------------------------
2088 // Subroutine call type with space allocated for argument types
2089 // Memory for Control, I_O, Memory, FramePtr, and ReturnAdr is allocated implicitly
2090 const Type **TypeTuple::fields( uint arg_cnt ) {
2091   const Type **flds = (const Type **)(Compile::current()->type_arena()->Amalloc_4((TypeFunc::Parms+arg_cnt)*sizeof(Type*) ));
2092   flds[TypeFunc::Control  ] = Type::CONTROL;
2093   flds[TypeFunc::I_O      ] = Type::ABIO;
2094   flds[TypeFunc::Memory   ] = Type::MEMORY;
2095   flds[TypeFunc::FramePtr ] = TypeRawPtr::BOTTOM;
2096   flds[TypeFunc::ReturnAdr] = Type::RETURN_ADDRESS;


3193     _is_ptr_to_boxed_value = k->as_instance_klass()->is_boxed_value_offset(offset.get());
3194   }
3195 #ifdef _LP64
3196   if (this->offset() > 0 || this->offset() == Type::OffsetTop || this->offset() == Type::OffsetBot) {
3197     if (this->offset() == oopDesc::klass_offset_in_bytes()) {
3198       _is_ptr_to_narrowklass = UseCompressedClassPointers;
3199     } else if (klass() == NULL) {
3200       // Array with unknown body type
3201       assert(this->isa_aryptr(), "only arrays without klass");
3202       _is_ptr_to_narrowoop = UseCompressedOops;
3203     } else if (UseCompressedOops && this->isa_aryptr() && this->offset() != arrayOopDesc::length_offset_in_bytes()) {
3204       if (klass()->is_obj_array_klass()) {
3205         _is_ptr_to_narrowoop = true;
3206       } else if (klass()->is_value_array_klass() && field_offset != Offset::top && field_offset != Offset::bottom) {
3207         // Check if the field of the value type array element contains oops
3208         ciValueKlass* vk = klass()->as_value_array_klass()->element_klass()->as_value_klass();
3209         int foffset = field_offset.get() + vk->first_field_offset();
3210         ciField* field = vk->get_field_by_offset(foffset, false);
3211         assert(field != NULL, "missing field");
3212         BasicType bt = field->layout_type();
3213         assert(bt != T_VALUETYPEPTR, "unexpected type");
3214         _is_ptr_to_narrowoop = (bt == T_OBJECT || bt == T_ARRAY || T_VALUETYPE);
3215       }
3216     } else if (klass()->is_instance_klass()) {
3217       if (this->isa_klassptr()) {
3218         // Perm objects don't use compressed references
3219       } else if (_offset == Offset::bottom || _offset == Offset::top) {
3220         // unsafe access
3221         _is_ptr_to_narrowoop = UseCompressedOops;
3222       } else { // exclude unsafe ops
3223         assert(this->isa_instptr(), "must be an instance ptr.");
3224         if (klass() == ciEnv::current()->Class_klass() &&
3225             (this->offset() == java_lang_Class::klass_offset_in_bytes() ||
3226              this->offset() == java_lang_Class::array_klass_offset_in_bytes())) {
3227           // Special hidden fields from the Class.
3228           assert(this->isa_instptr(), "must be an instance ptr.");
3229           _is_ptr_to_narrowoop = false;
3230         } else if (klass() == ciEnv::current()->Class_klass() &&
3231                    this->offset() >= InstanceMirrorKlass::offset_of_static_fields()) {
3232           // Static fields
3233           assert(o != NULL, "must be constant");


3236           if (ik->is_valuetype() && this->offset() == ik->as_value_klass()->default_value_offset()) {
3237             // Special hidden field that contains the oop of the default value type
3238             basic_elem_type = T_VALUETYPE;
3239           } else {
3240             ciField* field = ik->get_field_by_offset(this->offset(), true);
3241             assert(field != NULL, "missing field");
3242             basic_elem_type = field->layout_type();
3243           }
3244           _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
3245                                                        basic_elem_type == T_VALUETYPE ||
3246                                                        basic_elem_type == T_ARRAY);
3247         } else {
3248           // Instance fields which contains a compressed oop references.
3249           ciInstanceKlass* ik = klass()->as_instance_klass();
3250           ciField* field = ik->get_field_by_offset(this->offset(), false);
3251           if (field != NULL) {
3252             BasicType basic_elem_type = field->layout_type();
3253             _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
3254                                                          basic_elem_type == T_VALUETYPE ||
3255                                                          basic_elem_type == T_ARRAY);
3256             assert(basic_elem_type != T_VALUETYPEPTR, "unexpected type");
3257           } else if (klass()->equals(ciEnv::current()->Object_klass())) {
3258             // Compile::find_alias_type() cast exactness on all types to verify
3259             // that it does not affect alias type.
3260             _is_ptr_to_narrowoop = UseCompressedOops;
3261           } else {
3262             // Type for the copy start in LibraryCallKit::inline_native_clone().
3263             _is_ptr_to_narrowoop = UseCompressedOops;
3264           }
3265         }
3266       }
3267     }
3268   }
3269 #endif
3270 }
3271 
3272 //------------------------------make-------------------------------------------
3273 const TypeOopPtr *TypeOopPtr::make(PTR ptr, Offset offset, int instance_id,
3274                                    const TypePtr* speculative, int inline_depth) {
3275   assert(ptr != Constant, "no constant generic pointers");
3276   ciKlass*  k = Compile::current()->env()->Object_klass();


5588   return (TypeFunc*)(new TypeFunc(domain_sig, domain_cc, range_sig, range_cc))->hashcons();
5589 }
5590 
5591 const TypeFunc *TypeFunc::make(const TypeTuple *domain, const TypeTuple *range) {
5592   return make(domain, domain, range, range);
5593 }
5594 
5595 //------------------------------make-------------------------------------------
5596 const TypeFunc *TypeFunc::make(ciMethod* method) {
5597   Compile* C = Compile::current();
5598   const TypeFunc* tf = C->last_tf(method); // check cache
5599   if (tf != NULL)  return tf;  // The hit rate here is almost 50%.
5600   const TypeTuple *domain_sig, *domain_cc;
5601   // Value type arguments are not passed by reference, instead each
5602   // field of the value type is passed as an argument. We maintain 2
5603   // views of the argument list here: one based on the signature (with
5604   // a value type argument as a single slot), one based on the actual
5605   // calling convention (with a value type argument as a list of its
5606   // fields).
5607   if (method->is_static()) {
5608     domain_sig = TypeTuple::make_domain(NULL, method->signature(), false);
5609     domain_cc = TypeTuple::make_domain(NULL, method->signature(), ValueTypePassFieldsAsArgs);
5610   } else {
5611     domain_sig = TypeTuple::make_domain(method->holder(), method->signature(), false);
5612     domain_cc = TypeTuple::make_domain(method->holder(), method->signature(), ValueTypePassFieldsAsArgs);
5613   }
5614   const TypeTuple *range_sig = TypeTuple::make_range(method->signature(), false);
5615   const TypeTuple *range_cc = TypeTuple::make_range(method->signature(), ValueTypeReturnedAsFields);
5616   tf = TypeFunc::make(domain_sig, domain_cc, range_sig, range_cc);
5617   C->set_last_tf(method, tf);  // fill cache
5618   return tf;
5619 }
5620 
5621 //------------------------------meet-------------------------------------------
5622 // Compute the MEET of two types.  It returns a new Type object.
5623 const Type *TypeFunc::xmeet( const Type *t ) const {
5624   // Perform a fast test for common case; meeting the same types together.
5625   if( this == t ) return this;  // Meeting same type-rep?
5626 
5627   // Current "this->_base" is Func
5628   switch (t->base()) {          // switch on original type
5629 
5630   case Bottom:                  // Ye Olde Default
5631     return t;
5632 




 121   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY
 122   { Bad,             T_ILLEGAL,    "vectorz:",      false, 0,                    relocInfo::none          },  // VectorZ
 123 #elif defined(S390)
 124   { Bad,             T_ILLEGAL,    "vectors:",      false, 0,                    relocInfo::none          },  // VectorS
 125   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_RegL,              relocInfo::none          },  // VectorD
 126   { Bad,             T_ILLEGAL,    "vectorx:",      false, 0,                    relocInfo::none          },  // VectorX
 127   { Bad,             T_ILLEGAL,    "vectory:",      false, 0,                    relocInfo::none          },  // VectorY
 128   { Bad,             T_ILLEGAL,    "vectorz:",      false, 0,                    relocInfo::none          },  // VectorZ
 129 #else // all other
 130   { Bad,             T_ILLEGAL,    "vectors:",      false, Op_VecS,              relocInfo::none          },  // VectorS
 131   { Bad,             T_ILLEGAL,    "vectord:",      false, Op_VecD,              relocInfo::none          },  // VectorD
 132   { Bad,             T_ILLEGAL,    "vectorx:",      false, Op_VecX,              relocInfo::none          },  // VectorX
 133   { Bad,             T_ILLEGAL,    "vectory:",      false, Op_VecY,              relocInfo::none          },  // VectorY
 134   { Bad,             T_ILLEGAL,    "vectorz:",      false, Op_VecZ,              relocInfo::none          },  // VectorZ
 135 #endif
 136   { Bad,             T_VALUETYPE,  "value:",        false, Node::NotAMachineReg, relocInfo::none          },  // ValueType
 137   { Bad,             T_ADDRESS,    "anyptr:",       false, Op_RegP,              relocInfo::none          },  // AnyPtr
 138   { Bad,             T_ADDRESS,    "rawptr:",       false, Op_RegP,              relocInfo::none          },  // RawPtr
 139   { Bad,             T_OBJECT,     "oop:",          true,  Op_RegP,              relocInfo::oop_type      },  // OopPtr
 140   { Bad,             T_OBJECT,     "inst:",         true,  Op_RegP,              relocInfo::oop_type      },  // InstPtr

 141   { Bad,             T_OBJECT,     "ary:",          true,  Op_RegP,              relocInfo::oop_type      },  // AryPtr
 142   { Bad,             T_METADATA,   "metadata:",     false, Op_RegP,              relocInfo::metadata_type },  // MetadataPtr
 143   { Bad,             T_METADATA,   "klass:",        false, Op_RegP,              relocInfo::metadata_type },  // KlassPtr
 144   { Bad,             T_OBJECT,     "func",          false, 0,                    relocInfo::none          },  // Function
 145   { Abio,            T_ILLEGAL,    "abIO",          false, 0,                    relocInfo::none          },  // Abio
 146   { Return_Address,  T_ADDRESS,    "return_address",false, Op_RegP,              relocInfo::none          },  // Return_Address
 147   { Memory,          T_ILLEGAL,    "memory",        false, 0,                    relocInfo::none          },  // Memory
 148   { FloatBot,        T_FLOAT,      "float_top",     false, Op_RegF,              relocInfo::none          },  // FloatTop
 149   { FloatCon,        T_FLOAT,      "ftcon:",        false, Op_RegF,              relocInfo::none          },  // FloatCon
 150   { FloatTop,        T_FLOAT,      "float",         false, Op_RegF,              relocInfo::none          },  // FloatBot
 151   { DoubleBot,       T_DOUBLE,     "double_top",    false, Op_RegD,              relocInfo::none          },  // DoubleTop
 152   { DoubleCon,       T_DOUBLE,     "dblcon:",       false, Op_RegD,              relocInfo::none          },  // DoubleCon
 153   { DoubleTop,       T_DOUBLE,     "double",        false, Op_RegD,              relocInfo::none          },  // DoubleBot
 154   { Top,             T_ILLEGAL,    "bottom",        false, 0,                    relocInfo::none          }   // Bottom
 155 };
 156 
 157 // Map ideal registers (machine types) to ideal types
 158 const Type *Type::mreg2type[_last_machine_leaf];
 159 
 160 // Map basic types to canonical Type* pointers.


 624     TypeAryPtr::OOPS  = TypeAryPtr::NARROWOOPS;
 625   } else
 626 #endif
 627   {
 628     // There is no shared klass for Object[].  See note in TypeAryPtr::klass().
 629     TypeAryPtr::OOPS  = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInstPtr::BOTTOM,TypeInt::POS), NULL /*ciArrayKlass::make(o)*/,  false,  Offset::bottom);
 630   }
 631   TypeAryPtr::BYTES   = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::BYTE      ,TypeInt::POS), ciTypeArrayKlass::make(T_BYTE),   true,  Offset::bottom);
 632   TypeAryPtr::SHORTS  = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::SHORT     ,TypeInt::POS), ciTypeArrayKlass::make(T_SHORT),  true,  Offset::bottom);
 633   TypeAryPtr::CHARS   = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::CHAR      ,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR),   true,  Offset::bottom);
 634   TypeAryPtr::INTS    = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeInt::INT       ,TypeInt::POS), ciTypeArrayKlass::make(T_INT),    true,  Offset::bottom);
 635   TypeAryPtr::LONGS   = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeLong::LONG     ,TypeInt::POS), ciTypeArrayKlass::make(T_LONG),   true,  Offset::bottom);
 636   TypeAryPtr::FLOATS  = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::FLOAT        ,TypeInt::POS), ciTypeArrayKlass::make(T_FLOAT),  true,  Offset::bottom);
 637   TypeAryPtr::DOUBLES = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::DOUBLE       ,TypeInt::POS), ciTypeArrayKlass::make(T_DOUBLE), true,  Offset::bottom);
 638 
 639   // Nobody should ask _array_body_type[T_NARROWOOP]. Use NULL as assert.
 640   TypeAryPtr::_array_body_type[T_NARROWOOP] = NULL;
 641   TypeAryPtr::_array_body_type[T_OBJECT]  = TypeAryPtr::OOPS;
 642   TypeAryPtr::_array_body_type[T_VALUETYPE] = TypeAryPtr::OOPS;
 643   TypeAryPtr::_array_body_type[T_ARRAY]   = TypeAryPtr::OOPS; // arrays are stored in oop arrays

 644   TypeAryPtr::_array_body_type[T_BYTE]    = TypeAryPtr::BYTES;
 645   TypeAryPtr::_array_body_type[T_BOOLEAN] = TypeAryPtr::BYTES;  // boolean[] is a byte array
 646   TypeAryPtr::_array_body_type[T_SHORT]   = TypeAryPtr::SHORTS;
 647   TypeAryPtr::_array_body_type[T_CHAR]    = TypeAryPtr::CHARS;
 648   TypeAryPtr::_array_body_type[T_INT]     = TypeAryPtr::INTS;
 649   TypeAryPtr::_array_body_type[T_LONG]    = TypeAryPtr::LONGS;
 650   TypeAryPtr::_array_body_type[T_FLOAT]   = TypeAryPtr::FLOATS;
 651   TypeAryPtr::_array_body_type[T_DOUBLE]  = TypeAryPtr::DOUBLES;
 652 
 653   TypeKlassPtr::OBJECT = TypeKlassPtr::make(TypePtr::NotNull, current->env()->Object_klass(), Offset(0) );
 654   TypeKlassPtr::OBJECT_OR_NULL = TypeKlassPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), Offset(0) );
 655 
 656   const Type **fi2c = TypeTuple::fields(2);
 657   fi2c[TypeFunc::Parms+0] = TypeInstPtr::BOTTOM; // Method*
 658   fi2c[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // argument pointer
 659   TypeTuple::START_I2C = TypeTuple::make(TypeFunc::Parms+2, fi2c);
 660 
 661   const Type **intpair = TypeTuple::fields(2);
 662   intpair[0] = TypeInt::INT;
 663   intpair[1] = TypeInt::INT;


 672   intccpair[0] = TypeInt::INT;
 673   intccpair[1] = TypeInt::CC;
 674   TypeTuple::INT_CC_PAIR = TypeTuple::make(2, intccpair);
 675 
 676   const Type **longccpair = TypeTuple::fields(2);
 677   longccpair[0] = TypeLong::LONG;
 678   longccpair[1] = TypeInt::CC;
 679   TypeTuple::LONG_CC_PAIR = TypeTuple::make(2, longccpair);
 680 
 681   _const_basic_type[T_NARROWOOP]   = TypeNarrowOop::BOTTOM;
 682   _const_basic_type[T_NARROWKLASS] = Type::BOTTOM;
 683   _const_basic_type[T_BOOLEAN]     = TypeInt::BOOL;
 684   _const_basic_type[T_CHAR]        = TypeInt::CHAR;
 685   _const_basic_type[T_BYTE]        = TypeInt::BYTE;
 686   _const_basic_type[T_SHORT]       = TypeInt::SHORT;
 687   _const_basic_type[T_INT]         = TypeInt::INT;
 688   _const_basic_type[T_LONG]        = TypeLong::LONG;
 689   _const_basic_type[T_FLOAT]       = Type::FLOAT;
 690   _const_basic_type[T_DOUBLE]      = Type::DOUBLE;
 691   _const_basic_type[T_OBJECT]      = TypeInstPtr::BOTTOM;

 692   _const_basic_type[T_ARRAY]       = TypeInstPtr::BOTTOM; // there is no separate bottom for arrays
 693   _const_basic_type[T_VALUETYPE]   = TypeInstPtr::BOTTOM;
 694   _const_basic_type[T_VOID]        = TypePtr::NULL_PTR;   // reflection represents void this way
 695   _const_basic_type[T_ADDRESS]     = TypeRawPtr::BOTTOM;  // both interpreter return addresses & random raw ptrs
 696   _const_basic_type[T_CONFLICT]    = Type::BOTTOM;        // why not?
 697 
 698   _zero_type[T_NARROWOOP]   = TypeNarrowOop::NULL_PTR;
 699   _zero_type[T_NARROWKLASS] = TypeNarrowKlass::NULL_PTR;
 700   _zero_type[T_BOOLEAN]     = TypeInt::ZERO;     // false == 0
 701   _zero_type[T_CHAR]        = TypeInt::ZERO;     // '\0' == 0
 702   _zero_type[T_BYTE]        = TypeInt::ZERO;     // 0x00 == 0
 703   _zero_type[T_SHORT]       = TypeInt::ZERO;     // 0x0000 == 0
 704   _zero_type[T_INT]         = TypeInt::ZERO;
 705   _zero_type[T_LONG]        = TypeLong::ZERO;
 706   _zero_type[T_FLOAT]       = TypeF::ZERO;
 707   _zero_type[T_DOUBLE]      = TypeD::ZERO;
 708   _zero_type[T_OBJECT]      = TypePtr::NULL_PTR;

 709   _zero_type[T_ARRAY]       = TypePtr::NULL_PTR; // null array is null oop
 710   _zero_type[T_VALUETYPE]   = TypePtr::NULL_PTR;
 711   _zero_type[T_ADDRESS]     = TypePtr::NULL_PTR; // raw pointers use the same null
 712   _zero_type[T_VOID]        = Type::TOP;         // the only void value is no value at all
 713 
 714   // get_zero_type() should not happen for T_CONFLICT
 715   _zero_type[T_CONFLICT]= NULL;
 716 
 717   // Vector predefined types, it needs initialized _const_basic_type[].
 718   if (Matcher::vector_size_supported(T_BYTE,4)) {
 719     TypeVect::VECTS = TypeVect::make(T_BYTE,4);
 720   }
 721   if (Matcher::vector_size_supported(T_FLOAT,2)) {
 722     TypeVect::VECTD = TypeVect::make(T_FLOAT,2);
 723   }
 724   if (Matcher::vector_size_supported(T_FLOAT,4)) {
 725     TypeVect::VECTX = TypeVect::make(T_FLOAT,4);
 726   }
 727   if (Matcher::vector_size_supported(T_FLOAT,8)) {
 728     TypeVect::VECTY = TypeVect::make(T_FLOAT,8);


1019   Bottom,       // Top
1020   Bad,          // Int - handled in v-call
1021   Bad,          // Long - handled in v-call
1022   Half,         // Half
1023   Bad,          // NarrowOop - handled in v-call
1024   Bad,          // NarrowKlass - handled in v-call
1025 
1026   Bad,          // Tuple - handled in v-call
1027   Bad,          // Array - handled in v-call
1028   Bad,          // VectorS - handled in v-call
1029   Bad,          // VectorD - handled in v-call
1030   Bad,          // VectorX - handled in v-call
1031   Bad,          // VectorY - handled in v-call
1032   Bad,          // VectorZ - handled in v-call
1033   Bad,          // ValueType - handled in v-call
1034 
1035   Bad,          // AnyPtr - handled in v-call
1036   Bad,          // RawPtr - handled in v-call
1037   Bad,          // OopPtr - handled in v-call
1038   Bad,          // InstPtr - handled in v-call

1039   Bad,          // AryPtr - handled in v-call
1040 
1041   Bad,          //  MetadataPtr - handled in v-call
1042   Bad,          // KlassPtr - handled in v-call
1043 
1044   Bad,          // Function - handled in v-call
1045   Abio,         // Abio
1046   Return_Address,// Return_Address
1047   Memory,       // Memory
1048   FloatBot,     // FloatTop
1049   FloatCon,     // FloatCon
1050   FloatTop,     // FloatBot
1051   DoubleBot,    // DoubleTop
1052   DoubleCon,    // DoubleCon
1053   DoubleTop,    // DoubleBot
1054   Top           // Bottom
1055 };
1056 
1057 const Type *Type::xdual() const {
1058   // Note: the base() accessor asserts the sanity of _base.


1905 
1906 bool TypeLong::empty(void) const {
1907   return _lo > _hi;
1908 }
1909 
1910 //=============================================================================
1911 // Convenience common pre-built types.
1912 const TypeTuple *TypeTuple::IFBOTH;     // Return both arms of IF as reachable
1913 const TypeTuple *TypeTuple::IFFALSE;
1914 const TypeTuple *TypeTuple::IFTRUE;
1915 const TypeTuple *TypeTuple::IFNEITHER;
1916 const TypeTuple *TypeTuple::LOOPBODY;
1917 const TypeTuple *TypeTuple::MEMBAR;
1918 const TypeTuple *TypeTuple::STORECONDITIONAL;
1919 const TypeTuple *TypeTuple::START_I2C;
1920 const TypeTuple *TypeTuple::INT_PAIR;
1921 const TypeTuple *TypeTuple::LONG_PAIR;
1922 const TypeTuple *TypeTuple::INT_CC_PAIR;
1923 const TypeTuple *TypeTuple::LONG_CC_PAIR;
1924 
1925 static void collect_value_fields(ciValueKlass* vk, const Type** field_array, uint& pos, SigEntry* res_entry = NULL) {
1926   for (int j = 0; j < vk->nof_nonstatic_fields(); j++) {
1927     if (res_entry != NULL && (int)pos == (res_entry->_offset + TypeFunc::Parms)) {
1928       // Add reserved entry
1929       field_array[pos++] = Type::get_const_basic_type(res_entry->_bt);
1930       if (res_entry->_bt == T_LONG || res_entry->_bt == T_DOUBLE) {
1931         field_array[pos++] = Type::HALF;
1932       }
1933     }
1934     ciField* field = vk->nonstatic_field_at(j);
1935     BasicType bt = field->type()->basic_type();
1936     const Type* ft = Type::get_const_type(field->type());
1937     field_array[pos++] = ft;
1938     if (bt == T_LONG || bt == T_DOUBLE) {
1939       field_array[pos++] = Type::HALF;
1940     }
1941   }
1942 }
1943 
1944 //------------------------------make-------------------------------------------
1945 // Make a TypeTuple from the range of a method signature
1946 const TypeTuple *TypeTuple::make_range(ciSignature* sig, bool ret_vt_fields) {
1947   ciType* return_type = sig->return_type();
1948   return make_range(return_type, sig->returns_never_null(), ret_vt_fields);
1949 }
1950 
1951 const TypeTuple *TypeTuple::make_range(ciType* return_type, bool never_null, bool ret_vt_fields) {
1952   uint arg_cnt = 0;
1953   if (ret_vt_fields) {


1983   case T_VALUETYPE:
1984     if (ret_vt_fields) {
1985       ciValueKlass* vk = (ciValueKlass*)return_type;
1986       uint pos = TypeFunc::Parms;
1987       field_array[pos] = TypePtr::BOTTOM;
1988       pos++;
1989       collect_value_fields(vk, field_array, pos);
1990     } else {
1991       field_array[TypeFunc::Parms] = get_const_type(return_type)->join_speculative(never_null ? TypePtr::NOTNULL : TypePtr::BOTTOM);
1992     }
1993     break;
1994   case T_VOID:
1995     break;
1996   default:
1997     ShouldNotReachHere();
1998   }
1999   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt, field_array))->hashcons();
2000 }
2001 
2002 // Make a TypeTuple from the domain of a method signature
2003 const TypeTuple *TypeTuple::make_domain(ciMethod* method, bool vt_fields_as_args) {
2004   ciInstanceKlass* recv = method->is_static() ? NULL : method->holder();
2005   ciSignature* sig = method->signature();
2006   uint arg_cnt = sig->size();
2007 
2008   int vt_extra = 0;
2009   SigEntry res_entry = method->get_Method()->get_res_entry();
2010   if (vt_fields_as_args) {
2011     for (int i = 0; i < sig->count(); i++) {
2012       ciType* type = sig->type_at(i);
2013       if (type->is_valuetype()) {
2014         vt_extra += type->as_value_klass()->value_arg_slots()-1;


2015       }
2016     }
2017     if (res_entry._offset != -1) {
2018       // Account for the reserved stack slot
2019       vt_extra += type2size[res_entry._bt];
2020     }
2021   }
2022 
2023   uint pos = TypeFunc::Parms;
2024   const Type **field_array;
2025   if (recv != NULL) {
2026     arg_cnt++;
2027     // TODO for now, don't scalarize value type receivers because of interface calls
2028     //bool vt_fields_for_recv = vt_fields_as_args && recv->is_valuetype();
2029     bool vt_fields_for_recv = false;
2030     if (vt_fields_for_recv) {
2031       vt_extra += recv->as_value_klass()->value_arg_slots()-1;

2032     }
2033     field_array = fields(arg_cnt + vt_extra);
2034     // Use get_const_type here because it respects UseUniqueSubclasses:
2035     if (vt_fields_for_recv) {
2036       collect_value_fields(recv->as_value_klass(), field_array, pos, &res_entry);

2037     } else {
2038       field_array[pos++] = get_const_type(recv)->join_speculative(TypePtr::NOTNULL);
2039     }
2040   } else {
2041     field_array = fields(arg_cnt + vt_extra);
2042   }
2043 
2044   int i = 0;
2045   while (pos < TypeFunc::Parms + arg_cnt + vt_extra) {
2046     ciType* type = sig->type_at(i);
2047 
2048     switch (type->basic_type()) {
2049     case T_LONG:
2050       field_array[pos++] = TypeLong::LONG;
2051       field_array[pos++] = Type::HALF;
2052       break;
2053     case T_DOUBLE:
2054       field_array[pos++] = Type::DOUBLE;
2055       field_array[pos++] = Type::HALF;
2056       break;
2057     case T_OBJECT:
2058     case T_ARRAY:
2059     case T_FLOAT:
2060     case T_INT:
2061       field_array[pos++] = get_const_type(type);
2062       break;
2063     case T_BOOLEAN:
2064     case T_CHAR:
2065     case T_BYTE:
2066     case T_SHORT:
2067       field_array[pos++] = TypeInt::INT;
2068       break;
2069     case T_VALUETYPE: {

2070       if (vt_fields_as_args) {
2071         collect_value_fields(type->as_value_klass(), field_array, pos, &res_entry);

2072       } else {
2073         field_array[pos++] = get_const_type(type)->join_speculative(sig->is_never_null_at(i) ? TypePtr::NOTNULL : TypePtr::BOTTOM);
2074       }
2075       break;
2076     }
2077     default:
2078       ShouldNotReachHere();
2079     }
2080     i++;
2081 
2082     if (vt_fields_as_args && (int)pos == (res_entry._offset + TypeFunc::Parms)) {
2083       // Add reserved entry
2084       field_array[pos++] = Type::get_const_basic_type(res_entry._bt);
2085       if (res_entry._bt == T_LONG || res_entry._bt == T_DOUBLE) {
2086         field_array[pos++] = Type::HALF;
2087       }
2088     }
2089   }
2090   assert(pos == TypeFunc::Parms + arg_cnt + vt_extra, "wrong number of arguments");
2091 
2092   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt + vt_extra, field_array))->hashcons();
2093 }
2094 
2095 const TypeTuple *TypeTuple::make( uint cnt, const Type **fields ) {
2096   return (TypeTuple*)(new TypeTuple(cnt,fields))->hashcons();
2097 }
2098 
2099 //------------------------------fields-----------------------------------------
2100 // Subroutine call type with space allocated for argument types
2101 // Memory for Control, I_O, Memory, FramePtr, and ReturnAdr is allocated implicitly
2102 const Type **TypeTuple::fields( uint arg_cnt ) {
2103   const Type **flds = (const Type **)(Compile::current()->type_arena()->Amalloc_4((TypeFunc::Parms+arg_cnt)*sizeof(Type*) ));
2104   flds[TypeFunc::Control  ] = Type::CONTROL;
2105   flds[TypeFunc::I_O      ] = Type::ABIO;
2106   flds[TypeFunc::Memory   ] = Type::MEMORY;
2107   flds[TypeFunc::FramePtr ] = TypeRawPtr::BOTTOM;
2108   flds[TypeFunc::ReturnAdr] = Type::RETURN_ADDRESS;


3205     _is_ptr_to_boxed_value = k->as_instance_klass()->is_boxed_value_offset(offset.get());
3206   }
3207 #ifdef _LP64
3208   if (this->offset() > 0 || this->offset() == Type::OffsetTop || this->offset() == Type::OffsetBot) {
3209     if (this->offset() == oopDesc::klass_offset_in_bytes()) {
3210       _is_ptr_to_narrowklass = UseCompressedClassPointers;
3211     } else if (klass() == NULL) {
3212       // Array with unknown body type
3213       assert(this->isa_aryptr(), "only arrays without klass");
3214       _is_ptr_to_narrowoop = UseCompressedOops;
3215     } else if (UseCompressedOops && this->isa_aryptr() && this->offset() != arrayOopDesc::length_offset_in_bytes()) {
3216       if (klass()->is_obj_array_klass()) {
3217         _is_ptr_to_narrowoop = true;
3218       } else if (klass()->is_value_array_klass() && field_offset != Offset::top && field_offset != Offset::bottom) {
3219         // Check if the field of the value type array element contains oops
3220         ciValueKlass* vk = klass()->as_value_array_klass()->element_klass()->as_value_klass();
3221         int foffset = field_offset.get() + vk->first_field_offset();
3222         ciField* field = vk->get_field_by_offset(foffset, false);
3223         assert(field != NULL, "missing field");
3224         BasicType bt = field->layout_type();

3225         _is_ptr_to_narrowoop = (bt == T_OBJECT || bt == T_ARRAY || T_VALUETYPE);
3226       }
3227     } else if (klass()->is_instance_klass()) {
3228       if (this->isa_klassptr()) {
3229         // Perm objects don't use compressed references
3230       } else if (_offset == Offset::bottom || _offset == Offset::top) {
3231         // unsafe access
3232         _is_ptr_to_narrowoop = UseCompressedOops;
3233       } else { // exclude unsafe ops
3234         assert(this->isa_instptr(), "must be an instance ptr.");
3235         if (klass() == ciEnv::current()->Class_klass() &&
3236             (this->offset() == java_lang_Class::klass_offset_in_bytes() ||
3237              this->offset() == java_lang_Class::array_klass_offset_in_bytes())) {
3238           // Special hidden fields from the Class.
3239           assert(this->isa_instptr(), "must be an instance ptr.");
3240           _is_ptr_to_narrowoop = false;
3241         } else if (klass() == ciEnv::current()->Class_klass() &&
3242                    this->offset() >= InstanceMirrorKlass::offset_of_static_fields()) {
3243           // Static fields
3244           assert(o != NULL, "must be constant");


3247           if (ik->is_valuetype() && this->offset() == ik->as_value_klass()->default_value_offset()) {
3248             // Special hidden field that contains the oop of the default value type
3249             basic_elem_type = T_VALUETYPE;
3250           } else {
3251             ciField* field = ik->get_field_by_offset(this->offset(), true);
3252             assert(field != NULL, "missing field");
3253             basic_elem_type = field->layout_type();
3254           }
3255           _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
3256                                                        basic_elem_type == T_VALUETYPE ||
3257                                                        basic_elem_type == T_ARRAY);
3258         } else {
3259           // Instance fields which contains a compressed oop references.
3260           ciInstanceKlass* ik = klass()->as_instance_klass();
3261           ciField* field = ik->get_field_by_offset(this->offset(), false);
3262           if (field != NULL) {
3263             BasicType basic_elem_type = field->layout_type();
3264             _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT ||
3265                                                          basic_elem_type == T_VALUETYPE ||
3266                                                          basic_elem_type == T_ARRAY);

3267           } else if (klass()->equals(ciEnv::current()->Object_klass())) {
3268             // Compile::find_alias_type() cast exactness on all types to verify
3269             // that it does not affect alias type.
3270             _is_ptr_to_narrowoop = UseCompressedOops;
3271           } else {
3272             // Type for the copy start in LibraryCallKit::inline_native_clone().
3273             _is_ptr_to_narrowoop = UseCompressedOops;
3274           }
3275         }
3276       }
3277     }
3278   }
3279 #endif
3280 }
3281 
3282 //------------------------------make-------------------------------------------
3283 const TypeOopPtr *TypeOopPtr::make(PTR ptr, Offset offset, int instance_id,
3284                                    const TypePtr* speculative, int inline_depth) {
3285   assert(ptr != Constant, "no constant generic pointers");
3286   ciKlass*  k = Compile::current()->env()->Object_klass();


5598   return (TypeFunc*)(new TypeFunc(domain_sig, domain_cc, range_sig, range_cc))->hashcons();
5599 }
5600 
5601 const TypeFunc *TypeFunc::make(const TypeTuple *domain, const TypeTuple *range) {
5602   return make(domain, domain, range, range);
5603 }
5604 
5605 //------------------------------make-------------------------------------------
5606 const TypeFunc *TypeFunc::make(ciMethod* method) {
5607   Compile* C = Compile::current();
5608   const TypeFunc* tf = C->last_tf(method); // check cache
5609   if (tf != NULL)  return tf;  // The hit rate here is almost 50%.
5610   const TypeTuple *domain_sig, *domain_cc;
5611   // Value type arguments are not passed by reference, instead each
5612   // field of the value type is passed as an argument. We maintain 2
5613   // views of the argument list here: one based on the signature (with
5614   // a value type argument as a single slot), one based on the actual
5615   // calling convention (with a value type argument as a list of its
5616   // fields).
5617   if (method->is_static()) {
5618     domain_sig = TypeTuple::make_domain(method, false);
5619     domain_cc = TypeTuple::make_domain(method, method->get_Method()->has_scalarized_args());
5620   } else {
5621     domain_sig = TypeTuple::make_domain(method, false);
5622     domain_cc = TypeTuple::make_domain(method, method->get_Method()->has_scalarized_args());
5623   }
5624   const TypeTuple *range_sig = TypeTuple::make_range(method->signature(), false);
5625   const TypeTuple *range_cc = TypeTuple::make_range(method->signature(), ValueTypeReturnedAsFields);
5626   tf = TypeFunc::make(domain_sig, domain_cc, range_sig, range_cc);
5627   C->set_last_tf(method, tf);  // fill cache
5628   return tf;
5629 }
5630 
5631 //------------------------------meet-------------------------------------------
5632 // Compute the MEET of two types.  It returns a new Type object.
5633 const Type *TypeFunc::xmeet( const Type *t ) const {
5634   // Perform a fast test for common case; meeting the same types together.
5635   if( this == t ) return this;  // Meeting same type-rep?
5636 
5637   // Current "this->_base" is Func
5638   switch (t->base()) {          // switch on original type
5639 
5640   case Bottom:                  // Ye Olde Default
5641     return t;
5642 


< prev index next >