1.1 --- a/src/share/vm/opto/postaloc.cpp Thu Sep 08 12:44:04 2011 -0700 1.2 +++ b/src/share/vm/opto/postaloc.cpp Thu Sep 08 09:35:41 2011 +0200 1.3 @@ -72,7 +72,22 @@ 1.4 return i == limit; 1.5 } 1.6 1.7 - 1.8 +//------------------------------yank----------------------------------- 1.9 +// Helper function for yank_if_dead 1.10 +int PhaseChaitin::yank( Node *old, Block *current_block, Node_List *value, Node_List *regnd ) { 1.11 + int blk_adjust=0; 1.12 + Block *oldb = _cfg._bbs[old->_idx]; 1.13 + oldb->find_remove(old); 1.14 + // Count 1 if deleting an instruction from the current block 1.15 + if( oldb == current_block ) blk_adjust++; 1.16 + _cfg._bbs.map(old->_idx,NULL); 1.17 + OptoReg::Name old_reg = lrgs(n2lidx(old)).reg(); 1.18 + if( regnd && (*regnd)[old_reg]==old ) { // Instruction is currently available? 1.19 + value->map(old_reg,NULL); // Yank from value/regnd maps 1.20 + regnd->map(old_reg,NULL); // This register's value is now unknown 1.21 + } 1.22 + return blk_adjust; 1.23 +} 1.24 1.25 //------------------------------yank_if_dead----------------------------------- 1.26 // Removed an edge from 'old'. Yank if dead. Return adjustment counts to 1.27 @@ -80,18 +95,20 @@ 1.28 int PhaseChaitin::yank_if_dead( Node *old, Block *current_block, Node_List *value, Node_List *regnd ) { 1.29 int blk_adjust=0; 1.30 while (old->outcnt() == 0 && old != C->top()) { 1.31 - Block *oldb = _cfg._bbs[old->_idx]; 1.32 - oldb->find_remove(old); 1.33 - // Count 1 if deleting an instruction from the current block 1.34 - if( oldb == current_block ) blk_adjust++; 1.35 - _cfg._bbs.map(old->_idx,NULL); 1.36 - OptoReg::Name old_reg = lrgs(n2lidx(old)).reg(); 1.37 - if( regnd && (*regnd)[old_reg]==old ) { // Instruction is currently available? 1.38 - value->map(old_reg,NULL); // Yank from value/regnd maps 1.39 - regnd->map(old_reg,NULL); // This register's value is now unknown 1.40 + blk_adjust += yank(old, current_block, value, regnd); 1.41 + 1.42 + Node *tmp = NULL; 1.43 + for (uint i = 1; i < old->req(); i++) { 1.44 + if (old->in(i)->is_MachTemp()) { 1.45 + Node* machtmp = old->in(i); 1.46 + assert(machtmp->outcnt() == 1, "expected for a MachTemp"); 1.47 + blk_adjust += yank(machtmp, current_block, value, regnd); 1.48 + machtmp->disconnect_inputs(NULL); 1.49 + } else { 1.50 + assert(tmp == NULL, "can't handle more non MachTemp inputs"); 1.51 + tmp = old->in(i); 1.52 + } 1.53 } 1.54 - assert(old->req() <= 2, "can't handle more inputs"); 1.55 - Node *tmp = old->req() > 1 ? old->in(1) : NULL; 1.56 old->disconnect_inputs(NULL); 1.57 if( !tmp ) break; 1.58 old = tmp;