Tue, 07 Jan 2014 16:02:10 +0100
8027571: fatal error: meet not symmetric
Summary: meet of one constant array and one exact array not symmetric.
Reviewed-by: kvn
src/share/vm/opto/type.cpp | file | annotate | diff | comparison | revisions | |
test/compiler/types/TestMeetTopArrayExactConstantArray.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/opto/type.cpp Tue Jan 07 14:36:34 2014 +0100 1.2 +++ b/src/share/vm/opto/type.cpp Tue Jan 07 16:02:10 2014 +0100 1.3 @@ -3812,17 +3812,17 @@ 1.4 tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable); 1.5 } 1.6 } else // Non integral arrays. 1.7 - // Must fall to bottom if exact klasses in upper lattice 1.8 - // are not equal or super klass is exact. 1.9 - if ( above_centerline(ptr) && klass() != tap->klass() && 1.10 - // meet with top[] and bottom[] are processed further down: 1.11 - tap ->_klass != NULL && this->_klass != NULL && 1.12 - // both are exact and not equal: 1.13 - ((tap ->_klass_is_exact && this->_klass_is_exact) || 1.14 - // 'tap' is exact and super or unrelated: 1.15 - (tap ->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) || 1.16 - // 'this' is exact and super or unrelated: 1.17 - (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) { 1.18 + // Must fall to bottom if exact klasses in upper lattice 1.19 + // are not equal or super klass is exact. 1.20 + if ((above_centerline(ptr) || ptr == Constant) && klass() != tap->klass() && 1.21 + // meet with top[] and bottom[] are processed further down: 1.22 + tap->_klass != NULL && this->_klass != NULL && 1.23 + // both are exact and not equal: 1.24 + ((tap->_klass_is_exact && this->_klass_is_exact) || 1.25 + // 'tap' is exact and super or unrelated: 1.26 + (tap->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) || 1.27 + // 'this' is exact and super or unrelated: 1.28 + (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) { 1.29 tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable); 1.30 return make(NotNull, NULL, tary, lazy_klass, false, off, InstanceBot); 1.31 }
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/compiler/types/TestMeetTopArrayExactConstantArray.java Tue Jan 07 16:02:10 2014 +0100 2.3 @@ -0,0 +1,107 @@ 2.4 +/* 2.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 + * 2.8 + * This code is free software; you can redistribute it and/or modify it 2.9 + * under the terms of the GNU General Public License version 2 only, as 2.10 + * published by the Free Software Foundation. 2.11 + * 2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 + * version 2 for more details (a copy is included in the LICENSE file that 2.16 + * accompanied this code). 2.17 + * 2.18 + * You should have received a copy of the GNU General Public License version 2.19 + * 2 along with this work; if not, write to the Free Software Foundation, 2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 + * 2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 + * or visit www.oracle.com if you need additional information or have any 2.24 + * questions. 2.25 + */ 2.26 + 2.27 +/* 2.28 + * @test 2.29 + * @bug 8027571 2.30 + * @summary meet of TopPTR exact array with constant array is not symmetric 2.31 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:+UnlockExperimentalVMOptions -XX:+UseTypeSpeculation -XX:-BackgroundCompilation TestMeetTopArrayExactConstantArray 2.32 + * 2.33 + */ 2.34 + 2.35 +public class TestMeetTopArrayExactConstantArray { 2.36 + 2.37 + static class A { 2.38 + } 2.39 + 2.40 + static class B { 2.41 + } 2.42 + 2.43 + static class C extends A { 2.44 + } 2.45 + 2.46 + static class D extends C { 2.47 + } 2.48 + 2.49 + final static B[] b = new B[10]; 2.50 + 2.51 + static void m0(Object[] o) { 2.52 + if (o.getClass() == Object[].class) { 2.53 + } 2.54 + } 2.55 + 2.56 + static void m1(Object[] o, boolean cond) { 2.57 + if (cond) { 2.58 + o = b; 2.59 + } 2.60 + m0(o); 2.61 + } 2.62 + 2.63 + static void m2(Object[] o, boolean cond1, boolean cond2) { 2.64 + if (cond1) { 2.65 + m1(o, cond2); 2.66 + } 2.67 + } 2.68 + 2.69 + static void m3(C[] o, boolean cond1, boolean cond2, boolean cond3) { 2.70 + if (cond1) { 2.71 + m2(o, cond2, cond3); 2.72 + } 2.73 + } 2.74 + 2.75 + static public void main(String[] args) { 2.76 + A[] a = new A[10]; 2.77 + D[] d = new D[10]; 2.78 + Object[] o = new Object[10]; 2.79 + for (int i = 0; i < 5000; i++) { 2.80 + // record in profiling that the if in m0 succeeds 2.81 + m0(o); 2.82 + // record some profiling for m2 and m1 2.83 + m2(a, true, (i%2) == 0); 2.84 + // record some profiling for m3 and conflicting profile for m2 2.85 + m3(d, true, false, (i%2) == 0); 2.86 + } 2.87 + 2.88 + // get m3 compiled. The if in m0 will be optimized because of argument profiling in m3 2.89 + C[] c = new C[10]; 2.90 + for (int i = 0; i < 20000; i++) { 2.91 + m3(c, true, false, (i%2) == 0); 2.92 + } 2.93 + // make m3 not entrant and the if in m0 fail 2.94 + m3(c, true, true, false); 2.95 + m3(c, true, true, false); 2.96 + m3(c, true, true, false); 2.97 + m3(c, true, true, false); 2.98 + 2.99 + // make m3 recompile, this time with if the not optimized 2.100 + // on entry to m3, argument o is of type C[], profiled C[] 2.101 + // on entry to m1, argument o is of type C[], speculative C[] exact, profiled A[]. Speculative becomes AnyNull 2.102 + // after the if in m1, speculative type of o becomes constant from final field b 2.103 + // the true if branch in m0 does a join between the type of o of speculative type constant from final field b and exact klass Object[] 2.104 + for (int i = 0; i < 20000; i++) { 2.105 + m3(c, true, false, (i%2) == 0); 2.106 + } 2.107 + 2.108 + System.out.println("TEST PASSED"); 2.109 + } 2.110 +}