294 TypeInstPtr::MIRROR = TypeInstPtr::make(TypePtr::NotNull, current->env()->Class_klass()); |
294 TypeInstPtr::MIRROR = TypeInstPtr::make(TypePtr::NotNull, current->env()->Class_klass()); |
295 TypeInstPtr::MARK = TypeInstPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), |
295 TypeInstPtr::MARK = TypeInstPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), |
296 false, 0, oopDesc::mark_offset_in_bytes()); |
296 false, 0, oopDesc::mark_offset_in_bytes()); |
297 TypeInstPtr::KLASS = TypeInstPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), |
297 TypeInstPtr::KLASS = TypeInstPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), |
298 false, 0, oopDesc::klass_offset_in_bytes()); |
298 false, 0, oopDesc::klass_offset_in_bytes()); |
299 TypeOopPtr::BOTTOM = TypeOopPtr::make(TypePtr::BotPTR, OffsetBot); |
299 TypeOopPtr::BOTTOM = TypeOopPtr::make(TypePtr::BotPTR, OffsetBot, TypeOopPtr::InstanceBot); |
300 |
300 |
301 TypeNarrowOop::NULL_PTR = TypeNarrowOop::make( TypePtr::NULL_PTR ); |
301 TypeNarrowOop::NULL_PTR = TypeNarrowOop::make( TypePtr::NULL_PTR ); |
302 TypeNarrowOop::BOTTOM = TypeNarrowOop::make( TypeInstPtr::BOTTOM ); |
302 TypeNarrowOop::BOTTOM = TypeNarrowOop::make( TypeInstPtr::BOTTOM ); |
303 |
303 |
304 mreg2type[Op_Node] = Type::BOTTOM; |
304 mreg2type[Op_Node] = Type::BOTTOM; |
490 //----------------------interface_vs_oop--------------------------------------- |
490 //----------------------interface_vs_oop--------------------------------------- |
491 #ifdef ASSERT |
491 #ifdef ASSERT |
492 bool Type::interface_vs_oop(const Type *t) const { |
492 bool Type::interface_vs_oop(const Type *t) const { |
493 bool result = false; |
493 bool result = false; |
494 |
494 |
495 const TypeInstPtr* this_inst = this->isa_instptr(); |
495 const TypePtr* this_ptr = this->make_ptr(); // In case it is narrow_oop |
496 const TypeInstPtr* t_inst = t->isa_instptr(); |
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(); |
497 if( this_inst && this_inst->is_loaded() && t_inst && t_inst->is_loaded() ) { |
502 if( this_inst && this_inst->is_loaded() && t_inst && t_inst->is_loaded() ) { |
498 bool this_interface = this_inst->klass()->is_interface(); |
503 bool this_interface = this_inst->klass()->is_interface(); |
499 bool t_interface = t_inst->klass()->is_interface(); |
504 bool t_interface = t_inst->klass()->is_interface(); |
500 result = this_interface ^ t_interface; |
505 result = this_interface ^ t_interface; |
501 } |
506 } |
2247 |
2252 |
2248 //------------------------------cast_to_ptr_type------------------------------- |
2253 //------------------------------cast_to_ptr_type------------------------------- |
2249 const Type *TypeOopPtr::cast_to_ptr_type(PTR ptr) const { |
2254 const Type *TypeOopPtr::cast_to_ptr_type(PTR ptr) const { |
2250 assert(_base == OopPtr, "subclass must override cast_to_ptr_type"); |
2255 assert(_base == OopPtr, "subclass must override cast_to_ptr_type"); |
2251 if( ptr == _ptr ) return this; |
2256 if( ptr == _ptr ) return this; |
2252 return make(ptr, _offset); |
2257 return make(ptr, _offset, _instance_id); |
2253 } |
2258 } |
2254 |
2259 |
2255 //-----------------------------cast_to_instance_id---------------------------- |
2260 //-----------------------------cast_to_instance_id---------------------------- |
2256 const TypeOopPtr *TypeOopPtr::cast_to_instance_id(int instance_id) const { |
2261 const TypeOopPtr *TypeOopPtr::cast_to_instance_id(int instance_id) const { |
2257 // There are no instances of a general oop. |
2262 // There are no instances of a general oop. |
2317 switch (tp->ptr()) { |
2322 switch (tp->ptr()) { |
2318 case Null: |
2323 case Null: |
2319 if (ptr == Null) return TypePtr::make(AnyPtr, ptr, offset); |
2324 if (ptr == Null) return TypePtr::make(AnyPtr, ptr, offset); |
2320 // else fall through: |
2325 // else fall through: |
2321 case TopPTR: |
2326 case TopPTR: |
2322 case AnyNull: |
2327 case AnyNull: { |
2323 return make(ptr, offset); |
2328 int instance_id = meet_instance_id(InstanceTop); |
|
2329 return make(ptr, offset, instance_id); |
|
2330 } |
2324 case BotPTR: |
2331 case BotPTR: |
2325 case NotNull: |
2332 case NotNull: |
2326 return TypePtr::make(AnyPtr, ptr, offset); |
2333 return TypePtr::make(AnyPtr, ptr, offset); |
2327 default: typerr(t); |
2334 default: typerr(t); |
2328 } |
2335 } |
2591 return (_offset == 0) && !below_centerline(_ptr); |
2598 return (_offset == 0) && !below_centerline(_ptr); |
2592 } |
2599 } |
2593 |
2600 |
2594 //------------------------------add_offset------------------------------------- |
2601 //------------------------------add_offset------------------------------------- |
2595 const TypePtr *TypeOopPtr::add_offset( intptr_t offset ) const { |
2602 const TypePtr *TypeOopPtr::add_offset( intptr_t offset ) const { |
2596 return make( _ptr, xadd_offset(offset) ); |
2603 return make( _ptr, xadd_offset(offset), _instance_id); |
2597 } |
2604 } |
2598 |
2605 |
2599 //------------------------------meet_instance_id-------------------------------- |
2606 //------------------------------meet_instance_id-------------------------------- |
2600 int TypeOopPtr::meet_instance_id( int instance_id ) const { |
2607 int TypeOopPtr::meet_instance_id( int instance_id ) const { |
2601 // Either is 'TOP' instance? Return the other instance! |
2608 // Either is 'TOP' instance? Return the other instance! |
2694 // Compute the MEET of two InstPtrs when at least one is unloaded. |
2701 // 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 |
2702 // Assume classes are different since called after check for same name/class-loader |
2696 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const { |
2703 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const { |
2697 int off = meet_offset(tinst->offset()); |
2704 int off = meet_offset(tinst->offset()); |
2698 PTR ptr = meet_ptr(tinst->ptr()); |
2705 PTR ptr = meet_ptr(tinst->ptr()); |
|
2706 int instance_id = meet_instance_id(tinst->instance_id()); |
2699 |
2707 |
2700 const TypeInstPtr *loaded = is_loaded() ? this : tinst; |
2708 const TypeInstPtr *loaded = is_loaded() ? this : tinst; |
2701 const TypeInstPtr *unloaded = is_loaded() ? tinst : this; |
2709 const TypeInstPtr *unloaded = is_loaded() ? tinst : this; |
2702 if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) { |
2710 if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) { |
2703 // |
2711 // |
2714 // BOTTOM | ........................Object-BOTTOM ..................| |
2722 // BOTTOM | ........................Object-BOTTOM ..................| |
2715 // |
2723 // |
2716 assert(loaded->ptr() != TypePtr::Null, "insanity check"); |
2724 assert(loaded->ptr() != TypePtr::Null, "insanity check"); |
2717 // |
2725 // |
2718 if( loaded->ptr() == TypePtr::TopPTR ) { return unloaded; } |
2726 if( loaded->ptr() == TypePtr::TopPTR ) { return unloaded; } |
2719 else if (loaded->ptr() == TypePtr::AnyNull) { return TypeInstPtr::make( ptr, unloaded->klass() ); } |
2727 else if (loaded->ptr() == TypePtr::AnyNull) { return TypeInstPtr::make( ptr, unloaded->klass(), false, NULL, off, instance_id ); } |
2720 else if (loaded->ptr() == TypePtr::BotPTR ) { return TypeInstPtr::BOTTOM; } |
2728 else if (loaded->ptr() == TypePtr::BotPTR ) { return TypeInstPtr::BOTTOM; } |
2721 else if (loaded->ptr() == TypePtr::Constant || loaded->ptr() == TypePtr::NotNull) { |
2729 else if (loaded->ptr() == TypePtr::Constant || loaded->ptr() == TypePtr::NotNull) { |
2722 if (unloaded->ptr() == TypePtr::BotPTR ) { return TypeInstPtr::BOTTOM; } |
2730 if (unloaded->ptr() == TypePtr::BotPTR ) { return TypeInstPtr::BOTTOM; } |
2723 else { return TypeInstPtr::NOTNULL; } |
2731 else { return TypeInstPtr::NOTNULL; } |
2724 } |
2732 } |