comparison src/share/vm/opto/subnode.cpp @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents 3288958bf319
children d1605aabd0a1 99bf1609e2a5
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
731 731
732 // Bypass the dependent load, and compare directly 732 // Bypass the dependent load, and compare directly
733 this->set_req(1,ldk2); 733 this->set_req(1,ldk2);
734 734
735 return this; 735 return this;
736 }
737
738 //=============================================================================
739 //------------------------------sub--------------------------------------------
740 // Simplify an CmpN (compare 2 pointers) node, based on local information.
741 // If both inputs are constants, compare them.
742 const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const {
743 const TypePtr *r0 = t1->is_narrowoop()->make_oopptr(); // Handy access
744 const TypePtr *r1 = t2->is_narrowoop()->make_oopptr();
745
746 // Undefined inputs makes for an undefined result
747 if( TypePtr::above_centerline(r0->_ptr) ||
748 TypePtr::above_centerline(r1->_ptr) )
749 return Type::TOP;
750
751 if (r0 == r1 && r0->singleton()) {
752 // Equal pointer constants (klasses, nulls, etc.)
753 return TypeInt::CC_EQ;
754 }
755
756 // See if it is 2 unrelated classes.
757 const TypeOopPtr* p0 = r0->isa_oopptr();
758 const TypeOopPtr* p1 = r1->isa_oopptr();
759 if (p0 && p1) {
760 ciKlass* klass0 = p0->klass();
761 bool xklass0 = p0->klass_is_exact();
762 ciKlass* klass1 = p1->klass();
763 bool xklass1 = p1->klass_is_exact();
764 int kps = (p0->isa_klassptr()?1:0) + (p1->isa_klassptr()?1:0);
765 if (klass0 && klass1 &&
766 kps != 1 && // both or neither are klass pointers
767 !klass0->is_interface() && // do not trust interfaces
768 !klass1->is_interface()) {
769 // See if neither subclasses the other, or if the class on top
770 // is precise. In either of these cases, the compare must fail.
771 if (klass0->equals(klass1) || // if types are unequal but klasses are
772 !klass0->is_java_klass() || // types not part of Java language?
773 !klass1->is_java_klass()) { // types not part of Java language?
774 // Do nothing; we know nothing for imprecise types
775 } else if (klass0->is_subtype_of(klass1)) {
776 // If klass1's type is PRECISE, then we can fail.
777 if (xklass1) return TypeInt::CC_GT;
778 } else if (klass1->is_subtype_of(klass0)) {
779 // If klass0's type is PRECISE, then we can fail.
780 if (xklass0) return TypeInt::CC_GT;
781 } else { // Neither subtypes the other
782 return TypeInt::CC_GT; // ...so always fail
783 }
784 }
785 }
786
787 // Known constants can be compared exactly
788 // Null can be distinguished from any NotNull pointers
789 // Unknown inputs makes an unknown result
790 if( r0->singleton() ) {
791 intptr_t bits0 = r0->get_con();
792 if( r1->singleton() )
793 return bits0 == r1->get_con() ? TypeInt::CC_EQ : TypeInt::CC_GT;
794 return ( r1->_ptr == TypePtr::NotNull && bits0==0 ) ? TypeInt::CC_GT : TypeInt::CC;
795 } else if( r1->singleton() ) {
796 intptr_t bits1 = r1->get_con();
797 return ( r0->_ptr == TypePtr::NotNull && bits1==0 ) ? TypeInt::CC_GT : TypeInt::CC;
798 } else
799 return TypeInt::CC;
800 }
801
802 //------------------------------Ideal------------------------------------------
803 Node *CmpNNode::Ideal( PhaseGVN *phase, bool can_reshape ) {
804 return NULL;
736 } 805 }
737 806
738 //============================================================================= 807 //=============================================================================
739 //------------------------------Value------------------------------------------ 808 //------------------------------Value------------------------------------------
740 // Simplify an CmpF (compare 2 floats ) node, based on local information. 809 // Simplify an CmpF (compare 2 floats ) node, based on local information.