49 //---------------------------Matcher------------------------------------------- |
49 //---------------------------Matcher------------------------------------------- |
50 Matcher::Matcher( Node_List &proj_list ) : |
50 Matcher::Matcher( Node_List &proj_list ) : |
51 PhaseTransform( Phase::Ins_Select ), |
51 PhaseTransform( Phase::Ins_Select ), |
52 #ifdef ASSERT |
52 #ifdef ASSERT |
53 _old2new_map(C->comp_arena()), |
53 _old2new_map(C->comp_arena()), |
|
54 _new2old_map(C->comp_arena()), |
54 #endif |
55 #endif |
55 _shared_nodes(C->comp_arena()), |
56 _shared_nodes(C->comp_arena()), |
56 _reduceOp(reduceOp), _leftOp(leftOp), _rightOp(rightOp), |
57 _reduceOp(reduceOp), _leftOp(leftOp), _rightOp(rightOp), |
57 _swallowed(swallowed), |
58 _swallowed(swallowed), |
58 _begin_inst_chain_rule(_BEGIN_INST_CHAIN_RULE), |
59 _begin_inst_chain_rule(_BEGIN_INST_CHAIN_RULE), |
833 if (m == NULL) { Matcher::soft_match_failure(); return NULL; } |
834 if (m == NULL) { Matcher::soft_match_failure(); return NULL; } |
834 } else { // Nothing the matcher cares about |
835 } else { // Nothing the matcher cares about |
835 if( n->is_Proj() && n->in(0)->is_Multi()) { // Projections? |
836 if( n->is_Proj() && n->in(0)->is_Multi()) { // Projections? |
836 // Convert to machine-dependent projection |
837 // Convert to machine-dependent projection |
837 m = n->in(0)->as_Multi()->match( n->as_Proj(), this ); |
838 m = n->in(0)->as_Multi()->match( n->as_Proj(), this ); |
|
839 #ifdef ASSERT |
|
840 _new2old_map.map(m->_idx, n); |
|
841 #endif |
838 if (m->in(0) != NULL) // m might be top |
842 if (m->in(0) != NULL) // m might be top |
839 collect_null_checks(m); |
843 collect_null_checks(m); |
840 } else { // Else just a regular 'ol guy |
844 } else { // Else just a regular 'ol guy |
841 m = n->clone(); // So just clone into new-space |
845 m = n->clone(); // So just clone into new-space |
|
846 #ifdef ASSERT |
|
847 _new2old_map.map(m->_idx, n); |
|
848 #endif |
842 // Def-Use edges will be added incrementally as Uses |
849 // Def-Use edges will be added incrementally as Uses |
843 // of this node are matched. |
850 // of this node are matched. |
844 assert(m->outcnt() == 0, "no Uses of this clone yet"); |
851 assert(m->outcnt() == 0, "no Uses of this clone yet"); |
845 } |
852 } |
846 } |
853 } |
885 if( op == Op_ConI || op == Op_ConP || op == Op_ConN || |
892 if( op == Op_ConI || op == Op_ConP || op == Op_ConN || |
886 op == Op_ConF || op == Op_ConD || op == Op_ConL |
893 op == Op_ConF || op == Op_ConD || op == Op_ConL |
887 // || op == Op_BoxLock // %%%% enable this and remove (+++) in chaitin.cpp |
894 // || op == Op_BoxLock // %%%% enable this and remove (+++) in chaitin.cpp |
888 ) { |
895 ) { |
889 m = m->clone(); |
896 m = m->clone(); |
|
897 #ifdef ASSERT |
|
898 _new2old_map.map(m->_idx, n); |
|
899 #endif |
890 mstack.push(m, Post_Visit, n, i); // Don't neet to visit |
900 mstack.push(m, Post_Visit, n, i); // Don't neet to visit |
891 mstack.push(m->in(0), Visit, m, 0); |
901 mstack.push(m->in(0), Visit, m, 0); |
892 } else { |
902 } else { |
893 mstack.push(m, Visit, n, i); |
903 mstack.push(m, Visit, n, i); |
894 } |
904 } |
1188 } |
1198 } |
1189 // Reduce input tree based upon the state labels to machine Nodes |
1199 // Reduce input tree based upon the state labels to machine Nodes |
1190 MachNode *m = ReduceInst( s, s->_rule[mincost], mem ); |
1200 MachNode *m = ReduceInst( s, s->_rule[mincost], mem ); |
1191 #ifdef ASSERT |
1201 #ifdef ASSERT |
1192 _old2new_map.map(n->_idx, m); |
1202 _old2new_map.map(n->_idx, m); |
|
1203 _new2old_map.map(m->_idx, (Node*)n); |
1193 #endif |
1204 #endif |
1194 |
1205 |
1195 // Add any Matcher-ignored edges |
1206 // Add any Matcher-ignored edges |
1196 uint cnt = n->req(); |
1207 uint cnt = n->req(); |
1197 uint start = 1; |
1208 uint start = 1; |
1489 ex->in(1)->set_req(0, C->root()); |
1500 ex->in(1)->set_req(0, C->root()); |
1490 // Remove old node from the graph |
1501 // Remove old node from the graph |
1491 for( uint i=0; i<mach->req(); i++ ) { |
1502 for( uint i=0; i<mach->req(); i++ ) { |
1492 mach->set_req(i,NULL); |
1503 mach->set_req(i,NULL); |
1493 } |
1504 } |
|
1505 #ifdef ASSERT |
|
1506 _new2old_map.map(ex->_idx, s->_leaf); |
|
1507 #endif |
1494 } |
1508 } |
1495 |
1509 |
1496 // PhaseChaitin::fixup_spills will sometimes generate spill code |
1510 // PhaseChaitin::fixup_spills will sometimes generate spill code |
1497 // via the matcher. By the time, nodes have been wired into the CFG, |
1511 // via the matcher. By the time, nodes have been wired into the CFG, |
1498 // and any further nodes generated by expand rules will be left hanging |
1512 // and any further nodes generated by expand rules will be left hanging |