src/share/vm/c1/c1_RangeCheckElimination.cpp

changeset 4869
d595e8ddadd9
parent 4860
46f6f063b272
child 4972
6a3629cf7075
     1.1 --- a/src/share/vm/c1/c1_RangeCheckElimination.cpp	Tue Mar 26 12:55:26 2013 -0700
     1.2 +++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp	Fri Mar 29 17:25:27 2013 +0100
     1.3 @@ -645,7 +645,7 @@
     1.4    return predicate_add(left, left_const, cond, const_instr, state, insert_position);
     1.5  }
     1.6  
     1.7 -// Insert deoptimization, returns true if sucessful or false if range check should not be removed
     1.8 +// Insert deoptimization
     1.9  void RangeCheckEliminator::insert_deoptimization(ValueStack *state, Instruction *insert_position, Instruction *array_instr, Instruction *length_instr, Instruction *lower_instr, int lower, Instruction *upper_instr, int upper, AccessIndexed *ai) {
    1.10    assert(is_ok_for_deoptimization(insert_position, array_instr, length_instr, lower_instr, lower, upper_instr, upper), "should have been tested before");
    1.11    bool upper_check = !(upper_instr && upper_instr->as_ArrayLength() && upper_instr->as_ArrayLength()->array() == array_instr);
    1.12 @@ -669,6 +669,9 @@
    1.13      }
    1.14    }
    1.15  
    1.16 +  // No upper check required -> skip
    1.17 +  if (!upper_check) return;
    1.18 +
    1.19    // We need to know length of array
    1.20    if (!length_instr) {
    1.21      // Load length if necessary
    1.22 @@ -680,9 +683,6 @@
    1.23      length_instr = length;
    1.24    }
    1.25  
    1.26 -  // No upper check required -> skip
    1.27 -  if (!upper_check) return;
    1.28 -
    1.29    if (!upper_instr) {
    1.30      // Compare for geq array.length
    1.31      insert_position = predicate_cmp_with_const(length_instr, Instruction::leq, upper, state, insert_position, bci);
    1.32 @@ -777,7 +777,7 @@
    1.33      tty->fill_to(block->dominator_depth()*2)
    1.34    );
    1.35    TRACE_RANGE_CHECK_ELIMINATION(
    1.36 -    tty->print_cr("Access indexed: index=%d length=%d", ai->index()->id(), ai->length()->id())
    1.37 +    tty->print_cr("Access indexed: index=%d length=%d", ai->index()->id(), (ai->length() != NULL ? ai->length()->id() :-1 ))
    1.38    );
    1.39  
    1.40    if (ai->check_flag(Instruction::NeedsRangeCheckFlag)) {

mercurial