@@ -71,10 +71,11 @@ Matcher::Matcher()
71
71
_end_inst_chain_rule(_END_INST_CHAIN_RULE),
72
72
_must_clone(must_clone),
73
73
_shared_nodes(C->comp_arena ()),
74
- #ifdef ASSERT
74
+ #ifndef PRODUCT
75
75
_old2new_map (C->comp_arena ()),
76
76
_new2old_map(C->comp_arena ()),
77
- #endif
77
+ _reused(C->comp_arena ()),
78
+ #endif // !PRODUCT
78
79
_allocation_started (false ),
79
80
_ruleName(ruleName),
80
81
_register_save_policy(register_save_policy),
@@ -1098,16 +1099,12 @@ Node *Matcher::xform( Node *n, int max_stack ) {
1098
1099
if (n->is_Proj () && n->in (0 ) != NULL && n->in (0 )->is_Multi ()) { // Projections?
1099
1100
// Convert to machine-dependent projection
1100
1101
m = n->in (0 )->as_Multi ()->match ( n->as_Proj (), this );
1101
- #ifdef ASSERT
1102
- _new2old_map.map (m->_idx , n);
1103
- #endif
1102
+ NOT_PRODUCT (record_new2old (m, n);)
1104
1103
if (m->in (0 ) != NULL ) // m might be top
1105
1104
collect_null_checks (m, n);
1106
1105
} else { // Else just a regular 'ol guy
1107
1106
m = n->clone (); // So just clone into new-space
1108
- #ifdef ASSERT
1109
- _new2old_map.map (m->_idx , n);
1110
- #endif
1107
+ NOT_PRODUCT (record_new2old (m, n);)
1111
1108
// Def-Use edges will be added incrementally as Uses
1112
1109
// of this node are matched.
1113
1110
assert (m->outcnt () == 0 , " no Uses of this clone yet" );
@@ -1165,9 +1162,7 @@ Node *Matcher::xform( Node *n, int max_stack ) {
1165
1162
// || op == Op_BoxLock // %%%% enable this and remove (+++) in chaitin.cpp
1166
1163
) {
1167
1164
m = m->clone ();
1168
- #ifdef ASSERT
1169
- _new2old_map.map (m->_idx , n);
1170
- #endif
1165
+ NOT_PRODUCT (record_new2old (m, n));
1171
1166
mstack.push (m, Post_Visit, n, i); // Don't need to visit
1172
1167
mstack.push (m->in (0 ), Visit, m, 0 );
1173
1168
} else {
@@ -1499,10 +1494,8 @@ MachNode *Matcher::match_tree( const Node *n ) {
1499
1494
}
1500
1495
// Reduce input tree based upon the state labels to machine Nodes
1501
1496
MachNode *m = ReduceInst (s, s->rule (mincost), mem);
1502
- #ifdef ASSERT
1503
- _old2new_map.map (n->_idx , m);
1504
- _new2old_map.map (m->_idx , (Node*)n);
1505
- #endif
1497
+ // New-to-old mapping is done in ReduceInst, to cover complex instructions.
1498
+ NOT_PRODUCT (_old2new_map.map (n->_idx , m);)
1506
1499
1507
1500
// Add any Matcher-ignored edges
1508
1501
uint cnt = n->req ();
@@ -1759,6 +1752,7 @@ MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) {
1759
1752
mach->_opnds [0 ] = s->MachOperGenerator (_reduceOp[rule]);
1760
1753
assert ( mach->_opnds [0 ] != NULL , " Missing result operand" );
1761
1754
Node *leaf = s->_leaf ;
1755
+ NOT_PRODUCT (record_new2old (mach, leaf);)
1762
1756
// Check for instruction or instruction chain rule
1763
1757
if ( rule >= _END_INST_CHAIN_RULE || rule < _BEGIN_INST_CHAIN_RULE ) {
1764
1758
assert (C->node_arena ()->contains (s->_leaf ) || !has_new_node (s->_leaf ),
@@ -1827,9 +1821,7 @@ MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) {
1827
1821
for ( uint i=0 ; i<mach->req (); i++ ) {
1828
1822
mach->set_req (i,NULL );
1829
1823
}
1830
- #ifdef ASSERT
1831
- _new2old_map.map (ex->_idx , s->_leaf );
1832
- #endif
1824
+ NOT_PRODUCT (record_new2old (ex, s->_leaf );)
1833
1825
}
1834
1826
1835
1827
// PhaseChaitin::fixup_spills will sometimes generate spill code
@@ -2427,12 +2419,22 @@ void Matcher::find_shared_post_visit(Node* n, uint opcode) {
2427
2419
}
2428
2420
}
2429
2421
2430
- #ifdef ASSERT
2422
+ #ifndef PRODUCT
2423
+ void Matcher::record_new2old (Node* newn, Node* old) {
2424
+ _new2old_map.map (newn->_idx , old);
2425
+ if (!_reused.test_set (old->_igv_idx )) {
2426
+ // Reuse the Ideal-level IGV identifier so that the node can be tracked
2427
+ // across matching. If there are multiple machine nodes expanded from the
2428
+ // same Ideal node, only one will reuse its IGV identifier.
2429
+ newn->_igv_idx = old->_igv_idx ;
2430
+ }
2431
+ }
2432
+
2431
2433
// machine-independent root to machine-dependent root
2432
2434
void Matcher::dump_old2new_map () {
2433
2435
_old2new_map.dump ();
2434
2436
}
2435
- #endif
2437
+ #endif // !PRODUCT
2436
2438
2437
2439
// ---------------------------collect_null_checks-------------------------------
2438
2440
// Find null checks in the ideal graph; write a machine-specific node for
0 commit comments