1.1 --- a/src/share/vm/opto/type.cpp Sat Oct 24 16:18:50 2020 +0800 1.2 +++ b/src/share/vm/opto/type.cpp Sat Oct 24 16:43:47 2020 +0800 1.3 @@ -673,6 +673,35 @@ 1.4 1.5 #endif 1.6 1.7 +void Type::check_symmetrical(const Type *t, const Type *mt) const { 1.8 +#ifdef ASSERT 1.9 + assert(mt == t->xmeet(this), "meet not commutative"); 1.10 + const Type* dual_join = mt->_dual; 1.11 + const Type *t2t = dual_join->xmeet(t->_dual); 1.12 + const Type *t2this = dual_join->xmeet(this->_dual); 1.13 + 1.14 + // Interface meet Oop is Not Symmetric: 1.15 + // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull 1.16 + // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull 1.17 + 1.18 + if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != this->_dual) ) { 1.19 + tty->print_cr("=== Meet Not Symmetric ==="); 1.20 + tty->print("t = "); t->dump(); tty->cr(); 1.21 + tty->print("this= "); dump(); tty->cr(); 1.22 + tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); 1.23 + 1.24 + tty->print("t_dual= "); t->_dual->dump(); tty->cr(); 1.25 + tty->print("this_dual= "); _dual->dump(); tty->cr(); 1.26 + tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); 1.27 + 1.28 + tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); 1.29 + tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); 1.30 + 1.31 + fatal("meet not symmetric" ); 1.32 + } 1.33 +#endif 1.34 +} 1.35 + 1.36 //------------------------------meet------------------------------------------- 1.37 // Compute the MEET of two types. NOT virtual. It enforces that meet is 1.38 // commutative and the lattice is symmetric. 1.39 @@ -690,33 +719,28 @@ 1.40 t = t->maybe_remove_speculative(include_speculative); 1.41 1.42 const Type *mt = this_t->xmeet(t); 1.43 +#ifdef ASSERT 1.44 if (isa_narrowoop() || t->isa_narrowoop()) return mt; 1.45 if (isa_narrowklass() || t->isa_narrowklass()) return mt; 1.46 -#ifdef ASSERT 1.47 - assert(mt == t->xmeet(this_t), "meet not commutative"); 1.48 - const Type* dual_join = mt->_dual; 1.49 - const Type *t2t = dual_join->xmeet(t->_dual); 1.50 - const Type *t2this = dual_join->xmeet(this_t->_dual); 1.51 - 1.52 - // Interface meet Oop is Not Symmetric: 1.53 - // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull 1.54 - // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull 1.55 - 1.56 - if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != this_t->_dual) ) { 1.57 - tty->print_cr("=== Meet Not Symmetric ==="); 1.58 - tty->print("t = "); t->dump(); tty->cr(); 1.59 - tty->print("this= "); this_t->dump(); tty->cr(); 1.60 - tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); 1.61 - 1.62 - tty->print("t_dual= "); t->_dual->dump(); tty->cr(); 1.63 - tty->print("this_dual= "); this_t->_dual->dump(); tty->cr(); 1.64 - tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); 1.65 - 1.66 - tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); 1.67 - tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); 1.68 - 1.69 - fatal("meet not symmetric" ); 1.70 + Compile* C = Compile::current(); 1.71 + if (!C->_type_verify_symmetry) { 1.72 + return mt; 1.73 } 1.74 + this_t->check_symmetrical(t, mt); 1.75 + // In the case of an array, computing the meet above, caused the 1.76 + // computation of the meet of the elements which at verification 1.77 + // time caused the computation of the meet of the dual of the 1.78 + // elements. Computing the meet of the dual of the arrays here 1.79 + // causes the meet of the dual of the elements to be computed which 1.80 + // would cause the meet of the dual of the dual of the elements, 1.81 + // that is the meet of the elements already computed above to be 1.82 + // computed. Avoid redundant computations by requesting no 1.83 + // verification. 1.84 + C->_type_verify_symmetry = false; 1.85 + const Type *mt_dual = this_t->_dual->xmeet(t->_dual); 1.86 + this_t->_dual->check_symmetrical(t->_dual, mt_dual); 1.87 + assert(!C->_type_verify_symmetry, "shouldn't have changed"); 1.88 + C->_type_verify_symmetry = true; 1.89 #endif 1.90 return mt; 1.91 } 1.92 @@ -3971,10 +3995,10 @@ 1.93 (tap->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) || 1.94 // 'this' is exact and super or unrelated: 1.95 (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) { 1.96 - if (above_centerline(ptr)) { 1.97 + if (above_centerline(ptr) || (tary->_elem->make_ptr() && above_centerline(tary->_elem->make_ptr()->_ptr))) { 1.98 tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable); 1.99 } 1.100 - return make(NotNull, NULL, tary, lazy_klass, false, off, InstanceBot); 1.101 + return make(NotNull, NULL, tary, lazy_klass, false, off, InstanceBot, speculative, depth); 1.102 } 1.103 1.104 bool xk = false;