comparison src/share/vm/opto/type.cpp @ 247:02a35ad4adf8

6723160: Nightly failure: Error: meet not symmetric Summary: Add missing _instance_id settings and other EA fixes. Reviewed-by: rasbold
author kvn
date Wed, 16 Jul 2008 16:04:39 -0700
parents 9c2ecc2ffb12
children c3e045194476
comparison
equal deleted inserted replaced
246:9b66e6287f4a 247:02a35ad4adf8
2216 assert(_base == OopPtr, "subclass must override cast_to_ptr_type"); 2216 assert(_base == OopPtr, "subclass must override cast_to_ptr_type");
2217 if( ptr == _ptr ) return this; 2217 if( ptr == _ptr ) return this;
2218 return make(ptr, _offset); 2218 return make(ptr, _offset);
2219 } 2219 }
2220 2220
2221 //-----------------------------cast_to_instance------------------------------- 2221 //-----------------------------cast_to_instance_id----------------------------
2222 const TypeOopPtr *TypeOopPtr::cast_to_instance_id(int instance_id) const { 2222 const TypeOopPtr *TypeOopPtr::cast_to_instance_id(int instance_id) const {
2223 // There are no instances of a general oop. 2223 // There are no instances of a general oop.
2224 // Return self unchanged. 2224 // Return self unchanged.
2225 return this; 2225 return this;
2226 } 2226 }
2608 assert( (!o && ptr != Constant) || (o && ptr == Constant), 2608 assert( (!o && ptr != Constant) || (o && ptr == Constant),
2609 "constant pointers must have a value supplied" ); 2609 "constant pointers must have a value supplied" );
2610 // Ptr is never Null 2610 // Ptr is never Null
2611 assert( ptr != Null, "NULL pointers are not typed" ); 2611 assert( ptr != Null, "NULL pointers are not typed" );
2612 2612
2613 if ( instance_id > 0 ) 2613 assert(instance_id <= 0 || xk || !UseExactTypes, "instances are always exactly typed");
2614 xk = true; // instances are always exactly typed
2615 if (!UseExactTypes) xk = false; 2614 if (!UseExactTypes) xk = false;
2616 if (ptr == Constant) { 2615 if (ptr == Constant) {
2617 // Note: This case includes meta-object constants, such as methods. 2616 // Note: This case includes meta-object constants, such as methods.
2618 xk = true; 2617 xk = true;
2619 } else if (k->is_loaded()) { 2618 } else if (k->is_loaded()) {
2648 if( (ik->is_final() || _const_oop) ) return this; // cannot clear xk 2647 if( (ik->is_final() || _const_oop) ) return this; // cannot clear xk
2649 if( ik->is_interface() ) return this; // cannot set xk 2648 if( ik->is_interface() ) return this; // cannot set xk
2650 return make(ptr(), klass(), klass_is_exact, const_oop(), _offset, _instance_id); 2649 return make(ptr(), klass(), klass_is_exact, const_oop(), _offset, _instance_id);
2651 } 2650 }
2652 2651
2653 //-----------------------------cast_to_instance------------------------------- 2652 //-----------------------------cast_to_instance_id----------------------------
2654 const TypeOopPtr *TypeInstPtr::cast_to_instance_id(int instance_id) const { 2653 const TypeOopPtr *TypeInstPtr::cast_to_instance_id(int instance_id) const {
2655 if( instance_id == _instance_id ) return this; 2654 if( instance_id == _instance_id ) return this;
2656 bool exact = _klass_is_exact; 2655 return make(_ptr, klass(), _klass_is_exact, const_oop(), _offset, instance_id);
2657 PTR ptr_t = _ptr;
2658 if ( instance_id > 0 ) { // instances are always exactly typed
2659 if (UseExactTypes) exact = true;
2660 ptr_t = NotNull;
2661 }
2662 return make(ptr_t, klass(), exact, const_oop(), _offset, instance_id);
2663 } 2656 }
2664 2657
2665 //------------------------------xmeet_unloaded--------------------------------- 2658 //------------------------------xmeet_unloaded---------------------------------
2666 // Compute the MEET of two InstPtrs when at least one is unloaded. 2659 // Compute the MEET of two InstPtrs when at least one is unloaded.
2667 // Assume classes are different since called after check for same name/class-loader 2660 // Assume classes are different since called after check for same name/class-loader
2897 // centerline fall to interface) 2890 // centerline fall to interface)
2898 k = above_centerline(ptr) ? tinst_klass : ciEnv::current()->Object_klass(); 2891 k = above_centerline(ptr) ? tinst_klass : ciEnv::current()->Object_klass();
2899 xk = above_centerline(ptr) ? tinst_xk : false; 2892 xk = above_centerline(ptr) ? tinst_xk : false;
2900 // Watch out for Constant vs. AnyNull interface. 2893 // Watch out for Constant vs. AnyNull interface.
2901 if (ptr == Constant) ptr = NotNull; // forget it was a constant 2894 if (ptr == Constant) ptr = NotNull; // forget it was a constant
2895 instance_id = InstanceBot;
2902 } 2896 }
2903 ciObject* o = NULL; // the Constant value, if any 2897 ciObject* o = NULL; // the Constant value, if any
2904 if (ptr == Constant) { 2898 if (ptr == Constant) {
2905 // Find out which constant. 2899 // Find out which constant.
2906 o = (this_klass == klass()) ? const_oop() : tinst->const_oop(); 2900 o = (this_klass == klass()) ? const_oop() : tinst->const_oop();
2987 2981
2988 // Since klasses are different, we require a LCA in the Java 2982 // Since klasses are different, we require a LCA in the Java
2989 // class hierarchy - which means we have to fall to at least NotNull. 2983 // class hierarchy - which means we have to fall to at least NotNull.
2990 if( ptr == TopPTR || ptr == AnyNull || ptr == Constant ) 2984 if( ptr == TopPTR || ptr == AnyNull || ptr == Constant )
2991 ptr = NotNull; 2985 ptr = NotNull;
2986 instance_id = InstanceBot;
2992 2987
2993 // Now we find the LCA of Java classes 2988 // Now we find the LCA of Java classes
2994 ciKlass* k = this_klass->least_common_ancestor(tinst_klass); 2989 ciKlass* k = this_klass->least_common_ancestor(tinst_klass);
2995 return make( ptr, k, false, NULL, off, instance_id ); 2990 return make( ptr, k, false, NULL, off, instance_id );
2996 } // End of case InstPtr 2991 } // End of case InstPtr
3099 //------------------------------make------------------------------------------- 3094 //------------------------------make-------------------------------------------
3100 const TypeAryPtr *TypeAryPtr::make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id ) { 3095 const TypeAryPtr *TypeAryPtr::make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id ) {
3101 assert(!(k == NULL && ary->_elem->isa_int()), 3096 assert(!(k == NULL && ary->_elem->isa_int()),
3102 "integral arrays must be pre-equipped with a class"); 3097 "integral arrays must be pre-equipped with a class");
3103 if (!xk) xk = ary->ary_must_be_exact(); 3098 if (!xk) xk = ary->ary_must_be_exact();
3104 if ( instance_id > 0 ) 3099 assert(instance_id <= 0 || xk || !UseExactTypes, "instances are always exactly typed");
3105 xk = true; // instances are always exactly typed
3106 if (!UseExactTypes) xk = (ptr == Constant); 3100 if (!UseExactTypes) xk = (ptr == Constant);
3107 return (TypeAryPtr*)(new TypeAryPtr(ptr, NULL, ary, k, xk, offset, instance_id))->hashcons(); 3101 return (TypeAryPtr*)(new TypeAryPtr(ptr, NULL, ary, k, xk, offset, instance_id))->hashcons();
3108 } 3102 }
3109 3103
3110 //------------------------------make------------------------------------------- 3104 //------------------------------make-------------------------------------------
3111 const TypeAryPtr *TypeAryPtr::make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id ) { 3105 const TypeAryPtr *TypeAryPtr::make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id ) {
3112 assert(!(k == NULL && ary->_elem->isa_int()), 3106 assert(!(k == NULL && ary->_elem->isa_int()),
3113 "integral arrays must be pre-equipped with a class"); 3107 "integral arrays must be pre-equipped with a class");
3114 assert( (ptr==Constant && o) || (ptr!=Constant && !o), "" ); 3108 assert( (ptr==Constant && o) || (ptr!=Constant && !o), "" );
3115 if (!xk) xk = (o != NULL) || ary->ary_must_be_exact(); 3109 if (!xk) xk = (o != NULL) || ary->ary_must_be_exact();
3116 if ( instance_id > 0 ) 3110 assert(instance_id <= 0 || xk || !UseExactTypes, "instances are always exactly typed");
3117 xk = true; // instances are always exactly typed
3118 if (!UseExactTypes) xk = (ptr == Constant); 3111 if (!UseExactTypes) xk = (ptr == Constant);
3119 return (TypeAryPtr*)(new TypeAryPtr(ptr, o, ary, k, xk, offset, instance_id))->hashcons(); 3112 return (TypeAryPtr*)(new TypeAryPtr(ptr, o, ary, k, xk, offset, instance_id))->hashcons();
3120 } 3113 }
3121 3114
3122 //------------------------------cast_to_ptr_type------------------------------- 3115 //------------------------------cast_to_ptr_type-------------------------------
3132 if (!UseExactTypes) return this; 3125 if (!UseExactTypes) return this;
3133 if (_ary->ary_must_be_exact()) return this; // cannot clear xk 3126 if (_ary->ary_must_be_exact()) return this; // cannot clear xk
3134 return make(ptr(), const_oop(), _ary, klass(), klass_is_exact, _offset, _instance_id); 3127 return make(ptr(), const_oop(), _ary, klass(), klass_is_exact, _offset, _instance_id);
3135 } 3128 }
3136 3129
3137 //-----------------------------cast_to_instance------------------------------- 3130 //-----------------------------cast_to_instance_id----------------------------
3138 const TypeOopPtr *TypeAryPtr::cast_to_instance_id(int instance_id) const { 3131 const TypeOopPtr *TypeAryPtr::cast_to_instance_id(int instance_id) const {
3139 if( instance_id == _instance_id ) return this; 3132 if( instance_id == _instance_id ) return this;
3140 bool exact = _klass_is_exact; 3133 return make(_ptr, const_oop(), _ary, klass(), _klass_is_exact, _offset, instance_id);
3141 PTR ptr_t = _ptr;
3142 if ( instance_id > 0 ) { // instances are always exactly typed
3143 if (UseExactTypes) exact = true;
3144 ptr_t = NotNull;
3145 }
3146 return make(ptr_t, const_oop(), _ary, klass(), exact, _offset, instance_id);
3147 } 3134 }
3148 3135
3149 //-----------------------------narrow_size_type------------------------------- 3136 //-----------------------------narrow_size_type-------------------------------
3150 // Local cache for arrayOopDesc::max_array_length(etype), 3137 // Local cache for arrayOopDesc::max_array_length(etype),
3151 // which is kind of slow (and cached elsewhere by other users). 3138 // which is kind of slow (and cached elsewhere by other users).
3298 else if (tap->_klass == NULL || tap->_klass == _klass) { 3285 else if (tap->_klass == NULL || tap->_klass == _klass) {
3299 lazy_klass = _klass; 3286 lazy_klass = _klass;
3300 } else { 3287 } else {
3301 // Something like byte[int+] meets char[int+]. 3288 // Something like byte[int+] meets char[int+].
3302 // This must fall to bottom, not (int[-128..65535])[int+]. 3289 // This must fall to bottom, not (int[-128..65535])[int+].
3290 instance_id = InstanceBot;
3303 tary = TypeAry::make(Type::BOTTOM, tary->_size); 3291 tary = TypeAry::make(Type::BOTTOM, tary->_size);
3304 } 3292 }
3305 } 3293 }
3306 bool xk; 3294 bool xk;
3307 switch (tap->ptr()) { 3295 switch (tap->ptr()) {
3314 ciObject* o = const_oop(); 3302 ciObject* o = const_oop();
3315 if( _ptr == Constant ) { 3303 if( _ptr == Constant ) {
3316 if( tap->const_oop() != NULL && !o->equals(tap->const_oop()) ) { 3304 if( tap->const_oop() != NULL && !o->equals(tap->const_oop()) ) {
3317 ptr = NotNull; 3305 ptr = NotNull;
3318 o = NULL; 3306 o = NULL;
3307 instance_id = InstanceBot;
3319 } 3308 }
3320 } else if( above_centerline(_ptr) ) { 3309 } else if( above_centerline(_ptr) ) {
3321 o = tap->const_oop(); 3310 o = tap->const_oop();
3322 } 3311 }
3323 xk = true; 3312 xk = true;