# HG changeset patch # User roland # Date 1364574327 -3600 # Node ID d595e8ddadd9e01c098c8a18597c452cdad39cfb # Parent 30f42e691e70cac2547f880b23b85cd7c5b6324b 8010934: assert failure in c1_LinearScan.cpp: "asumption: non-Constant instructions have only virtual operands" Summary: incorrect code to skip some ArrayLength instructions in LIRGenerator Reviewed-by: kvn diff -r 30f42e691e70 -r d595e8ddadd9 src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp Tue Mar 26 12:55:26 2013 -0700 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Fri Mar 29 17:25:27 2013 +0100 @@ -1872,8 +1872,6 @@ void LIRGenerator::do_ArrayLength(ArrayLength* x) { - if (x->use_count() == 0 && !x->can_trap()) return; - LIRItem array(x->array(), this); array.load_item(); LIR_Opr reg = rlock_result(x); 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)) {