src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6820514 Sdiff src/share/vm/opto

src/share/vm/opto/type.cpp

Print this page




 279   TypePtr::BOTTOM  = TypePtr::make( AnyPtr, TypePtr::BotPTR, OffsetBot );
 280 
 281   TypeRawPtr::BOTTOM = TypeRawPtr::make( TypePtr::BotPTR );
 282   TypeRawPtr::NOTNULL= TypeRawPtr::make( TypePtr::NotNull );
 283 
 284   const Type **fmembar = TypeTuple::fields(0);
 285   TypeTuple::MEMBAR = TypeTuple::make(TypeFunc::Parms+0, fmembar);
 286 
 287   const Type **fsc = (const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 288   fsc[0] = TypeInt::CC;
 289   fsc[1] = Type::MEMORY;
 290   TypeTuple::STORECONDITIONAL = TypeTuple::make(2, fsc);
 291 
 292   TypeInstPtr::NOTNULL = TypeInstPtr::make(TypePtr::NotNull, current->env()->Object_klass());
 293   TypeInstPtr::BOTTOM  = TypeInstPtr::make(TypePtr::BotPTR,  current->env()->Object_klass());
 294   TypeInstPtr::MIRROR  = TypeInstPtr::make(TypePtr::NotNull, current->env()->Class_klass());
 295   TypeInstPtr::MARK    = TypeInstPtr::make(TypePtr::BotPTR,  current->env()->Object_klass(),
 296                                            false, 0, oopDesc::mark_offset_in_bytes());
 297   TypeInstPtr::KLASS   = TypeInstPtr::make(TypePtr::BotPTR,  current->env()->Object_klass(),
 298                                            false, 0, oopDesc::klass_offset_in_bytes());
 299   TypeOopPtr::BOTTOM  = TypeOopPtr::make(TypePtr::BotPTR, OffsetBot);
 300 
 301   TypeNarrowOop::NULL_PTR = TypeNarrowOop::make( TypePtr::NULL_PTR );
 302   TypeNarrowOop::BOTTOM   = TypeNarrowOop::make( TypeInstPtr::BOTTOM );
 303 
 304   mreg2type[Op_Node] = Type::BOTTOM;
 305   mreg2type[Op_Set ] = 0;
 306   mreg2type[Op_RegN] = TypeNarrowOop::BOTTOM;
 307   mreg2type[Op_RegI] = TypeInt::INT;
 308   mreg2type[Op_RegP] = TypePtr::BOTTOM;
 309   mreg2type[Op_RegF] = Type::FLOAT;
 310   mreg2type[Op_RegD] = Type::DOUBLE;
 311   mreg2type[Op_RegL] = TypeLong::LONG;
 312   mreg2type[Op_RegFlags] = TypeInt::CC;
 313 
 314   TypeAryPtr::RANGE   = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), current->env()->Object_klass(), false, arrayOopDesc::length_offset_in_bytes());
 315 
 316   TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), NULL /*ciArrayKlass::make(o)*/,  false,  Type::OffsetBot);
 317 
 318 #ifdef _LP64
 319   if (UseCompressedOops) {


 475   return _base;
 476 }
 477 
 478 //------------------------------is_finite--------------------------------------
 479 // Has a finite value
 480 bool Type::is_finite() const {
 481   return false;
 482 }
 483 
 484 //------------------------------is_nan-----------------------------------------
 485 // Is not a number (NaN)
 486 bool Type::is_nan()    const {
 487   return false;
 488 }
 489 
 490 //----------------------interface_vs_oop---------------------------------------
 491 #ifdef ASSERT
 492 bool Type::interface_vs_oop(const Type *t) const {
 493   bool result = false;
 494 
 495   const TypeInstPtr* this_inst = this->isa_instptr();
 496   const TypeInstPtr*    t_inst =    t->isa_instptr();





 497   if( this_inst && this_inst->is_loaded() && t_inst && t_inst->is_loaded() ) {
 498     bool this_interface = this_inst->klass()->is_interface();
 499     bool    t_interface =    t_inst->klass()->is_interface();
 500     result = this_interface ^ t_interface;
 501   }
 502 
 503   return result;
 504 }
 505 #endif
 506 
 507 //------------------------------meet-------------------------------------------
 508 // Compute the MEET of two types.  NOT virtual.  It enforces that meet is
 509 // commutative and the lattice is symmetric.
 510 const Type *Type::meet( const Type *t ) const {
 511   if (isa_narrowoop() && t->isa_narrowoop()) {
 512     const Type* result = make_ptr()->meet(t->make_ptr());
 513     return result->make_narrowoop();
 514   }
 515 
 516   const Type *mt = xmeet(t);


2232     }
2233   }
2234 #endif
2235 }
2236 
2237 //------------------------------make-------------------------------------------
2238 const TypeOopPtr *TypeOopPtr::make(PTR ptr,
2239                                    int offset, int instance_id) {
2240   assert(ptr != Constant, "no constant generic pointers");
2241   ciKlass*  k = ciKlassKlass::make();
2242   bool      xk = false;
2243   ciObject* o = NULL;
2244   return (TypeOopPtr*)(new TypeOopPtr(OopPtr, ptr, k, xk, o, offset, instance_id))->hashcons();
2245 }
2246 
2247 
2248 //------------------------------cast_to_ptr_type-------------------------------
2249 const Type *TypeOopPtr::cast_to_ptr_type(PTR ptr) const {
2250   assert(_base == OopPtr, "subclass must override cast_to_ptr_type");
2251   if( ptr == _ptr ) return this;
2252   return make(ptr, _offset);
2253 }
2254 
2255 //-----------------------------cast_to_instance_id----------------------------
2256 const TypeOopPtr *TypeOopPtr::cast_to_instance_id(int instance_id) const {
2257   // There are no instances of a general oop.
2258   // Return self unchanged.
2259   return this;
2260 }
2261 
2262 //-----------------------------cast_to_exactness-------------------------------
2263 const Type *TypeOopPtr::cast_to_exactness(bool klass_is_exact) const {
2264   // There is no such thing as an exact general oop.
2265   // Return self unchanged.
2266   return this;
2267 }
2268 
2269 
2270 //------------------------------as_klass_type----------------------------------
2271 // Return the klass type corresponding to this instance or array type.
2272 // It is the type that is loaded from an object of this type.


