From ef217cba65516ea512cfb15bebac77ba522408b1 Mon Sep 17 00:00:00 2001
From: Roland Westrelin <roland@openjdk.org>
Date: Mon, 23 Mar 2015 14:21:17 +0100
Subject: [PATCH] 8076094: CheckCastPPNode::Value() has outdated logic for
 constants

Outdated logic for constants in CheckCastPPNode::Value()

Reviewed-by: kvn, vlivanov
---
 hotspot/src/share/vm/opto/castnode.cpp | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/hotspot/src/share/vm/opto/castnode.cpp b/hotspot/src/share/vm/opto/castnode.cpp
index 48aab726417..3a36c6676a1 100644
--- a/hotspot/src/share/vm/opto/castnode.cpp
+++ b/hotspot/src/share/vm/opto/castnode.cpp
@@ -216,16 +216,13 @@ const Type *CheckCastPPNode::Value( PhaseTransform *phase ) const {
   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) );