Merge

Fri, 14 Aug 2009 15:55:26 -0700

author
never
date
Fri, 14 Aug 2009 15:55:26 -0700
changeset 1359
55784fd95fe3
parent 1356
046932b72aa2
parent 1358
a70508bb21c3
child 1360
7c14587118b3

Merge

     1.1 --- a/src/share/vm/opto/chaitin.hpp	Fri Aug 14 00:02:12 2009 -0700
     1.2 +++ b/src/share/vm/opto/chaitin.hpp	Fri Aug 14 15:55:26 2009 -0700
     1.3 @@ -458,6 +458,16 @@
     1.4    // Post-Allocation peephole copy removal
     1.5    void post_allocate_copy_removal();
     1.6    Node *skip_copies( Node *c );
     1.7 +  // Replace the old node with the current live version of that value
     1.8 +  // and yank the old value if it's dead.
     1.9 +  int replace_and_yank_if_dead( Node *old, OptoReg::Name nreg,
    1.10 +                                Block *current_block, Node_List& value, Node_List& regnd ) {
    1.11 +    Node* v = regnd[nreg];
    1.12 +    assert(v->outcnt() != 0, "no dead values");
    1.13 +    old->replace_by(v);
    1.14 +    return yank_if_dead(old, current_block, &value, &regnd);
    1.15 +  }
    1.16 +
    1.17    int yank_if_dead( Node *old, Block *current_block, Node_List *value, Node_List *regnd );
    1.18    int elide_copy( Node *n, int k, Block *current_block, Node_List &value, Node_List &regnd, bool can_change_regs );
    1.19    int use_prior_register( Node *copy, uint idx, Node *def, Block *current_block, Node_List &value, Node_List &regnd );
     2.1 --- a/src/share/vm/opto/postaloc.cpp	Fri Aug 14 00:02:12 2009 -0700
     2.2 +++ b/src/share/vm/opto/postaloc.cpp	Fri Aug 14 15:55:26 2009 -0700
     2.3 @@ -88,6 +88,7 @@
     2.4        value->map(old_reg,NULL);  // Yank from value/regnd maps
     2.5        regnd->map(old_reg,NULL);  // This register's value is now unknown
     2.6      }
     2.7 +    assert(old->req() <= 2, "can't handle more inputs");
     2.8      Node *tmp = old->req() > 1 ? old->in(1) : NULL;
     2.9      old->disconnect_inputs(NULL);
    2.10      if( !tmp ) break;
    2.11 @@ -530,6 +531,16 @@
    2.12        // Do not change from int to pointer
    2.13        Node *val = skip_copies(n);
    2.14  
    2.15 +      // Clear out a dead definition before starting so that the
    2.16 +      // elimination code doesn't have to guard against it.  The
    2.17 +      // definition could in fact be a kill projection with a count of
    2.18 +      // 0 which is safe but since those are uninteresting for copy
    2.19 +      // elimination just delete them as well.
    2.20 +      if (regnd[nreg] != NULL && regnd[nreg]->outcnt() == 0) {
    2.21 +        regnd.map(nreg, NULL);
    2.22 +        value.map(nreg, NULL);
    2.23 +      }
    2.24 +
    2.25        uint n_ideal_reg = n->ideal_reg();
    2.26        if( is_single_register(n_ideal_reg) ) {
    2.27          // If Node 'n' does not change the value mapped by the register,
    2.28 @@ -537,8 +548,7 @@
    2.29          // mapping so 'n' will go dead.
    2.30          if( value[nreg] != val ) {
    2.31            if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, OptoReg::Bad)) {
    2.32 -            n->replace_by(regnd[nreg]);
    2.33 -            j -= yank_if_dead(n,b,&value,&regnd);
    2.34 +            j -= replace_and_yank_if_dead(n, nreg, b, value, regnd);
    2.35            } else {
    2.36              // Update the mapping: record new Node defined by the register
    2.37              regnd.map(nreg,n);
    2.38 @@ -546,10 +556,9 @@
    2.39              // Node after skipping all copies.
    2.40              value.map(nreg,val);
    2.41            }
    2.42 -        } else if( !may_be_copy_of_callee(n) && regnd[nreg]->outcnt() != 0 ) {
    2.43 +        } else if( !may_be_copy_of_callee(n) ) {
    2.44            assert( n->is_Copy(), "" );
    2.45 -          n->replace_by(regnd[nreg]);
    2.46 -          j -= yank_if_dead(n,b,&value,&regnd);
    2.47 +          j -= replace_and_yank_if_dead(n, nreg, b, value, regnd);
    2.48          }
    2.49        } else {
    2.50          // If the value occupies a register pair, record same info
    2.51 @@ -565,18 +574,16 @@
    2.52          }
    2.53          if( value[nreg] != val || value[nreg_lo] != val ) {
    2.54            if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, nreg_lo)) {
    2.55 -            n->replace_by(regnd[nreg]);
    2.56 -            j -= yank_if_dead(n,b,&value,&regnd);
    2.57 +            j -= replace_and_yank_if_dead(n, nreg, b, value, regnd);
    2.58            } else {
    2.59              regnd.map(nreg   , n );
    2.60              regnd.map(nreg_lo, n );
    2.61              value.map(nreg   ,val);
    2.62              value.map(nreg_lo,val);
    2.63            }
    2.64 -        } else if( !may_be_copy_of_callee(n) && regnd[nreg]->outcnt() != 0 ) {
    2.65 +        } else if( !may_be_copy_of_callee(n) ) {
    2.66            assert( n->is_Copy(), "" );
    2.67 -          n->replace_by(regnd[nreg]);
    2.68 -          j -= yank_if_dead(n,b,&value,&regnd);
    2.69 +          j -= replace_and_yank_if_dead(n, nreg, b, value, regnd);
    2.70          }
    2.71        }
    2.72  

mercurial