2302     return Type::BOTTOM;
2303   case Top:
2304     return this;
2305 
2306   default:                      // All else is a mistake
2307     typerr(t);
2308 
2309   case RawPtr:
2310     return TypePtr::BOTTOM;     // Oop meet raw is not well defined
2311 
2312   case AnyPtr: {
2313     // Found an AnyPtr type vs self-OopPtr type
2314     const TypePtr *tp = t->is_ptr();
2315     int offset = meet_offset(tp->offset());
2316     PTR ptr = meet_ptr(tp->ptr());
2317     switch (tp->ptr()) {
2318     case Null:
2319       if (ptr == Null)  return TypePtr::make(AnyPtr, ptr, offset);
2320       // else fall through:
2321     case TopPTR:
2322     case AnyNull:
2323       return make(ptr, offset);


2324     case BotPTR:
2325     case NotNull:
2326       return TypePtr::make(AnyPtr, ptr, offset);
2327     default: typerr(t);
2328     }
2329   }
2330 
2331   case OopPtr: {                 // Meeting to other OopPtrs
2332     const TypeOopPtr *tp = t->is_oopptr();
2333     int instance_id = meet_instance_id(tp->instance_id());
2334     return make( meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id );
2335   }
2336 
2337   case InstPtr:                  // For these, flip the call around to cut down
2338   case KlassPtr:                 // on the cases I have to handle.
2339   case AryPtr:
2340     return t->xmeet(this);      // Call in reverse direction
2341 
2342   } // End of switch
2343   return this;                  // Return the double constant


2576   default:        st->print("+%d",_offset); break;
2577   }
2578   if (_instance_id == InstanceTop)
2579     st->print(",iid=top");
2580   else if (_instance_id != InstanceBot)
2581     st->print(",iid=%d",_instance_id);
2582 }
2583 #endif
2584 
2585 //------------------------------singleton--------------------------------------
2586 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
2587 // constants
2588 bool TypeOopPtr::singleton(void) const {
2589   // detune optimizer to not generate constant oop + constant offset as a constant!
2590   // TopPTR, Null, AnyNull, Constant are all singletons
2591   return (_offset == 0) && !below_centerline(_ptr);
2592 }
2593 
2594 //------------------------------add_offset-------------------------------------
2595 const TypePtr *TypeOopPtr::add_offset( intptr_t offset ) const {
2596   return make( _ptr, xadd_offset(offset) );
2597 }
2598 
2599 //------------------------------meet_instance_id--------------------------------
2600 int TypeOopPtr::meet_instance_id( int instance_id ) const {
2601   // Either is 'TOP' instance?  Return the other instance!
2602   if( _instance_id == InstanceTop ) return  instance_id;
2603   if(  instance_id == InstanceTop ) return _instance_id;
2604   // If either is different, return 'BOTTOM' instance
2605   if( _instance_id != instance_id ) return InstanceBot;
2606   return _instance_id;
2607 }
2608 
2609 //------------------------------dual_instance_id--------------------------------
2610 int TypeOopPtr::dual_instance_id( ) const {
2611   if( _instance_id == InstanceTop ) return InstanceBot; // Map TOP into BOTTOM
2612   if( _instance_id == InstanceBot ) return InstanceTop; // Map BOTTOM into TOP
2613   return _instance_id;              // Map everything else into self
2614 }
2615 
2616 


