hotspot/src/share/vm/opto/type.cpp
changeset 3805 3cddd4882151
parent 3180 c589129153a4
child 3908 24b55ad4c228
equal deleted inserted replaced
3804:45b953240545 3805:3cddd4882151
  2234 #endif
  2234 #endif
  2235 }
  2235 }
  2236 
  2236 
  2237 //------------------------------make-------------------------------------------
  2237 //------------------------------make-------------------------------------------
  2238 const TypeOopPtr *TypeOopPtr::make(PTR ptr,
  2238 const TypeOopPtr *TypeOopPtr::make(PTR ptr,
  2239                                    int offset) {
  2239                                    int offset, int instance_id) {
  2240   assert(ptr != Constant, "no constant generic pointers");
  2240   assert(ptr != Constant, "no constant generic pointers");
  2241   ciKlass*  k = ciKlassKlass::make();
  2241   ciKlass*  k = ciKlassKlass::make();
  2242   bool      xk = false;
  2242   bool      xk = false;
  2243   ciObject* o = NULL;
  2243   ciObject* o = NULL;
  2244   return (TypeOopPtr*)(new TypeOopPtr(OopPtr, ptr, k, xk, o, offset, InstanceBot))->hashcons();
  2244   return (TypeOopPtr*)(new TypeOopPtr(OopPtr, ptr, k, xk, o, offset, instance_id))->hashcons();
  2245 }
  2245 }
  2246 
  2246 
  2247 
  2247 
  2248 //------------------------------cast_to_ptr_type-------------------------------
  2248 //------------------------------cast_to_ptr_type-------------------------------
  2249 const Type *TypeOopPtr::cast_to_ptr_type(PTR ptr) const {
  2249 const Type *TypeOopPtr::cast_to_ptr_type(PTR ptr) const {
  2328     }
  2328     }
  2329   }
  2329   }
  2330 
  2330 
  2331   case OopPtr: {                 // Meeting to other OopPtrs
  2331   case OopPtr: {                 // Meeting to other OopPtrs
  2332     const TypeOopPtr *tp = t->is_oopptr();
  2332     const TypeOopPtr *tp = t->is_oopptr();
  2333     return make( meet_ptr(tp->ptr()), meet_offset(tp->offset()) );
  2333     int instance_id = meet_instance_id(tp->instance_id());
       
  2334     return make( meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id );
  2334   }
  2335   }
  2335 
  2336 
  2336   case InstPtr:                  // For these, flip the call around to cut down
  2337   case InstPtr:                  // For these, flip the call around to cut down
  2337   case KlassPtr:                 // on the cases I have to handle.
  2338   case KlassPtr:                 // on the cases I have to handle.
  2338   case AryPtr:
  2339   case AryPtr:
  2799     }
  2800     }
  2800   }
  2801   }
  2801 
  2802 
  2802   case OopPtr: {                // Meeting to OopPtrs
  2803   case OopPtr: {                // Meeting to OopPtrs
  2803     // Found a OopPtr type vs self-InstPtr type
  2804     // Found a OopPtr type vs self-InstPtr type
  2804     const TypePtr *tp = t->is_oopptr();
  2805     const TypeOopPtr *tp = t->is_oopptr();
  2805     int offset = meet_offset(tp->offset());
  2806     int offset = meet_offset(tp->offset());
  2806     PTR ptr = meet_ptr(tp->ptr());
  2807     PTR ptr = meet_ptr(tp->ptr());
  2807     switch (tp->ptr()) {
  2808     switch (tp->ptr()) {
  2808     case TopPTR:
  2809     case TopPTR:
  2809     case AnyNull: {
  2810     case AnyNull: {
  2810       int instance_id = meet_instance_id(InstanceTop);
  2811       int instance_id = meet_instance_id(InstanceTop);
  2811       return make(ptr, klass(), klass_is_exact(),
  2812       return make(ptr, klass(), klass_is_exact(),
  2812                   (ptr == Constant ? const_oop() : NULL), offset, instance_id);
  2813                   (ptr == Constant ? const_oop() : NULL), offset, instance_id);
  2813     }
  2814     }
  2814     case NotNull:
  2815     case NotNull:
  2815     case BotPTR:
  2816     case BotPTR: {
  2816       return TypeOopPtr::make(ptr, offset);
  2817       int instance_id = meet_instance_id(tp->instance_id());
       
  2818       return TypeOopPtr::make(ptr, offset, instance_id);
       
  2819     }
  2817     default: typerr(t);
  2820     default: typerr(t);
  2818     }
  2821     }
  2819   }
  2822   }
  2820 
  2823 
  2821   case AnyPtr: {                // Meeting to AnyPtrs
  2824   case AnyPtr: {                // Meeting to AnyPtrs
  3257   default:                      // All else is a mistake
  3260   default:                      // All else is a mistake
  3258     typerr(t);
  3261     typerr(t);
  3259 
  3262 
  3260   case OopPtr: {                // Meeting to OopPtrs
  3263   case OopPtr: {                // Meeting to OopPtrs
  3261     // Found a OopPtr type vs self-AryPtr type
  3264     // Found a OopPtr type vs self-AryPtr type
  3262     const TypePtr *tp = t->is_oopptr();
  3265     const TypeOopPtr *tp = t->is_oopptr();
  3263     int offset = meet_offset(tp->offset());
  3266     int offset = meet_offset(tp->offset());
  3264     PTR ptr = meet_ptr(tp->ptr());
  3267     PTR ptr = meet_ptr(tp->ptr());
  3265     switch (tp->ptr()) {
  3268     switch (tp->ptr()) {
  3266     case TopPTR:
  3269     case TopPTR:
  3267     case AnyNull: {
  3270     case AnyNull: {
  3268       int instance_id = meet_instance_id(InstanceTop);
  3271       int instance_id = meet_instance_id(InstanceTop);
  3269       return make(ptr, (ptr == Constant ? const_oop() : NULL),
  3272       return make(ptr, (ptr == Constant ? const_oop() : NULL),
  3270                   _ary, _klass, _klass_is_exact, offset, instance_id);
  3273                   _ary, _klass, _klass_is_exact, offset, instance_id);
  3271     }
  3274     }
  3272     case BotPTR:
  3275     case BotPTR:
  3273     case NotNull:
  3276     case NotNull: {
  3274       return TypeOopPtr::make(ptr, offset);
  3277       int instance_id = meet_instance_id(tp->instance_id());
       
  3278       return TypeOopPtr::make(ptr, offset, instance_id);
       
  3279     }
  3275     default: ShouldNotReachHere();
  3280     default: ShouldNotReachHere();
  3276     }
  3281     }
  3277   }
  3282   }
  3278 
  3283 
  3279   case AnyPtr: {                // Meeting two AnyPtrs
  3284   case AnyPtr: {                // Meeting two AnyPtrs