From ff28df50d386f89f1fb0ef0fa5edb8b2713fd083 Mon Sep 17 00:00:00 2001 From: roland Date: Fri, 29 Mar 2013 17:25:27 +0100 Subject: [PATCH] 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 --- src/share/vm/c1/c1_LIRGenerator.cpp | 2 -- src/share/vm/c1/c1_RangeCheckElimination.cpp | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp index a3970cb3f..84402a9ef 100644 --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -1872,8 +1872,6 @@ void LIRGenerator::do_NIOCheckIndex(Intrinsic* x) { 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 --git a/src/share/vm/c1/c1_RangeCheckElimination.cpp b/src/share/vm/c1/c1_RangeCheckElimination.cpp index 948f635c2..40c448a39 100644 --- a/src/share/vm/c1/c1_RangeCheckElimination.cpp +++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp @@ -645,7 +645,7 @@ Instruction* RangeCheckEliminator::predicate_add_cmp_with_const(Instruction* lef 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 @@ void RangeCheckEliminator::insert_deoptimization(ValueStack *state, Instruction } } + // 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 @@ void RangeCheckEliminator::insert_deoptimization(ValueStack *state, Instruction 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 @@ void RangeCheckEliminator::process_access_indexed(BlockBegin *loop_header, Block 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)) { -- GitLab