< prev index next >

src/share/vm/opto/type.cpp

Print this page




1920 const TypeTuple *TypeTuple::LONG_PAIR;
1921 const TypeTuple *TypeTuple::INT_CC_PAIR;
1922 const TypeTuple *TypeTuple::LONG_CC_PAIR;
1923 
1924 static void collect_value_fields(ciValueKlass* vk, const Type** field_array, uint& pos) {
1925   for (int j = 0; j < vk->nof_nonstatic_fields(); j++) {
1926     ciField* f = vk->nonstatic_field_at(j);
1927     BasicType bt = f->type()->basic_type();
1928     assert(bt < T_VALUETYPE && bt >= T_BOOLEAN, "not yet supported");
1929     field_array[pos++] = Type::get_const_type(f->type());
1930     if (bt == T_LONG || bt == T_DOUBLE) {
1931       field_array[pos++] = Type::HALF;
1932     }
1933   }
1934 }
1935 
1936 //------------------------------make-------------------------------------------
1937 // Make a TypeTuple from the range of a method signature
1938 const TypeTuple *TypeTuple::make_range(ciSignature* sig, bool ret_vt_fields) {
1939   ciType* return_type = sig->return_type();




1940   uint arg_cnt = 0;
1941   if (ret_vt_fields) {
1942     ret_vt_fields = return_type->is_valuetype() && ((ciValueKlass*)return_type)->can_be_returned_as_fields();
1943   }
1944   if (ret_vt_fields) {
1945     ciValueKlass* vk = (ciValueKlass*)return_type;
1946     arg_cnt = vk->value_arg_slots()+1;
1947   } else {
1948     arg_cnt = return_type->size();
1949   }
1950 
1951   const Type **field_array = fields(arg_cnt);
1952   switch (return_type->basic_type()) {
1953   case T_LONG:
1954     field_array[TypeFunc::Parms]   = TypeLong::LONG;
1955     field_array[TypeFunc::Parms+1] = Type::HALF;
1956     break;
1957   case T_DOUBLE:
1958     field_array[TypeFunc::Parms]   = Type::DOUBLE;
1959     field_array[TypeFunc::Parms+1] = Type::HALF;
1960     break;
1961   case T_OBJECT:
1962   case T_ARRAY:
1963   case T_BOOLEAN:
1964   case T_CHAR:
1965   case T_FLOAT:
1966   case T_BYTE:
1967   case T_SHORT:
1968   case T_INT:
1969     field_array[TypeFunc::Parms] = get_const_type(return_type);
1970     break;
1971   case T_VALUETYPE:
1972     if (ret_vt_fields) {
1973       ciValueKlass* vk = (ciValueKlass*)return_type;
1974       uint pos = TypeFunc::Parms;
1975       field_array[pos] = TypeKlassPtr::make(vk);
1976       pos++;
1977       collect_value_fields(vk, field_array, pos);
1978     } else {
1979       field_array[TypeFunc::Parms] = get_const_type(return_type);
1980     }
1981     break;
1982   case T_VOID:
1983     break;
1984   default:
1985     ShouldNotReachHere();
1986   }
1987   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt, field_array))->hashcons();
1988 }
1989 
1990 // Make a TypeTuple from the domain of a method signature
1991 const TypeTuple *TypeTuple::make_domain(ciInstanceKlass* recv, ciSignature* sig, bool vt_fields_as_args) {
1992   uint arg_cnt = sig->size();
1993 
1994   int vt_extra = 0;
1995   if (vt_fields_as_args) {




1920 const TypeTuple *TypeTuple::LONG_PAIR;
1921 const TypeTuple *TypeTuple::INT_CC_PAIR;
1922 const TypeTuple *TypeTuple::LONG_CC_PAIR;
1923 
1924 static void collect_value_fields(ciValueKlass* vk, const Type** field_array, uint& pos) {
1925   for (int j = 0; j < vk->nof_nonstatic_fields(); j++) {
1926     ciField* f = vk->nonstatic_field_at(j);
1927     BasicType bt = f->type()->basic_type();
1928     assert(bt < T_VALUETYPE && bt >= T_BOOLEAN, "not yet supported");
1929     field_array[pos++] = Type::get_const_type(f->type());
1930     if (bt == T_LONG || bt == T_DOUBLE) {
1931       field_array[pos++] = Type::HALF;
1932     }
1933   }
1934 }
1935 
1936 //------------------------------make-------------------------------------------
1937 // Make a TypeTuple from the range of a method signature
1938 const TypeTuple *TypeTuple::make_range(ciSignature* sig, bool ret_vt_fields) {
1939   ciType* return_type = sig->return_type();
1940   return make_range(return_type, ret_vt_fields);
1941 }
1942 
1943 const TypeTuple *TypeTuple::make_range(ciType* return_type, bool ret_vt_fields) {
1944   uint arg_cnt = 0;
1945   if (ret_vt_fields) {
1946     ret_vt_fields = return_type->is_valuetype() && ((ciValueKlass*)return_type)->can_be_returned_as_fields();
1947   }
1948   if (ret_vt_fields) {
1949     ciValueKlass* vk = (ciValueKlass*)return_type;
1950     arg_cnt = vk->value_arg_slots()+1;
1951   } else {
1952     arg_cnt = return_type->size();
1953   }
1954 
1955   const Type **field_array = fields(arg_cnt);
1956   switch (return_type->basic_type()) {
1957   case T_LONG:
1958     field_array[TypeFunc::Parms]   = TypeLong::LONG;
1959     field_array[TypeFunc::Parms+1] = Type::HALF;
1960     break;
1961   case T_DOUBLE:
1962     field_array[TypeFunc::Parms]   = Type::DOUBLE;
1963     field_array[TypeFunc::Parms+1] = Type::HALF;
1964     break;
1965   case T_OBJECT:
1966   case T_ARRAY:
1967   case T_BOOLEAN:
1968   case T_CHAR:
1969   case T_FLOAT:
1970   case T_BYTE:
1971   case T_SHORT:
1972   case T_INT:
1973     field_array[TypeFunc::Parms] = get_const_type(return_type);
1974     break;
1975   case T_VALUETYPE:
1976     if (ret_vt_fields) {
1977       ciValueKlass* vk = (ciValueKlass*)return_type;
1978       uint pos = TypeFunc::Parms;
1979       field_array[pos] = TypePtr::BOTTOM;
1980       pos++;
1981       collect_value_fields(vk, field_array, pos);
1982     } else {
1983       field_array[TypeFunc::Parms] = get_const_type(return_type);
1984     }
1985     break;
1986   case T_VOID:
1987     break;
1988   default:
1989     ShouldNotReachHere();
1990   }
1991   return (TypeTuple*)(new TypeTuple(TypeFunc::Parms + arg_cnt, field_array))->hashcons();
1992 }
1993 
1994 // Make a TypeTuple from the domain of a method signature
1995 const TypeTuple *TypeTuple::make_domain(ciInstanceKlass* recv, ciSignature* sig, bool vt_fields_as_args) {
1996   uint arg_cnt = sig->size();
1997 
1998   int vt_extra = 0;
1999   if (vt_fields_as_args) {


< prev index next >