< prev index next >

hotspot/src/share/vm/opto/type.cpp

Print this page




 244     assert(type == ciTypeFlow::StateVector::null_type(), "");
 245     return TypePtr::NULL_PTR;
 246 
 247   case ciTypeFlow::StateVector::T_LONG2:
 248     // The ciTypeFlow pass pushes a long, then the half.
 249     // We do the same.
 250     assert(type == ciTypeFlow::StateVector::long2_type(), "");
 251     return TypeInt::TOP;
 252 
 253   case ciTypeFlow::StateVector::T_DOUBLE2:
 254     // The ciTypeFlow pass pushes double, then the half.
 255     // Our convention is the same.
 256     assert(type == ciTypeFlow::StateVector::double2_type(), "");
 257     return Type::TOP;
 258 
 259   case T_ADDRESS:
 260     assert(type->is_return_address(), "");
 261     return TypeRawPtr::make((address)(intptr_t)type->as_return_address()->bci());
 262 
 263   case T_VALUETYPE:



 264     return TypeValueType::make(type->as_value_klass());

 265 
 266   default:
 267     // make sure we did not mix up the cases:
 268     assert(type != ciTypeFlow::StateVector::bottom_type(), "");
 269     assert(type != ciTypeFlow::StateVector::top_type(), "");
 270     assert(type != ciTypeFlow::StateVector::null_type(), "");
 271     assert(type != ciTypeFlow::StateVector::long2_type(), "");
 272     assert(type != ciTypeFlow::StateVector::double2_type(), "");
 273     assert(!type->is_return_address(), "");
 274 
 275     return Type::get_const_type(type);
 276   }
 277 }
 278 
 279 
 280 //-----------------------make_from_constant------------------------------------
 281 const Type* Type::make_from_constant(ciConstant constant, bool require_constant,
 282                                      int stable_dimension, bool is_narrow_oop,
 283                                      bool is_autobox_cache) {
 284   switch (constant.basic_type()) {


2373   if (_elem->isa_narrowoop())
2374     tinst = _elem->make_ptr()->isa_instptr();
2375   else
2376     tinst = _elem->isa_instptr();
2377   if (tinst)
2378     return tklass->as_instance_klass()->is_final();
2379   const TypeAryPtr*  tap;
2380   if (_elem->isa_narrowoop())
2381     tap = _elem->make_ptr()->isa_aryptr();
2382   else
2383     tap = _elem->isa_aryptr();
2384   if (tap)
2385     return tap->ary()->ary_must_be_exact();
2386   return false;
2387 }
2388 
2389 //==============================TypeValueType=======================================
2390 
2391 //------------------------------make-------------------------------------------
2392 const TypeValueType* TypeValueType::make(ciValueKlass* vk) {

2393   return (TypeValueType*)(new TypeValueType(vk))->hashcons();
2394 }
2395 
2396 //------------------------------meet-------------------------------------------
2397 // Compute the MEET of two types.  It returns a new Type object.
2398 const Type* TypeValueType::xmeet(const Type* t) const {
2399   // Perform a fast test for common case; meeting the same types together.
2400   if(this == t) return this;  // Meeting same type-rep?
2401 
2402   // Current "this->_base" is ValueType
2403   switch (t->base()) {          // switch on original type
2404 
2405   case Top:
2406     break;
2407 
2408   case Bottom:
2409     return t;
2410 
2411   default:                      // All else is a mistake
2412     typerr(t);




 244     assert(type == ciTypeFlow::StateVector::null_type(), "");
 245     return TypePtr::NULL_PTR;
 246 
 247   case ciTypeFlow::StateVector::T_LONG2:
 248     // The ciTypeFlow pass pushes a long, then the half.
 249     // We do the same.
 250     assert(type == ciTypeFlow::StateVector::long2_type(), "");
 251     return TypeInt::TOP;
 252 
 253   case ciTypeFlow::StateVector::T_DOUBLE2:
 254     // The ciTypeFlow pass pushes double, then the half.
 255     // Our convention is the same.
 256     assert(type == ciTypeFlow::StateVector::double2_type(), "");
 257     return Type::TOP;
 258 
 259   case T_ADDRESS:
 260     assert(type->is_return_address(), "");
 261     return TypeRawPtr::make((address)(intptr_t)type->as_return_address()->bci());
 262 
 263   case T_VALUETYPE:
 264     if (type == ciEnv::current()->___Value_klass()) {
 265       return TypeValueTypePtr::NOTNULL;
 266     } else {
 267       return TypeValueType::make(type->as_value_klass());
 268     }
 269 
 270   default:
 271     // make sure we did not mix up the cases:
 272     assert(type != ciTypeFlow::StateVector::bottom_type(), "");
 273     assert(type != ciTypeFlow::StateVector::top_type(), "");
 274     assert(type != ciTypeFlow::StateVector::null_type(), "");
 275     assert(type != ciTypeFlow::StateVector::long2_type(), "");
 276     assert(type != ciTypeFlow::StateVector::double2_type(), "");
 277     assert(!type->is_return_address(), "");
 278 
 279     return Type::get_const_type(type);
 280   }
 281 }
 282 
 283 
 284 //-----------------------make_from_constant------------------------------------
 285 const Type* Type::make_from_constant(ciConstant constant, bool require_constant,
 286                                      int stable_dimension, bool is_narrow_oop,
 287                                      bool is_autobox_cache) {
 288   switch (constant.basic_type()) {


2377   if (_elem->isa_narrowoop())
2378     tinst = _elem->make_ptr()->isa_instptr();
2379   else
2380     tinst = _elem->isa_instptr();
2381   if (tinst)
2382     return tklass->as_instance_klass()->is_final();
2383   const TypeAryPtr*  tap;
2384   if (_elem->isa_narrowoop())
2385     tap = _elem->make_ptr()->isa_aryptr();
2386   else
2387     tap = _elem->isa_aryptr();
2388   if (tap)
2389     return tap->ary()->ary_must_be_exact();
2390   return false;
2391 }
2392 
2393 //==============================TypeValueType=======================================
2394 
2395 //------------------------------make-------------------------------------------
2396 const TypeValueType* TypeValueType::make(ciValueKlass* vk) {
2397   //assert(vk != ciEnv::current()->___Value_klass(), "sanity");
2398   return (TypeValueType*)(new TypeValueType(vk))->hashcons();
2399 }
2400 
2401 //------------------------------meet-------------------------------------------
2402 // Compute the MEET of two types.  It returns a new Type object.
2403 const Type* TypeValueType::xmeet(const Type* t) const {
2404   // Perform a fast test for common case; meeting the same types together.
2405   if(this == t) return this;  // Meeting same type-rep?
2406 
2407   // Current "this->_base" is ValueType
2408   switch (t->base()) {          // switch on original type
2409 
2410   case Top:
2411     break;
2412 
2413   case Bottom:
2414     return t;
2415 
2416   default:                      // All else is a mistake
2417     typerr(t);


< prev index next >