comparison src/share/vm/opto/type.cpp @ 13014:6c2f07d1495f

8027140: Assertion in compiler when running bigapps/Kitchensink/stability Summary: filter() code for TypeKlassPtr not moved when permgen removal was introduced Reviewed-by: twisti, iveresov
author roland
date Mon, 28 Oct 2013 09:58:59 +0100
parents 59e8ad757e19
children e045e1876610 15120a36272d
comparison
equal deleted inserted replaced
13011:cbe8ba0fb8fc 13014:6c2f07d1495f
2785 } 2785 }
2786 2786
2787 2787
2788 //-----------------------------filter------------------------------------------ 2788 //-----------------------------filter------------------------------------------
2789 // Do not allow interface-vs.-noninterface joins to collapse to top. 2789 // Do not allow interface-vs.-noninterface joins to collapse to top.
2790 const Type *TypeOopPtr::filter( const Type *kills ) const { 2790 const Type *TypeOopPtr::filter(const Type *kills) const {
2791 2791
2792 const Type* ft = join(kills); 2792 const Type* ft = join(kills);
2793 const TypeInstPtr* ftip = ft->isa_instptr(); 2793 const TypeInstPtr* ftip = ft->isa_instptr();
2794 const TypeInstPtr* ktip = kills->isa_instptr(); 2794 const TypeInstPtr* ktip = kills->isa_instptr();
2795 const TypeKlassPtr* ftkp = ft->isa_klassptr();
2796 const TypeKlassPtr* ktkp = kills->isa_klassptr();
2797 2795
2798 if (ft->empty()) { 2796 if (ft->empty()) {
2799 // Check for evil case of 'this' being a class and 'kills' expecting an 2797 // Check for evil case of 'this' being a class and 'kills' expecting an
2800 // interface. This can happen because the bytecodes do not contain 2798 // interface. This can happen because the bytecodes do not contain
2801 // enough type info to distinguish a Java-level interface variable 2799 // enough type info to distinguish a Java-level interface variable
2805 // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows 2803 // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows
2806 // into a Phi which "knows" it's an Interface type we'll have to 2804 // into a Phi which "knows" it's an Interface type we'll have to
2807 // uplift the type. 2805 // uplift the type.
2808 if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) 2806 if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface())
2809 return kills; // Uplift to interface 2807 return kills; // Uplift to interface
2810 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
2811 return kills; // Uplift to interface
2812 2808
2813 return Type::TOP; // Canonical empty value 2809 return Type::TOP; // Canonical empty value
2814 } 2810 }
2815 2811
2816 // If we have an interface-typed Phi or cast and we narrow to a class type, 2812 // If we have an interface-typed Phi or cast and we narrow to a class type,
2822 ftip->is_loaded() && ftip->klass()->is_interface() && 2818 ftip->is_loaded() && ftip->klass()->is_interface() &&
2823 ktip->is_loaded() && !ktip->klass()->is_interface()) { 2819 ktip->is_loaded() && !ktip->klass()->is_interface()) {
2824 // Happens in a CTW of rt.jar, 320-341, no extra flags 2820 // Happens in a CTW of rt.jar, 320-341, no extra flags
2825 assert(!ftip->klass_is_exact(), "interface could not be exact"); 2821 assert(!ftip->klass_is_exact(), "interface could not be exact");
2826 return ktip->cast_to_ptr_type(ftip->ptr()); 2822 return ktip->cast_to_ptr_type(ftip->ptr());
2827 }
2828 // Interface klass type could be exact in opposite to interface type,
2829 // return it here instead of incorrect Constant ptr J/L/Object (6894807).
2830 if (ftkp != NULL && ktkp != NULL &&
2831 ftkp->is_loaded() && ftkp->klass()->is_interface() &&
2832 !ftkp->klass_is_exact() && // Keep exact interface klass
2833 ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
2834 return ktkp->cast_to_ptr_type(ftkp->ptr());
2835 } 2823 }
2836 2824
2837 return ft; 2825 return ft;
2838 } 2826 }
2839 2827
4383 // detune optimizer to not generate constant klass + constant offset as a constant! 4371 // detune optimizer to not generate constant klass + constant offset as a constant!
4384 // TopPTR, Null, AnyNull, Constant are all singletons 4372 // TopPTR, Null, AnyNull, Constant are all singletons
4385 return (_offset == 0) && !below_centerline(_ptr); 4373 return (_offset == 0) && !below_centerline(_ptr);
4386 } 4374 }
4387 4375
4376 // Do not allow interface-vs.-noninterface joins to collapse to top.
4377 const Type *TypeKlassPtr::filter(const Type *kills) const {
4378 // logic here mirrors the one from TypeOopPtr::filter. See comments
4379 // there.
4380 const Type* ft = join(kills);
4381 const TypeKlassPtr* ftkp = ft->isa_klassptr();
4382 const TypeKlassPtr* ktkp = kills->isa_klassptr();
4383
4384 if (ft->empty()) {
4385 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
4386 return kills; // Uplift to interface
4387
4388 return Type::TOP; // Canonical empty value
4389 }
4390
4391 // Interface klass type could be exact in opposite to interface type,
4392 // return it here instead of incorrect Constant ptr J/L/Object (6894807).
4393 if (ftkp != NULL && ktkp != NULL &&
4394 ftkp->is_loaded() && ftkp->klass()->is_interface() &&
4395 !ftkp->klass_is_exact() && // Keep exact interface klass
4396 ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
4397 return ktkp->cast_to_ptr_type(ftkp->ptr());
4398 }
4399
4400 return ft;
4401 }
4402
4388 //----------------------compute_klass------------------------------------------ 4403 //----------------------compute_klass------------------------------------------
4389 // Compute the defining klass for this class 4404 // Compute the defining klass for this class
4390 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const { 4405 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
4391 // Compute _klass based on element type. 4406 // Compute _klass based on element type.
4392 ciKlass* k_ary = NULL; 4407 ciKlass* k_ary = NULL;