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 *
998 { assert(ft == _type, ""); } // Uplift to interface
999 // Otherwise it's something stupid like non-overlapping int ranges
1000 // found on dying counted loops.
1001 else
1002 { assert(ft == Type::TOP, ""); } // Canonical empty value
1003 }
1004
1005 else {
1006
1007 // If we have an interface-typed Phi and we narrow to a class type, the join
1008 // should report back the class. However, if we have a J/L/Object
1009 // class-typed Phi and an interface flows in, it's possible that the meet &
1010 // join report an interface back out. This isn't possible but happens
1011 // because the type system doesn't interact well with interfaces.
1012 const TypePtr *jtp = jt->make_ptr();
1013 const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL;
1014 const TypeKlassPtr *jtkp = (jtp != NULL) ? jtp->isa_klassptr() : NULL;
1015 if( jtip && ttip ) {
1016 if( jtip->is_loaded() && jtip->klass()->is_interface() &&
1017 ttip->is_loaded() && !ttip->klass()->is_interface() ) {
1018 // Happens in a CTW of rt.jar, 320-341, no extra flags
1019 assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) ||
1020 ft->isa_narrowoop() && ft->make_ptr() == ttip->cast_to_ptr_type(jtip->ptr()), "");
1021 jt = ft;
1022 }
1023 }
1024 if( jtkp && ttkp ) {
1025 if( jtkp->is_loaded() && jtkp->klass()->is_interface() &&
1026 !jtkp->klass_is_exact() && // Keep exact interface klass (6894807)
1027 ttkp->is_loaded() && !ttkp->klass()->is_interface() ) {
1028 assert(ft == ttkp->cast_to_ptr_type(jtkp->ptr()) ||
1029 ft->isa_narrowklass() && ft->make_ptr() == ttkp->cast_to_ptr_type(jtkp->ptr()), "");
1030 jt = ft;
1031 }
1032 }
1033 if (jt != ft && jt->base() == ft->base()) {
1034 if (jt->isa_int() &&
1035 jt->is_int()->_lo == ft->is_int()->_lo &&
1036 jt->is_int()->_hi == ft->is_int()->_hi)
1037 jt = ft;
1038 if (jt->isa_long() &&
|
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 *
998 { assert(ft == _type, ""); } // Uplift to interface
999 // Otherwise it's something stupid like non-overlapping int ranges
1000 // found on dying counted loops.
1001 else
1002 { assert(ft == Type::TOP, ""); } // Canonical empty value
1003 }
1004
1005 else {
1006
1007 // If we have an interface-typed Phi and we narrow to a class type, the join
1008 // should report back the class. However, if we have a J/L/Object
1009 // class-typed Phi and an interface flows in, it's possible that the meet &
1010 // join report an interface back out. This isn't possible but happens
1011 // because the type system doesn't interact well with interfaces.
1012 const TypePtr *jtp = jt->make_ptr();
1013 const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL;
1014 const TypeKlassPtr *jtkp = (jtp != NULL) ? jtp->isa_klassptr() : NULL;
1015 if( jtip && ttip ) {
1016 if( jtip->is_loaded() && jtip->klass()->is_interface() &&
1017 ttip->is_loaded() && !ttip->klass()->is_interface() ) {
1018 assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) ||
1019 ft->isa_narrowoop() && ft->make_ptr() == ttip->cast_to_ptr_type(jtip->ptr()), "");
1020 jt = ft;
1021 }
1022 }
1023 if( jtkp && ttkp ) {
1024 if( jtkp->is_loaded() && jtkp->klass()->is_interface() &&
1025 !jtkp->klass_is_exact() && // Keep exact interface klass (6894807)
1026 ttkp->is_loaded() && !ttkp->klass()->is_interface() ) {
1027 assert(ft == ttkp->cast_to_ptr_type(jtkp->ptr()) ||
1028 ft->isa_narrowklass() && ft->make_ptr() == ttkp->cast_to_ptr_type(jtkp->ptr()), "");
1029 jt = ft;
1030 }
1031 }
1032 if (jt != ft && jt->base() == ft->base()) {
1033 if (jt->isa_int() &&
1034 jt->is_int()->_lo == ft->is_int()->_lo &&
1035 jt->is_int()->_hi == ft->is_int()->_hi)
1036 jt = ft;
1037 if (jt->isa_long() &&
|