< prev index next >

src/share/vm/adlc/formssel.cpp

Print this page
rev 11675 : 8161907: adlc: Fix crash in cisc_spill_match if _rChild == NULL
Reviewed-by: kvn


3630     }
3631     // Detect reg vs memory
3632     else if( form->is_cisc_reg(globals) && form2->is_cisc_mem(globals) ) {
3633       cisc_spillable = Is_cisc_spillable;
3634       operand        = _name;
3635       reg_type       = _result;
3636       return Is_cisc_spillable;
3637     } else {
3638       cisc_spillable = Not_cisc_spillable;
3639     }
3640   }
3641 
3642   // If cisc is still possible, check rest of tree
3643   if( cisc_spillable == Maybe_cisc_spillable ) {
3644     // Check that each has same number of operands at this level
3645     if( (_lChild && !(mRule2->_lChild)) || (_rChild && !(mRule2->_rChild)) ) return Not_cisc_spillable;
3646 
3647     // Check left operands
3648     if( (_lChild == NULL) && (mRule2->_lChild == NULL) ) {
3649       left_spillable = Maybe_cisc_spillable;
3650     } else {
3651       left_spillable = _lChild->cisc_spill_match(globals, registers, mRule2->_lChild, operand, reg_type);
3652     }
3653 
3654     // Check right operands
3655     if( (_rChild == NULL) && (mRule2->_rChild == NULL) ) {
3656       right_spillable =  Maybe_cisc_spillable;
3657     } else {
3658       right_spillable = _rChild->cisc_spill_match(globals, registers, mRule2->_rChild, operand, reg_type);
3659     }
3660 
3661     // Combine results of left and right checks
3662     cisc_spillable = cisc_spill_merge(left_spillable, right_spillable);
3663   }
3664 
3665   return cisc_spillable;
3666 }
3667 
3668 //---------------------------cisc_spill_match_rule------------------------------
3669 // Recursively check two MatchRules for legal conversion via cisc-spilling
3670 // This method handles the root of Match tree,
3671 // general recursive checks done in MatchNode
3672 int  MatchRule::matchrule_cisc_spill_match(FormDict& globals, RegisterForm* registers,
3673                                            MatchRule* mRule2, const char* &operand,
3674                                            const char* &reg_type) {
3675   int cisc_spillable  = Maybe_cisc_spillable;
3676   int left_spillable  = Maybe_cisc_spillable;
3677   int right_spillable = Maybe_cisc_spillable;




3630     }
3631     // Detect reg vs memory
3632     else if( form->is_cisc_reg(globals) && form2->is_cisc_mem(globals) ) {
3633       cisc_spillable = Is_cisc_spillable;
3634       operand        = _name;
3635       reg_type       = _result;
3636       return Is_cisc_spillable;
3637     } else {
3638       cisc_spillable = Not_cisc_spillable;
3639     }
3640   }
3641 
3642   // If cisc is still possible, check rest of tree
3643   if( cisc_spillable == Maybe_cisc_spillable ) {
3644     // Check that each has same number of operands at this level
3645     if( (_lChild && !(mRule2->_lChild)) || (_rChild && !(mRule2->_rChild)) ) return Not_cisc_spillable;
3646 
3647     // Check left operands
3648     if( (_lChild == NULL) && (mRule2->_lChild == NULL) ) {
3649       left_spillable = Maybe_cisc_spillable;
3650     } else  if (_lChild != NULL) {
3651       left_spillable = _lChild->cisc_spill_match(globals, registers, mRule2->_lChild, operand, reg_type);
3652     }
3653 
3654     // Check right operands
3655     if( (_rChild == NULL) && (mRule2->_rChild == NULL) ) {
3656       right_spillable =  Maybe_cisc_spillable;
3657     } else if (_rChild != NULL) {
3658       right_spillable = _rChild->cisc_spill_match(globals, registers, mRule2->_rChild, operand, reg_type);
3659     }
3660 
3661     // Combine results of left and right checks
3662     cisc_spillable = cisc_spill_merge(left_spillable, right_spillable);
3663   }
3664 
3665   return cisc_spillable;
3666 }
3667 
3668 //---------------------------cisc_spill_match_rule------------------------------
3669 // Recursively check two MatchRules for legal conversion via cisc-spilling
3670 // This method handles the root of Match tree,
3671 // general recursive checks done in MatchNode
3672 int  MatchRule::matchrule_cisc_spill_match(FormDict& globals, RegisterForm* registers,
3673                                            MatchRule* mRule2, const char* &operand,
3674                                            const char* &reg_type) {
3675   int cisc_spillable  = Maybe_cisc_spillable;
3676   int left_spillable  = Maybe_cisc_spillable;
3677   int right_spillable = Maybe_cisc_spillable;


< prev index next >