changeset 2519:9e4b7ee95e3c

6894807: No ClassCastException for HashAttributeSet constructors if run with -Xcomp Summary: Return interface klass type if it is exact. Reviewed-by: never
author kvn
date Wed, 24 Mar 2010 20:44:35 +0000
parents 4867512504d4
children 123e850e57f4
files src/share/vm/opto/cfgnode.cpp src/share/vm/opto/type.cpp src/share/vm/opto/type.hpp
diffstat 3 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/cfgnode.cpp	Thu Dec 03 14:26:53 2009 -0800
+++ b/src/share/vm/opto/cfgnode.cpp	Wed Mar 24 20:44:35 2010 +0000
@@ -929,6 +929,8 @@
       { assert(ft == _type, ""); } // Uplift to interface
     else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() )
       { assert(ft == _type, ""); } // Uplift to interface
+    else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() )
+      { assert(ft == _type, ""); } // Uplift to interface
     // Otherwise it's something stupid like non-overlapping int ranges
     // found on dying counted loops.
     else
@@ -956,6 +958,7 @@
     }
     if( jtkp && ttkp ) {
       if( jtkp->is_loaded() &&  jtkp->klass()->is_interface() &&
+          !jtkp->klass_is_exact() && // Keep exact interface klass (6894807)
           ttkp->is_loaded() && !ttkp->klass()->is_interface() ) {
         assert(ft == ttkp->cast_to_ptr_type(jtkp->ptr()) ||
                ft->isa_narrowoop() && ft->make_ptr() == ttkp->cast_to_ptr_type(jtkp->ptr()), "");
--- a/src/share/vm/opto/type.cpp	Thu Dec 03 14:26:53 2009 -0800
+++ b/src/share/vm/opto/type.cpp	Wed Mar 24 20:44:35 2010 +0000
@@ -2532,6 +2532,8 @@
       return kills;             // Uplift to interface
     if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
       return kills;             // Uplift to interface
+    if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
+      return kills;             // Uplift to interface
 
     return Type::TOP;           // Canonical empty value
   }
@@ -2544,11 +2546,14 @@
   if (ftip != NULL && ktip != NULL &&
       ftip->is_loaded() &&  ftip->klass()->is_interface() &&
       ktip->is_loaded() && !ktip->klass()->is_interface()) {
-    // Happens in a CTW of rt.jar, 320-341, no extra flags
+    assert(!ftip->klass_is_exact(), "interface could not be exact");
     return ktip->cast_to_ptr_type(ftip->ptr());
   }
+  // Interface klass type could be exact in opposite to interface type,
+  // return it here instead of incorrect Constant ptr J/L/Object (6894807).
   if (ftkp != NULL && ktkp != NULL &&
       ftkp->is_loaded() &&  ftkp->klass()->is_interface() &&
+      !ftkp->klass_is_exact() && // Keep exact interface klass
       ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
     // Happens in a CTW of rt.jar, 320-341, no extra flags
     return ktkp->cast_to_ptr_type(ftkp->ptr());
--- a/src/share/vm/opto/type.hpp	Thu Dec 03 14:26:53 2009 -0800
+++ b/src/share/vm/opto/type.hpp	Wed Mar 24 20:44:35 2010 +0000
@@ -903,6 +903,8 @@
 
   bool  is_loaded() const { return _klass->is_loaded(); }
 
+  bool  is_loaded() const { return _klass->is_loaded(); }
+
   // ptr to klass 'k'
   static const TypeKlassPtr *make( ciKlass* k ) { return make( TypePtr::Constant, k, 0); }
   // ptr to klass 'k' with offset