2679   if (!UseExactTypes)  return this;
2680   if (!_klass->is_loaded())  return this;
2681   ciInstanceKlass* ik = _klass->as_instance_klass();
2682   if( (ik->is_final() || _const_oop) )  return this;  // cannot clear xk
2683   if( ik->is_interface() )              return this;  // cannot set xk
2684   return make(ptr(), klass(), klass_is_exact, const_oop(), _offset, _instance_id);
2685 }
2686 
2687 //-----------------------------cast_to_instance_id----------------------------
2688 const TypeOopPtr *TypeInstPtr::cast_to_instance_id(int instance_id) const {
2689   if( instance_id == _instance_id ) return this;
2690   return make(_ptr, klass(), _klass_is_exact, const_oop(), _offset, instance_id);
2691 }
2692 
2693 //------------------------------xmeet_unloaded---------------------------------
2694 // Compute the MEET of two InstPtrs when at least one is unloaded.
2695 // Assume classes are different since called after check for same name/class-loader
2696 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const {
2697     int off = meet_offset(tinst->offset());
2698     PTR ptr = meet_ptr(tinst->ptr());

2699 
2700     const TypeInstPtr *loaded    = is_loaded() ? this  : tinst;
2701     const TypeInstPtr *unloaded  = is_loaded() ? tinst : this;
2702     if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) {
2703       //
2704       // Meet unloaded class with java/lang/Object
2705       //
2706       // Meet
2707       //          |                     Unloaded Class
2708       //  Object  |   TOP    |   AnyNull | Constant |   NotNull |  BOTTOM   |
2709       //  ===================================================================
2710       //   TOP    | ..........................Unloaded......................|
2711       //  AnyNull |  U-AN    |................Unloaded......................|
2712       // Constant | ... O-NN .................................. |   O-BOT   |
2713       //  NotNull | ... O-NN .................................. |   O-BOT   |
2714       //  BOTTOM  | ........................Object-BOTTOM ..................|
2715       //
2716       assert(loaded->ptr() != TypePtr::Null, "insanity check");
2717       //
2718       if(      loaded->ptr() == TypePtr::TopPTR ) { return unloaded; }
2719       else if (loaded->ptr() == TypePtr::AnyNull) { return TypeInstPtr::make( ptr, unloaded->klass() ); }
2720       else if (loaded->ptr() == TypePtr::BotPTR ) { return TypeInstPtr::BOTTOM; }
2721       else if (loaded->ptr() == TypePtr::Constant || loaded->ptr() == TypePtr::NotNull) {
2722         if (unloaded->ptr() == TypePtr::BotPTR  ) { return TypeInstPtr::BOTTOM;  }
2723         else                                      { return TypeInstPtr::NOTNULL; }
2724       }
2725       else if( unloaded->ptr() == TypePtr::TopPTR )  { return unloaded; }
2726 
2727       return unloaded->cast_to_ptr_type(TypePtr::AnyNull)->is_instptr();
2728     }
2729 
2730     // Both are unloaded, not the same class, not Object
2731     // Or meet unloaded with a different loaded class, not java/lang/Object
2732     if( ptr != TypePtr::BotPTR ) {
2733       return TypeInstPtr::NOTNULL;
2734     }
2735     return TypeInstPtr::BOTTOM;
2736 }
2737 
2738 
2739 //------------------------------meet-------------------------------------------




 279   TypePtr::BOTTOM  = TypePtr::make( AnyPtr, TypePtr::BotPTR, OffsetBot );
 280 
 281   TypeRawPtr::BOTTOM = TypeRawPtr::make( TypePtr::BotPTR );
 282   TypeRawPtr::NOTNULL= TypeRawPtr::make( TypePtr::NotNull );
 283 
 284   const Type **fmembar = TypeTuple::fields(0);
 285   TypeTuple::MEMBAR = TypeTuple::make(TypeFunc::Parms+0, fmembar);
 286 
 287   const Type **fsc = (const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 288   fsc[0] = TypeInt::CC;
 289   fsc[1] = Type::MEMORY;
 290   TypeTuple::STORECONDITIONAL = TypeTuple::make(2, fsc);
 291 
 292   TypeInstPtr::NOTNULL = TypeInstPtr::make(TypePtr::NotNull, current->env()->Object_klass());
 293   TypeInstPtr::BOTTOM  = TypeInstPtr::make(TypePtr::BotPTR,  current->env()->Object_klass());
 294   TypeInstPtr::MIRROR  = TypeInstPtr::make(TypePtr::NotNull, current->env()->Class_klass());
 295   TypeInstPtr::MARK    = TypeInstPtr::make(TypePtr::BotPTR,  current->env()->Object_klass(),
 296                                            false, 0, oopDesc::mark_offset_in_bytes());
 297   TypeInstPtr::KLASS   = TypeInstPtr::make(TypePtr::BotPTR,  current->env()->Object_klass(),
 298                                            false, 0, oopDesc::klass_offset_in_bytes());
 299   TypeOopPtr::BOTTOM  = TypeOopPtr::make(TypePtr::BotPTR, OffsetBot, TypeOopPtr::InstanceBot);
 300 
 301   TypeNarrowOop::NULL_PTR = TypeNarrowOop::make( TypePtr::NULL_PTR );
 302   TypeNarrowOop::BOTTOM   = TypeNarrowOop::make( TypeInstPtr::BOTTOM );
 303 
 304   mreg2type[Op_Node] = Type::BOTTOM;
 305   mreg2type[Op_Set ] = 0;
 306   mreg2type[Op_RegN] = TypeNarrowOop::BOTTOM;
 307   mreg2type[Op_RegI] = TypeInt::INT;
 308   mreg2type[Op_RegP] = TypePtr::BOTTOM;
 309   mreg2type[Op_RegF] = Type::FLOAT;
 310   mreg2type[Op_RegD] = Type::DOUBLE;
 311   mreg2type[Op_RegL] = TypeLong::LONG;
 312   mreg2type[Op_RegFlags] = TypeInt::CC;
 313 
 314   TypeAryPtr::RANGE   = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), current->env()->Object_klass(), false, arrayOopDesc::length_offset_in_bytes());
 315 
 316   TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), NULL /*ciArrayKlass::make(o)*/,  false,  Type::OffsetBot);
 317 
 318 #ifdef _LP64
 319   if (UseCompressedOops) {


 475   return _base;
 476 }
 477 
 478 //------------------------------is_finite--------------------------------------
 479 // Has a finite value
 480 bool Type::is_finite() const {
 481   return false;
 482 }
 483 
 484 //------------------------------is_nan-----------------------------------------
 485 // Is not a number (NaN)
 486 bool Type::is_nan()    const {
 487   return false;
 488 }
 489 
 490 //----------------------interface_vs_oop---------------------------------------
 491 #ifdef ASSERT
 492 bool Type::interface_vs_oop(const Type *t) const {
 493   bool result = false;
 494 
 495   const TypePtr* this_ptr = this->make_ptr(); // In case it is narrow_oop
 496   const TypePtr*    t_ptr =    t->make_ptr();
 497   if( this_ptr == NULL || t_ptr == NULL )
 498     return result;
 499 
 500   const TypeInstPtr* this_inst = this_ptr->isa_instptr();
 501   const TypeInstPtr*    t_inst =    t_ptr->isa_instptr();
 502   if( this_inst && this_inst->is_loaded() && t_inst && t_inst->is_loaded() ) {
 503     bool this_interface = this_inst->klass()->is_interface();
 504     bool    t_interface =    t_inst->klass()->is_interface();
 505     result = this_interface ^ t_interface;
 506   }
 507 
 508   return result;
 509 }
 510 #endif
 511 
 512 //------------------------------meet-------------------------------------------
 513 // Compute the MEET of two types.  NOT virtual.  It enforces that meet is
 514 // commutative and the lattice is symmetric.
 515 const Type *Type::meet( const Type *t ) const {
 516   if (isa_narrowoop() && t->isa_narrowoop()) {
 517     const Type* result = make_ptr()->meet(t->make_ptr());
 518     return result->make_narrowoop();
 519   }
 520 
 521   const Type *mt = xmeet(t);


2237     }
2238   }
2239 #endif
2240 }
2241 
2242 //------------------------------make-------------------------------------------
2243 const TypeOopPtr *TypeOopPtr::make(PTR ptr,
2244                                    int offset, int instance_id) {
2245   assert(ptr != Constant, "no constant generic pointers");
2246   ciKlass*  k = ciKlassKlass::make();
2247   bool      xk = false;
2248   ciObject* o = NULL;
2249   return (TypeOopPtr*)(new TypeOopPtr(OopPtr, ptr, k, xk, o, offset, instance_id))->hashcons();
2250 }
2251 
2252 
2253 //------------------------------cast_to_ptr_type-------------------------------
2254 const Type *TypeOopPtr::cast_to_ptr_type(PTR ptr) const {
2255   assert(_base == OopPtr, "subclass must override cast_to_ptr_type");
2256   if( ptr == _ptr ) return this;
2257   return make(ptr, _offset, _instance_id);
2258 }
2259 
2260 //-----------------------------cast_to_instance_id----------------------------
2261 const TypeOopPtr *TypeOopPtr::cast_to_instance_id(int instance_id) const {
2262   // There are no instances of a general oop.
2263   // Return self unchanged.
2264   return this;
2265 }
2266 
2267 //-----------------------------cast_to_exactness-------------------------------
2268 const Type *TypeOopPtr::cast_to_exactness(bool klass_is_exact) const {
2269   // There is no such thing as an exact general oop.
2270   // Return self unchanged.
2271   return this;
2272 }
2273 
2274 
2275 //------------------------------as_klass_type----------------------------------
2276 // Return the klass type corresponding to this instance or array type.
2277 // It is the type that is loaded from an object of this type.


