44 assert(basic_type >= T_BOOLEAN && basic_type <= T_CONFLICT, "range check"); 45 _basic_type = basic_type; 46 } 47 48 ciType::ciType(Klass* k) : ciMetadata(k) { 49 _basic_type = k->is_array_klass() ? T_ARRAY : (k->is_value() ? T_VALUETYPE : T_OBJECT); 50 } 51 52 53 // ------------------------------------------------------------------ 54 // ciType::is_subtype_of 55 // 56 bool ciType::is_subtype_of(ciType* type) { 57 if (this == type) return true; 58 if (is_klass() && type->is_klass()) 59 return this->as_klass()->is_subtype_of(type->as_klass()); 60 return false; 61 } 62 63 // ------------------------------------------------------------------ 64 // ciType::is__Value 65 // 66 bool ciType::is__Value() const { 67 return false; 68 } 69 70 // ------------------------------------------------------------------ 71 // ciType::name 72 // 73 // Return the name of this type 74 const char* ciType::name() { 75 if (is_primitive_type()) { 76 return type2name(basic_type()); 77 } else { 78 assert(is_klass(), "must be"); 79 return as_klass()->name()->as_utf8(); 80 } 81 } 82 83 // ------------------------------------------------------------------ 84 // ciType::print_impl 85 // 86 // Implementation of the print method. 87 void ciType::print_impl(outputStream* st) { 88 st->print(" type="); 89 print_name_on(st); 90 } | 44 assert(basic_type >= T_BOOLEAN && basic_type <= T_CONFLICT, "range check"); 45 _basic_type = basic_type; 46 } 47 48 ciType::ciType(Klass* k) : ciMetadata(k) { 49 _basic_type = k->is_array_klass() ? T_ARRAY : (k->is_value() ? T_VALUETYPE : T_OBJECT); 50 } 51 52 53 // ------------------------------------------------------------------ 54 // ciType::is_subtype_of 55 // 56 bool ciType::is_subtype_of(ciType* type) { 57 if (this == type) return true; 58 if (is_klass() && type->is_klass()) 59 return this->as_klass()->is_subtype_of(type->as_klass()); 60 return false; 61 } 62 63 // ------------------------------------------------------------------ 64 // ciType::name 65 // 66 // Return the name of this type 67 const char* ciType::name() { 68 if (is_primitive_type()) { 69 return type2name(basic_type()); 70 } else { 71 assert(is_klass(), "must be"); 72 return as_klass()->name()->as_utf8(); 73 } 74 } 75 76 // ------------------------------------------------------------------ 77 // ciType::print_impl 78 // 79 // Implementation of the print method. 80 void ciType::print_impl(outputStream* st) { 81 st->print(" type="); 82 print_name_on(st); 83 } |