From 0ebcf0d492571bd2ee2dee35d930170a11a35847 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 21 Jan 2010 10:07:59 -0800 Subject: [PATCH] 6894807: No ClassCastException for HashAttributeSet constructors if run with -Xcomp Return interface klass type if it is exact. Reviewed-by: never --- hotspot/src/share/vm/opto/cfgnode.cpp | 1 + hotspot/src/share/vm/opto/type.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp index b1da1c716d9..383f4f8c989 100644 --- a/hotspot/src/share/vm/opto/cfgnode.cpp +++ b/hotspot/src/share/vm/opto/cfgnode.cpp @@ -956,6 +956,7 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const { } 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()), ""); diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index c22d1e8f6b0..30883d37dc3 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -2545,12 +2545,15 @@ const Type *TypeOopPtr::filter( const Type *kills ) const { 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()); }