2307     return Type::BOTTOM;
2308   case Top:
2309     return this;
2310 
2311   default:                      // All else is a mistake
2312     typerr(t);
2313 
2314   case RawPtr:
2315     return TypePtr::BOTTOM;     // Oop meet raw is not well defined
2316 
2317   case AnyPtr: {
2318     // Found an AnyPtr type vs self-OopPtr type
2319     const TypePtr *tp = t->is_ptr();
2320     int offset = meet_offset(tp->offset());
2321     PTR ptr = meet_ptr(tp->ptr());
2322     switch (tp->ptr()) {
2323     case Null:
2324       if (ptr == Null)  return TypePtr::make(AnyPtr, ptr, offset);
2325       // else fall through:
2326     case TopPTR:
2327     case AnyNull: {
2328       int instance_id = meet_instance_id(InstanceTop);
2329       return make(ptr, offset, instance_id);
2330     }
2331     case BotPTR:
2332     case NotNull:
2333       return TypePtr::make(AnyPtr, ptr, offset);
2334     default: typerr(t);
2335     }
2336   }
2337 
2338   case OopPtr: {                 // Meeting to other OopPtrs
2339     const TypeOopPtr *tp = t->is_oopptr();
2340     int instance_id = meet_instance_id(tp->instance_id());
2341     return make( meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id );
2342   }
2343 
2344   case InstPtr:                  // For these, flip the call around to cut down
2345   case KlassPtr:                 // on the cases I have to handle.
2346   case AryPtr:
2347     return t->xmeet(this);      // Call in reverse direction
2348 
2349   } // End of switch
2350   return this;                  // Return the double constant


