1.1 --- a/src/share/vm/adlc/formssel.cpp Thu Feb 26 16:57:21 2009 -0800 1.2 +++ b/src/share/vm/adlc/formssel.cpp Fri Feb 27 03:35:40 2009 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -844,8 +844,12 @@ 1.11 for (_parameters.reset(); (name = _parameters.iter()) != NULL;) { 1.12 OperandForm *opForm = (OperandForm*)_localNames[name]; 1.13 1.14 - const Form *form = _effects[name]; 1.15 - Effect *e = form ? form->is_effect() : NULL; 1.16 + Effect* e = NULL; 1.17 + { 1.18 + const Form* form = _effects[name]; 1.19 + e = form ? form->is_effect() : NULL; 1.20 + } 1.21 + 1.22 if (e != NULL) { 1.23 has_temp |= e->is(Component::TEMP); 1.24 1.25 @@ -1110,7 +1114,7 @@ 1.26 const char *op_name = NULL; 1.27 const char *reg_type = NULL; 1.28 FormDict &globals = AD.globalNames(); 1.29 - cisc_spill_operand = _matrule->cisc_spill_match(globals, AD.get_registers(), instr->_matrule, op_name, reg_type); 1.30 + cisc_spill_operand = _matrule->matchrule_cisc_spill_match(globals, AD.get_registers(), instr->_matrule, op_name, reg_type); 1.31 if( (cisc_spill_operand != Not_cisc_spillable) && (op_name != NULL) && equivalent_predicates(this, instr) ) { 1.32 cisc_spill_operand = operand_position(op_name, Component::USE); 1.33 int def_oper = operand_position(op_name, Component::DEF); 1.34 @@ -2194,7 +2198,7 @@ 1.35 // Return -1 if not in list. 1.36 int OperandForm::constant_position(FormDict &globals, const Component *last) { 1.37 // Iterate through components and count constants preceeding 'constant' 1.38 - uint position = 0; 1.39 + int position = 0; 1.40 Component *comp; 1.41 _components.reset(); 1.42 while( (comp = _components.iter()) != NULL && (comp != last) ) { 1.43 @@ -2297,7 +2301,7 @@ 1.44 if ( op->is_base_constant(globals) == Form::idealP ) { 1.45 // Find the constant's index: _c0, _c1, _c2, ... , _cN 1.46 uint idx = op->constant_position( globals, rep_var); 1.47 - fprintf(fp," virtual bool disp_is_oop() const {", _ident); 1.48 + fprintf(fp," virtual bool disp_is_oop() const {"); 1.49 fprintf(fp, " return _c%d->isa_oop_ptr();", idx); 1.50 fprintf(fp, " }\n"); 1.51 } 1.52 @@ -3035,9 +3039,9 @@ 1.53 1.54 // Recursive call collecting info on top-level operands, not transitive. 1.55 // Implementation does not modify state of internal structures. 1.56 -void MatchNode::append_components(FormDict &locals, ComponentList &components, 1.57 - bool deflag) const { 1.58 - int usedef = deflag ? Component::DEF : Component::USE; 1.59 +void MatchNode::append_components(FormDict& locals, ComponentList& components, 1.60 + bool def_flag) const { 1.61 + int usedef = def_flag ? Component::DEF : Component::USE; 1.62 FormDict &globals = _AD.globalNames(); 1.63 1.64 assert (_name != NULL, "MatchNode::build_components encountered empty node\n"); 1.65 @@ -3055,10 +3059,10 @@ 1.66 return; 1.67 } 1.68 // Promote results of "Set" to DEF 1.69 - bool def_flag = (!strcmp(_opType, "Set")) ? true : false; 1.70 - if (_lChild) _lChild->append_components(locals, components, def_flag); 1.71 - def_flag = false; // only applies to component immediately following 'Set' 1.72 - if (_rChild) _rChild->append_components(locals, components, def_flag); 1.73 + bool tmpdef_flag = (!strcmp(_opType, "Set")) ? true : false; 1.74 + if (_lChild) _lChild->append_components(locals, components, tmpdef_flag); 1.75 + tmpdef_flag = false; // only applies to component immediately following 'Set' 1.76 + if (_rChild) _rChild->append_components(locals, components, tmpdef_flag); 1.77 } 1.78 1.79 // Find the n'th base-operand in the match node, 1.80 @@ -3404,9 +3408,9 @@ 1.81 return (form1 == form2); 1.82 } 1.83 1.84 -//-------------------------cisc_spill_match------------------------------------ 1.85 +//-------------------------cisc_spill_match_node------------------------------- 1.86 // Recursively check two MatchRules for legal conversion via cisc-spilling 1.87 -int MatchNode::cisc_spill_match(FormDict &globals, RegisterForm *registers, MatchNode *mRule2, const char * &operand, const char * ®_type) { 1.88 +int MatchNode::cisc_spill_match(FormDict& globals, RegisterForm* registers, MatchNode* mRule2, const char* &operand, const char* ®_type) { 1.89 int cisc_spillable = Maybe_cisc_spillable; 1.90 int left_spillable = Maybe_cisc_spillable; 1.91 int right_spillable = Maybe_cisc_spillable; 1.92 @@ -3480,13 +3484,13 @@ 1.93 return cisc_spillable; 1.94 } 1.95 1.96 -//---------------------------cisc_spill_match---------------------------------- 1.97 +//---------------------------cisc_spill_match_rule------------------------------ 1.98 // Recursively check two MatchRules for legal conversion via cisc-spilling 1.99 // This method handles the root of Match tree, 1.100 // general recursive checks done in MatchNode 1.101 -int MatchRule::cisc_spill_match(FormDict &globals, RegisterForm *registers, 1.102 - MatchRule *mRule2, const char * &operand, 1.103 - const char * ®_type) { 1.104 +int MatchRule::matchrule_cisc_spill_match(FormDict& globals, RegisterForm* registers, 1.105 + MatchRule* mRule2, const char* &operand, 1.106 + const char* ®_type) { 1.107 int cisc_spillable = Maybe_cisc_spillable; 1.108 int left_spillable = Maybe_cisc_spillable; 1.109 int right_spillable = Maybe_cisc_spillable; 1.110 @@ -3524,7 +3528,7 @@ 1.111 //----------------------------- equivalent ------------------------------------ 1.112 // Recursively check to see if two match rules are equivalent. 1.113 // This rule handles the root. 1.114 -bool MatchRule::equivalent(FormDict &globals, MatchRule *mRule2) { 1.115 +bool MatchRule::equivalent(FormDict &globals, MatchNode *mRule2) { 1.116 // Check that each sets a result 1.117 if (sets_result() != mRule2->sets_result()) { 1.118 return false; 1.119 @@ -3640,7 +3644,7 @@ 1.120 1.121 //-------------------------- swap_commutative_op ------------------------------ 1.122 // Recursively swap specified commutative operation with subtree operands. 1.123 -void MatchRule::swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt) { 1.124 +void MatchRule::matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt) { 1.125 assert(match_rules_cnt < 100," too many match rule clones"); 1.126 // Clone 1.127 MatchRule* clone = new MatchRule(_AD, this); 1.128 @@ -3653,8 +3657,8 @@ 1.129 clone->_next = this->_next; 1.130 this-> _next = clone; 1.131 if( (--count) > 0 ) { 1.132 - this-> swap_commutative_op(instr_ident, count, match_rules_cnt); 1.133 - clone->swap_commutative_op(instr_ident, count, match_rules_cnt); 1.134 + this-> matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt); 1.135 + clone->matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt); 1.136 } 1.137 } 1.138 1.139 @@ -3686,7 +3690,7 @@ 1.140 1.141 // Recursive call collecting info on top-level operands, not transitive. 1.142 // Implementation does not modify state of internal structures. 1.143 -void MatchRule::append_components(FormDict &locals, ComponentList &components) const { 1.144 +void MatchRule::append_components(FormDict& locals, ComponentList& components, bool def_flag) const { 1.145 assert (_name != NULL, "MatchNode::build_components encountered empty node\n"); 1.146 1.147 MatchNode::append_components(locals, components,