@@ -1009,16 +1009,16 @@ const Type *XorINode::add_ring( const Type *t0, const Type *t1 ) const {
10091009 const TypeInt *r1 = t1->is_int ();
10101010
10111011 if (r0->is_con () && r1->is_con ()) {
1012- // Constant fold: (c1 ^ c2) -> c3
1012+ // compute constant result
10131013 return TypeInt::make (r0->get_con () ^ r1->get_con ());
10141014 }
10151015
10161016 // At least one of the arguments is not constant
10171017
10181018 if (r0->_lo >= 0 && r1->_lo >= 0 ) {
1019- // Combine [0, lo_1 ] ^ [0, hi_1 ] -> [0, max ]
1020- jint max = xor_upper_bound_for_ranges<jint, juint>(r0->_hi , r1->_hi );
1021- return TypeInt::make (0 , max , MAX2 (r0->_widen , r1->_widen ));
1019+ // Combine [r0->_lo, r0->_hi ] ^ [r0->_lo, r1->_hi ] -> [0, upper_bound ]
1020+ jint upper_bound = xor_upper_bound_for_ranges<jint, juint>(r0->_hi , r1->_hi );
1021+ return TypeInt::make (0 , upper_bound , MAX2 (r0->_widen , r1->_widen ));
10221022 }
10231023
10241024 return TypeInt::INT;
@@ -1031,16 +1031,16 @@ const Type *XorLNode::add_ring( const Type *t0, const Type *t1 ) const {
10311031 const TypeLong *r1 = t1->is_long ();
10321032
10331033 if (r0->is_con () && r1->is_con ()) {
1034- // Constant fold: (c1 ^ c2) -> c3
1034+ // compute constant result
10351035 return TypeLong::make (r0->get_con () ^ r1->get_con ());
10361036 }
10371037
10381038 // At least one of the arguments is not constant
10391039
10401040 if (r0->_lo >= 0 && r1->_lo >= 0 ) {
1041- // Combine [0, lo_1 ] ^ [0, hi_1 ] -> [0, max ]
1042- julong max = xor_upper_bound_for_ranges<jlong, julong>(r0->_hi , r1->_hi );
1043- return TypeLong::make (0 , max , MAX2 (r0->_widen , r1->_widen ));
1041+ // Combine [r0->_lo, r0->_hi ] ^ [r0->_lo, r1->_hi ] -> [0, upper_bound ]
1042+ julong upper_bound = xor_upper_bound_for_ranges<jlong, julong>(r0->_hi , r1->_hi );
1043+ return TypeLong::make (0 , upper_bound , MAX2 (r0->_widen , r1->_widen ));
10441044 }
10451045
10461046 return TypeLong::LONG;
0 commit comments