2583   default:        st->print("+%d",_offset); break;
2584   }
2585   if (_instance_id == InstanceTop)
2586     st->print(",iid=top");
2587   else if (_instance_id != InstanceBot)
2588     st->print(",iid=%d",_instance_id);
2589 }
2590 #endif
2591 
2592 //------------------------------singleton--------------------------------------
2593 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
2594 // constants
2595 bool TypeOopPtr::singleton(void) const {
2596   // detune optimizer to not generate constant oop + constant offset as a constant!
2597   // TopPTR, Null, AnyNull, Constant are all singletons
2598   return (_offset == 0) && !below_centerline(_ptr);
2599 }
2600 
2601 //------------------------------add_offset-------------------------------------
2602 const TypePtr *TypeOopPtr::add_offset( intptr_t offset ) const {
2603   return make( _ptr, xadd_offset(offset), _instance_id);
2604 }
2605 
2606 //------------------------------meet_instance_id--------------------------------
2607 int TypeOopPtr::meet_instance_id( int instance_id ) const {
2608   // Either is 'TOP' instance?  Return the other instance!
2609   if( _instance_id == InstanceTop ) return  instance_id;
2610   if(  instance_id == InstanceTop ) return _instance_id;
2611   // If either is different, return 'BOTTOM' instance
2612   if( _instance_id != instance_id ) return InstanceBot;
2613   return _instance_id;
2614 }
2615 
2616 //------------------------------dual_instance_id--------------------------------
2617 int TypeOopPtr::dual_instance_id( ) const {
2618   if( _instance_id == InstanceTop ) return InstanceBot; // Map TOP into BOTTOM
2619   if( _instance_id == InstanceBot ) return InstanceTop; // Map BOTTOM into TOP
2620   return _instance_id;              // Map everything else into self
2621 }
2622 
2623 


