src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_8068687_metaindex.2 Sdiff src/share/vm/opto

src/share/vm/opto/type.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3105     // from a Java-level object variable.  If we meet 2 classes which
3106     // both implement interface I, but their meet is at 'j/l/O' which
3107     // doesn't implement I, we have no way to tell if the result should
3108     // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
3109     // into a Phi which "knows" it's an Interface type we'll have to
3110     // uplift the type.
3111     if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface())
3112       return kills;             // Uplift to interface
3113 
3114     return Type::TOP;           // Canonical empty value
3115   }
3116 
3117   // If we have an interface-typed Phi or cast and we narrow to a class type,
3118   // the join should report back the class.  However, if we have a J/L/Object
3119   // class-typed Phi and an interface flows in, it's possible that the meet &
3120   // join report an interface back out.  This isn't possible but happens
3121   // because the type system doesn't interact well with interfaces.
3122   if (ftip != NULL && ktip != NULL &&
3123       ftip->is_loaded() &&  ftip->klass()->is_interface() &&
3124       ktip->is_loaded() && !ktip->klass()->is_interface()) {
3125     // Happens in a CTW of rt.jar, 320-341, no extra flags
3126     assert(!ftip->klass_is_exact(), "interface could not be exact");
3127     return ktip->cast_to_ptr_type(ftip->ptr());
3128   }
3129 
3130   return ft;
3131 }
3132 
3133 //------------------------------eq---------------------------------------------
3134 // Structural equality check for Type representations
3135 bool TypeOopPtr::eq( const Type *t ) const {
3136   const TypeOopPtr *a = (const TypeOopPtr*)t;
3137   if (_klass_is_exact != a->_klass_is_exact ||
3138       _instance_id != a->_instance_id)  return false;
3139   ciObject* one = const_oop();
3140   ciObject* two = a->const_oop();
3141   if (one == NULL || two == NULL) {
3142     return (one == two) && TypePtr::eq(t);
3143   } else {
3144     return one->equals(two) && TypePtr::eq(t);
3145   }


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3105     // from a Java-level object variable.  If we meet 2 classes which
3106     // both implement interface I, but their meet is at 'j/l/O' which
3107     // doesn't implement I, we have no way to tell if the result should
3108     // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
3109     // into a Phi which "knows" it's an Interface type we'll have to
3110     // uplift the type.
3111     if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface())
3112       return kills;             // Uplift to interface
3113 
3114     return Type::TOP;           // Canonical empty value
3115   }
3116 
3117   // If we have an interface-typed Phi or cast and we narrow to a class type,
3118   // the join should report back the class.  However, if we have a J/L/Object
3119   // class-typed Phi and an interface flows in, it's possible that the meet &
3120   // join report an interface back out.  This isn't possible but happens
3121   // because the type system doesn't interact well with interfaces.
3122   if (ftip != NULL && ktip != NULL &&
3123       ftip->is_loaded() &&  ftip->klass()->is_interface() &&
3124       ktip->is_loaded() && !ktip->klass()->is_interface()) {

3125     assert(!ftip->klass_is_exact(), "interface could not be exact");
3126     return ktip->cast_to_ptr_type(ftip->ptr());
3127   }
3128 
3129   return ft;
3130 }
3131 
3132 //------------------------------eq---------------------------------------------
3133 // Structural equality check for Type representations
3134 bool TypeOopPtr::eq( const Type *t ) const {
3135   const TypeOopPtr *a = (const TypeOopPtr*)t;
3136   if (_klass_is_exact != a->_klass_is_exact ||
3137       _instance_id != a->_instance_id)  return false;
3138   ciObject* one = const_oop();
3139   ciObject* two = a->const_oop();
3140   if (one == NULL || two == NULL) {
3141     return (one == two) && TypePtr::eq(t);
3142   } else {
3143     return one->equals(two) && TypePtr::eq(t);
3144   }


src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File