< prev index next >

src/share/vm/opto/type.cpp

Print this page




2006     } else {
2007       field_array[TypeFunc::Parms] = get_const_type(return_type);
2008     }
2009     break;
2010   case T_VOID:
2011     break;
2012   default:
2013     ShouldNotReachHere();
2014   }
2015   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt, field_array))->hashcons();
2016 }
2017 
2018 // Make a TypeTuple from the domain of a method signature
2019 const TypeTuple *TypeTuple::make_domain(ciInstanceKlass* recv, ciSignature* sig, bool vt_fields_as_args) {
2020   uint arg_cnt = sig->size();
2021 
2022   int vt_extra = 0;
2023   if (vt_fields_as_args) {
2024     for (int i = 0; i < sig->count(); i++) {
2025       ciType* type = sig->type_at(i);
2026       if (type->basic_type() == T_VALUETYPE) {
2027         assert(type->is_valuetype(), "inconsistent type");
2028         ciValueKlass* vk = (ciValueKlass*)type;
2029         vt_extra += vk->value_arg_slots()-1;
2030       }
2031     }
2032     assert(((int)arg_cnt) + vt_extra >= 0, "negative number of actual arguments?");
2033   }
2034 
2035   uint pos = TypeFunc::Parms;
2036   const Type **field_array;
2037   if (recv != NULL) {
2038     arg_cnt++;
2039     bool vt_fields_for_recv = vt_fields_as_args && recv->is_valuetype() &&
2040       recv != ciEnv::current()->___Value_klass();
2041     if (vt_fields_for_recv) {
2042       ciValueKlass* vk = (ciValueKlass*)recv;
2043       vt_extra += vk->value_arg_slots()-1;
2044     }
2045     field_array = fields(arg_cnt + vt_extra);
2046     // Use get_const_type here because it respects UseUniqueSubclasses:


2064       field_array[pos++] = Type::HALF;
2065       break;
2066     case T_DOUBLE:
2067       field_array[pos++] = Type::DOUBLE;
2068       field_array[pos++] = Type::HALF;
2069       break;
2070     case T_OBJECT:
2071     case T_ARRAY:
2072     case T_FLOAT:
2073     case T_INT:
2074       field_array[pos++] = get_const_type(type);
2075       break;
2076     case T_BOOLEAN:
2077     case T_CHAR:
2078     case T_BYTE:
2079     case T_SHORT:
2080       field_array[pos++] = TypeInt::INT;
2081       break;
2082     case T_VALUETYPE: {
2083       assert(type->is_valuetype(), "inconsistent type");
2084       assert(type != ciEnv::current()->___Value_klass(), "unsupported");
2085       if (vt_fields_as_args) {
2086         ciValueKlass* vk = (ciValueKlass*)type;
2087         collect_value_fields(vk, field_array, pos);
2088       } else {
2089         field_array[pos++] = get_const_type(type);
2090       }
2091       break;
2092     }
2093     default:
2094       ShouldNotReachHere();
2095     }
2096     i++;
2097   }
2098   assert(pos == TypeFunc::Parms + arg_cnt + vt_extra, "wrong number of arguments");
2099 
2100   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt + vt_extra, field_array))->hashcons();
2101 }
2102 
2103 const TypeTuple *TypeTuple::make( uint cnt, const Type **fields ) {
2104   return (TypeTuple*)(new TypeTuple(cnt,fields))->hashcons();
2105 }




2006     } else {
2007       field_array[TypeFunc::Parms] = get_const_type(return_type);
2008     }
2009     break;
2010   case T_VOID:
2011     break;
2012   default:
2013     ShouldNotReachHere();
2014   }
2015   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt, field_array))->hashcons();
2016 }
2017 
2018 // Make a TypeTuple from the domain of a method signature
2019 const TypeTuple *TypeTuple::make_domain(ciInstanceKlass* recv, ciSignature* sig, bool vt_fields_as_args) {
2020   uint arg_cnt = sig->size();
2021 
2022   int vt_extra = 0;
2023   if (vt_fields_as_args) {
2024     for (int i = 0; i < sig->count(); i++) {
2025       ciType* type = sig->type_at(i);
2026       if (type->basic_type() == T_VALUETYPE && type != ciEnv::current()->___Value_klass()) {
2027         assert(type->is_valuetype(), "inconsistent type");
2028         ciValueKlass* vk = (ciValueKlass*)type;
2029         vt_extra += vk->value_arg_slots()-1;
2030       }
2031     }
2032     assert(((int)arg_cnt) + vt_extra >= 0, "negative number of actual arguments?");
2033   }
2034 
2035   uint pos = TypeFunc::Parms;
2036   const Type **field_array;
2037   if (recv != NULL) {
2038     arg_cnt++;
2039     bool vt_fields_for_recv = vt_fields_as_args && recv->is_valuetype() &&
2040       recv != ciEnv::current()->___Value_klass();
2041     if (vt_fields_for_recv) {
2042       ciValueKlass* vk = (ciValueKlass*)recv;
2043       vt_extra += vk->value_arg_slots()-1;
2044     }
2045     field_array = fields(arg_cnt + vt_extra);
2046     // Use get_const_type here because it respects UseUniqueSubclasses:


2064       field_array[pos++] = Type::HALF;
2065       break;
2066     case T_DOUBLE:
2067       field_array[pos++] = Type::DOUBLE;
2068       field_array[pos++] = Type::HALF;
2069       break;
2070     case T_OBJECT:
2071     case T_ARRAY:
2072     case T_FLOAT:
2073     case T_INT:
2074       field_array[pos++] = get_const_type(type);
2075       break;
2076     case T_BOOLEAN:
2077     case T_CHAR:
2078     case T_BYTE:
2079     case T_SHORT:
2080       field_array[pos++] = TypeInt::INT;
2081       break;
2082     case T_VALUETYPE: {
2083       assert(type->is_valuetype(), "inconsistent type");
2084       if (vt_fields_as_args && type != ciEnv::current()->___Value_klass()) {

2085         ciValueKlass* vk = (ciValueKlass*)type;
2086         collect_value_fields(vk, field_array, pos);
2087       } else {
2088         field_array[pos++] = get_const_type(type);
2089       }
2090       break;
2091     }
2092     default:
2093       ShouldNotReachHere();
2094     }
2095     i++;
2096   }
2097   assert(pos == TypeFunc::Parms + arg_cnt + vt_extra, "wrong number of arguments");
2098 
2099   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt + vt_extra, field_array))->hashcons();
2100 }
2101 
2102 const TypeTuple *TypeTuple::make( uint cnt, const Type **fields ) {
2103   return (TypeTuple*)(new TypeTuple(cnt,fields))->hashcons();
2104 }


< prev index next >