2686   if (!UseExactTypes)  return this;
2687   if (!_klass->is_loaded())  return this;
2688   ciInstanceKlass* ik = _klass->as_instance_klass();
2689   if( (ik->is_final() || _const_oop) )  return this;  // cannot clear xk
2690   if( ik->is_interface() )              return this;  // cannot set xk
2691   return make(ptr(), klass(), klass_is_exact, const_oop(), _offset, _instance_id);
2692 }
2693 
2694 //-----------------------------cast_to_instance_id----------------------------
2695 const TypeOopPtr *TypeInstPtr::cast_to_instance_id(int instance_id) const {
2696   if( instance_id == _instance_id ) return this;
2697   return make(_ptr, klass(), _klass_is_exact, const_oop(), _offset, instance_id);
2698 }
2699 
2700 //------------------------------xmeet_unloaded---------------------------------
2701 // Compute the MEET of two InstPtrs when at least one is unloaded.
2702 // Assume classes are different since called after check for same name/class-loader
2703 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const {
2704     int off = meet_offset(tinst->offset());
2705     PTR ptr = meet_ptr(tinst->ptr());
2706     int instance_id = meet_instance_id(tinst->instance_id());
2707 
2708     const TypeInstPtr *loaded    = is_loaded() ? this  : tinst;
2709     const TypeInstPtr *unloaded  = is_loaded() ? tinst : this;
2710     if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) {
2711       //
2712       // Meet unloaded class with java/lang/Object
2713       //
2714       // Meet
2715       //          |                     Unloaded Class
2716       //  Object  |   TOP    |   AnyNull | Constant |   NotNull |  BOTTOM   |
2717       //  ===================================================================
2718       //   TOP    | ..........................Unloaded......................|
2719       //  AnyNull |  U-AN    |................Unloaded......................|
2720       // Constant | ... O-NN .................................. |   O-BOT   |
2721       //  NotNull | ... O-NN .................................. |   O-BOT   |
2722       //  BOTTOM  | ........................Object-BOTTOM ..................|
2723       //
2724       assert(loaded->ptr() != TypePtr::Null, "insanity check");
2725       //
2726       if(      loaded->ptr() == TypePtr::TopPTR ) { return unloaded; }
2727       else if (loaded->ptr() == TypePtr::AnyNull) { return TypeInstPtr::make( ptr, unloaded->klass(), false, NULL, off, instance_id ); }
2728       else if (loaded->ptr() == TypePtr::BotPTR ) { return TypeInstPtr::BOTTOM; }
2729       else if (loaded->ptr() == TypePtr::Constant || loaded->ptr() == TypePtr::NotNull) {
2730         if (unloaded->ptr() == TypePtr::BotPTR  ) { return TypeInstPtr::BOTTOM;  }
2731         else                                      { return TypeInstPtr::NOTNULL; }
2732       }
2733       else if( unloaded->ptr() == TypePtr::TopPTR )  { return unloaded; }
2734 
2735       return unloaded->cast_to_ptr_type(TypePtr::AnyNull)->is_instptr();
2736     }
2737 
2738     // Both are unloaded, not the same class, not Object
2739     // Or meet unloaded with a different loaded class, not java/lang/Object
2740     if( ptr != TypePtr::BotPTR ) {
2741       return TypeInstPtr::NOTNULL;
2742     }
2743     return TypeInstPtr::BOTTOM;
2744 }
2745 
2746 
2747 //------------------------------meet-------------------------------------------


src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File