提交 ff28df50 编写于 作者: R roland

8010934: assert failure in c1_LinearScan.cpp: "asumption: non-Constant...

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
上级 a6714dcd
...@@ -1872,8 +1872,6 @@ void LIRGenerator::do_NIOCheckIndex(Intrinsic* x) { ...@@ -1872,8 +1872,6 @@ void LIRGenerator::do_NIOCheckIndex(Intrinsic* x) {
void LIRGenerator::do_ArrayLength(ArrayLength* x) { void LIRGenerator::do_ArrayLength(ArrayLength* x) {
if (x->use_count() == 0 && !x->can_trap()) return;
LIRItem array(x->array(), this); LIRItem array(x->array(), this);
array.load_item(); array.load_item();
LIR_Opr reg = rlock_result(x); LIR_Opr reg = rlock_result(x);
......
...@@ -645,7 +645,7 @@ Instruction* RangeCheckEliminator::predicate_add_cmp_with_const(Instruction* lef ...@@ -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); 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) { 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"); 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); 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 ...@@ -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 // We need to know length of array
if (!length_instr) { if (!length_instr) {
// Load length if necessary // Load length if necessary
...@@ -680,9 +683,6 @@ void RangeCheckEliminator::insert_deoptimization(ValueStack *state, Instruction ...@@ -680,9 +683,6 @@ void RangeCheckEliminator::insert_deoptimization(ValueStack *state, Instruction
length_instr = length; length_instr = length;
} }
// No upper check required -> skip
if (!upper_check) return;
if (!upper_instr) { if (!upper_instr) {
// Compare for geq array.length // Compare for geq array.length
insert_position = predicate_cmp_with_const(length_instr, Instruction::leq, upper, state, insert_position, bci); 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 ...@@ -777,7 +777,7 @@ void RangeCheckEliminator::process_access_indexed(BlockBegin *loop_header, Block
tty->fill_to(block->dominator_depth()*2) tty->fill_to(block->dominator_depth()*2)
); );
TRACE_RANGE_CHECK_ELIMINATION( 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)) { if (ai->check_flag(Instruction::NeedsRangeCheckFlag)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册