diff -r 30f42e691e70 -r d595e8ddadd9 src/share/vm/c1/c1_RangeCheckElimination.cpp --- a/src/share/vm/c1/c1_RangeCheckElimination.cpp Tue Mar 26 12:55:26 2013 -0700 +++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp Fri Mar 29 17:25:27 2013 +0100 @@ -645,7 +645,7 @@ return predicate_add(left, left_const, cond, const_instr, state, insert_position); } -// Insert deoptimization, returns true if sucessful or false if range check should not be removed +// Insert deoptimization 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) { assert(is_ok_for_deoptimization(insert_position, array_instr, length_instr, lower_instr, lower, upper_instr, upper), "should have been tested before"); bool upper_check = !(upper_instr && upper_instr->as_ArrayLength() && upper_instr->as_ArrayLength()->array() == array_instr); @@ -669,6 +669,9 @@ } } + // No upper check required -> skip + if (!upper_check) return; + // We need to know length of array if (!length_instr) { // Load length if necessary @@ -680,9 +683,6 @@ length_instr = length; } - // No upper check required -> skip - if (!upper_check) return; - if (!upper_instr) { // Compare for geq array.length insert_position = predicate_cmp_with_const(length_instr, Instruction::leq, upper, state, insert_position, bci); @@ -777,7 +777,7 @@ tty->fill_to(block->dominator_depth()*2) ); TRACE_RANGE_CHECK_ELIMINATION( - tty->print_cr("Access indexed: index=%d length=%d", ai->index()->id(), ai->length()->id()) + tty->print_cr("Access indexed: index=%d length=%d", ai->index()->id(), (ai->length() != NULL ? ai->length()->id() :-1 )) ); if (ai->check_flag(Instruction::NeedsRangeCheckFlag)) {