# HG changeset patch # User roland # Date 1427116877 -3600 # Node ID 79c4cfb7f7cf5d3769b1f71ef8ff00813d622e9b # Parent 442fbbb31f752574aa4b26f952c581b25586855f 8076094: CheckCastPPNode::Value() has outdated logic for constants Summary: outdated logic for constants in CheckCastPPNode::Value() Reviewed-by: kvn, vlivanov diff -r 442fbbb31f75 -r 79c4cfb7f7cf hotspot/src/share/vm/opto/castnode.cpp --- a/hotspot/src/share/vm/opto/castnode.cpp Wed Apr 01 18:07:50 2015 -0700 +++ b/hotspot/src/share/vm/opto/castnode.cpp Mon Mar 23 14:21:17 2015 +0100 @@ -216,16 +216,13 @@ const Type *result = _type; if( in_type != NULL && my_type != NULL ) { TypePtr::PTR in_ptr = in_type->ptr(); - if( in_ptr == TypePtr::Null ) { + if (in_ptr == TypePtr::Null) { result = in_type; - } else if( in_ptr == TypePtr::Constant ) { - // Casting a constant oop to an interface? - // (i.e., a String to a Comparable?) - // Then return the interface. + } else if (in_ptr == TypePtr::Constant) { const TypeOopPtr *jptr = my_type->isa_oopptr(); - assert( jptr, "" ); - result = (jptr->klass()->is_interface() || !in_type->higher_equal(_type)) - ? my_type->cast_to_ptr_type( TypePtr::NotNull ) + assert(jptr, ""); + result = !in_type->higher_equal(_type) + ? my_type->cast_to_ptr_type(TypePtr::NotNull) : in_type; } else { result = my_type->cast_to_ptr_type( my_type->join_ptr(in_ptr) );