src/share/vm/c1/c1_Optimizer.cpp

changeset 2174
f02a8bbe6ed4
parent 2138
d5d065957597
child 2254
42a10fc37986
     1.1 --- a/src/share/vm/c1/c1_Optimizer.cpp	Wed Sep 22 23:51:03 2010 -0700
     1.2 +++ b/src/share/vm/c1/c1_Optimizer.cpp	Tue Dec 29 19:08:54 2009 +0100
     1.3 @@ -140,25 +140,27 @@
     1.4      //    with an IfOp followed by a Goto
     1.5      // cut if_ away and get node before
     1.6      Instruction* cur_end = if_->prev(block);
     1.7 -    int bci = if_->bci();
     1.8  
     1.9      // append constants of true- and false-block if necessary
    1.10      // clone constants because original block must not be destroyed
    1.11      assert((t_value != f_const && f_value != t_const) || t_const == f_const, "mismatch");
    1.12      if (t_value == t_const) {
    1.13        t_value = new Constant(t_const->type());
    1.14 -      cur_end = cur_end->set_next(t_value, bci);
    1.15 +      NOT_PRODUCT(t_value->set_printable_bci(if_->printable_bci()));
    1.16 +      cur_end = cur_end->set_next(t_value);
    1.17      }
    1.18      if (f_value == f_const) {
    1.19        f_value = new Constant(f_const->type());
    1.20 -      cur_end = cur_end->set_next(f_value, bci);
    1.21 +      NOT_PRODUCT(f_value->set_printable_bci(if_->printable_bci()));
    1.22 +      cur_end = cur_end->set_next(f_value);
    1.23      }
    1.24  
    1.25      // it is very unlikely that the condition can be statically decided
    1.26      // (this was checked previously by the Canonicalizer), so always
    1.27      // append IfOp
    1.28      Value result = new IfOp(if_->x(), if_->cond(), if_->y(), t_value, f_value);
    1.29 -    cur_end = cur_end->set_next(result, bci);
    1.30 +    NOT_PRODUCT(result->set_printable_bci(if_->printable_bci()));
    1.31 +    cur_end = cur_end->set_next(result);
    1.32  
    1.33      // append Goto to successor
    1.34      ValueStack* state_before = if_->is_safepoint() ? if_->state_before() : NULL;
    1.35 @@ -167,16 +169,15 @@
    1.36      // prepare state for Goto
    1.37      ValueStack* goto_state = if_->state();
    1.38      while (sux_state->scope() != goto_state->scope()) {
    1.39 -      goto_state = goto_state->pop_scope();
    1.40 +      goto_state = goto_state->caller_state();
    1.41        assert(goto_state != NULL, "states do not match up");
    1.42      }
    1.43 -    goto_state = goto_state->copy();
    1.44 +    goto_state = goto_state->copy(ValueStack::StateAfter, goto_state->bci());
    1.45      goto_state->push(result->type(), result);
    1.46 -    assert(goto_state->is_same_across_scopes(sux_state), "states must match now");
    1.47 +    assert(goto_state->is_same(sux_state), "states must match now");
    1.48      goto_->set_state(goto_state);
    1.49  
    1.50 -    // Steal the bci for the goto from the sux
    1.51 -    cur_end = cur_end->set_next(goto_, sux->bci());
    1.52 +    cur_end = cur_end->set_next(goto_, goto_state->bci());
    1.53  
    1.54      // Adjust control flow graph
    1.55      BlockBegin::disconnect_edge(block, t_block);
    1.56 @@ -251,10 +252,8 @@
    1.57          // no phi functions must be present at beginning of sux
    1.58          ValueStack* sux_state = sux->state();
    1.59          ValueStack* end_state = end->state();
    1.60 -        while (end_state->scope() != sux_state->scope()) {
    1.61 -          // match up inlining level
    1.62 -          end_state = end_state->pop_scope();
    1.63 -        }
    1.64 +
    1.65 +        assert(end_state->scope() == sux_state->scope(), "scopes must match");
    1.66          assert(end_state->stack_size() == sux_state->stack_size(), "stack not equal");
    1.67          assert(end_state->locals_size() == sux_state->locals_size(), "locals not equal");
    1.68  
    1.69 @@ -273,7 +272,7 @@
    1.70          Instruction* prev = end->prev(block);
    1.71          Instruction* next = sux->next();
    1.72          assert(prev->as_BlockEnd() == NULL, "must not be a BlockEnd");
    1.73 -        prev->set_next(next, next->bci());
    1.74 +        prev->set_next(next);
    1.75          sux->disconnect_from_graph();
    1.76          block->set_end(sux->end());
    1.77          // add exception handlers of deleted block, if any
    1.78 @@ -337,7 +336,8 @@
    1.79                    newif->set_state(if_->state()->copy());
    1.80  
    1.81                    assert(prev->next() == if_, "must be guaranteed by above search");
    1.82 -                  prev->set_next(newif, if_->bci());
    1.83 +                  NOT_PRODUCT(newif->set_printable_bci(if_->printable_bci()));
    1.84 +                  prev->set_next(newif);
    1.85                    block->set_end(newif);
    1.86  
    1.87                    _merge_count++;
    1.88 @@ -705,7 +705,7 @@
    1.89      // visiting instructions which are references in other blocks or
    1.90      // visiting instructions more than once.
    1.91      mark_visitable(instr);
    1.92 -    if (instr->is_root() || instr->can_trap() || (instr->as_NullCheck() != NULL)) {
    1.93 +    if (instr->is_pinned() || instr->can_trap() || (instr->as_NullCheck() != NULL)) {
    1.94        mark_visited(instr);
    1.95        instr->input_values_do(this);
    1.96        instr->visit(&_visitor);

mercurial