comparison src/share/vm/opto/type.cpp @ 820:915cc9c5ebc6

6837094: False positive for "meet not symmetric" failure Summary: Have the meet not symmetric check recursively do the interface-vs-oop check on array subtypes. Reviewed-by: jrose Contributed-by: rasbold@google.com
author kvn
date Tue, 23 Jun 2009 17:52:29 -0700
parents 7bb995fbd3c0
children bf3489cc0aa0
comparison
equal deleted inserted replaced
819:c6386080541b 820:915cc9c5ebc6
485 // Is not a number (NaN) 485 // Is not a number (NaN)
486 bool Type::is_nan() const { 486 bool Type::is_nan() const {
487 return false; 487 return false;
488 } 488 }
489 489
490 //----------------------interface_vs_oop---------------------------------------
491 #ifdef ASSERT
492 bool Type::interface_vs_oop(const Type *t) const {
493 bool result = false;
494
495 const TypeInstPtr* this_inst = this->isa_instptr();
496 const TypeInstPtr* t_inst = t->isa_instptr();
497 if( this_inst && this_inst->is_loaded() && t_inst && t_inst->is_loaded() ) {
498 bool this_interface = this_inst->klass()->is_interface();
499 bool t_interface = t_inst->klass()->is_interface();
500 result = this_interface ^ t_interface;
501 }
502
503 return result;
504 }
505 #endif
506
490 //------------------------------meet------------------------------------------- 507 //------------------------------meet-------------------------------------------
491 // Compute the MEET of two types. NOT virtual. It enforces that meet is 508 // Compute the MEET of two types. NOT virtual. It enforces that meet is
492 // commutative and the lattice is symmetric. 509 // commutative and the lattice is symmetric.
493 const Type *Type::meet( const Type *t ) const { 510 const Type *Type::meet( const Type *t ) const {
494 if (isa_narrowoop() && t->isa_narrowoop()) { 511 if (isa_narrowoop() && t->isa_narrowoop()) {
505 const Type *t2this = dual_join->xmeet( _dual); 522 const Type *t2this = dual_join->xmeet( _dual);
506 523
507 // Interface meet Oop is Not Symmetric: 524 // Interface meet Oop is Not Symmetric:
508 // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull 525 // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull
509 // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull 526 // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull
510 const TypeInstPtr* this_inst = this->isa_instptr(); 527
511 const TypeInstPtr* t_inst = t->isa_instptr(); 528 if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != _dual) ) {
512 bool interface_vs_oop = false;
513 if( this_inst && this_inst->is_loaded() && t_inst && t_inst->is_loaded() ) {
514 bool this_interface = this_inst->klass()->is_interface();
515 bool t_interface = t_inst->klass()->is_interface();
516 interface_vs_oop = this_interface ^ t_interface;
517 }
518
519 if( !interface_vs_oop && (t2t != t->_dual || t2this != _dual) ) {
520 tty->print_cr("=== Meet Not Symmetric ==="); 529 tty->print_cr("=== Meet Not Symmetric ===");
521 tty->print("t = "); t->dump(); tty->cr(); 530 tty->print("t = "); t->dump(); tty->cr();
522 tty->print("this= "); dump(); tty->cr(); 531 tty->print("this= "); dump(); tty->cr();
523 tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); 532 tty->print("mt=(t meet this)= "); mt->dump(); tty->cr();
524 533
1797 //------------------------------hash------------------------------------------- 1806 //------------------------------hash-------------------------------------------
1798 // Type-specific hashing function. 1807 // Type-specific hashing function.
1799 int TypeAry::hash(void) const { 1808 int TypeAry::hash(void) const {
1800 return (intptr_t)_elem + (intptr_t)_size; 1809 return (intptr_t)_elem + (intptr_t)_size;
1801 } 1810 }
1811
1812 //----------------------interface_vs_oop---------------------------------------
1813 #ifdef ASSERT
1814 bool TypeAry::interface_vs_oop(const Type *t) const {
1815 const TypeAry* t_ary = t->is_ary();
1816 if (t_ary) {
1817 return _elem->interface_vs_oop(t_ary->_elem);
1818 }
1819 return false;
1820 }
1821 #endif
1802 1822
1803 //------------------------------dump2------------------------------------------ 1823 //------------------------------dump2------------------------------------------
1804 #ifndef PRODUCT 1824 #ifndef PRODUCT
1805 void TypeAry::dump2( Dict &d, uint depth, outputStream *st ) const { 1825 void TypeAry::dump2( Dict &d, uint depth, outputStream *st ) const {
1806 _elem->dump2(d, depth, st); 1826 _elem->dump2(d, depth, st);
3387 // Dual: compute field-by-field dual 3407 // Dual: compute field-by-field dual
3388 const Type *TypeAryPtr::xdual() const { 3408 const Type *TypeAryPtr::xdual() const {
3389 return new TypeAryPtr( dual_ptr(), _const_oop, _ary->dual()->is_ary(),_klass, _klass_is_exact, dual_offset(), dual_instance_id() ); 3409 return new TypeAryPtr( dual_ptr(), _const_oop, _ary->dual()->is_ary(),_klass, _klass_is_exact, dual_offset(), dual_instance_id() );
3390 } 3410 }
3391 3411
3412 //----------------------interface_vs_oop---------------------------------------
3413 #ifdef ASSERT
3414 bool TypeAryPtr::interface_vs_oop(const Type *t) const {
3415 const TypeAryPtr* t_aryptr = t->isa_aryptr();
3416 if (t_aryptr) {
3417 return _ary->interface_vs_oop(t_aryptr->_ary);
3418 }
3419 return false;
3420 }
3421 #endif
3422
3392 //------------------------------dump2------------------------------------------ 3423 //------------------------------dump2------------------------------------------
3393 #ifndef PRODUCT 3424 #ifndef PRODUCT
3394 void TypeAryPtr::dump2( Dict &d, uint depth, outputStream *st ) const { 3425 void TypeAryPtr::dump2( Dict &d, uint depth, outputStream *st ) const {
3395 _ary->dump2(d,depth,st); 3426 _ary->dump2(d,depth,st);
3396 switch( _ptr ) { 3427 switch( _ptr ) {