src/share/vm/c1/c1_InstructionPrinter.cpp

Print this page
rev 4136 : 7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by:

*** 55,64 **** --- 55,66 ---- case If::neq: return "!="; case If::lss: return "<"; case If::leq: return "<="; case If::gtr: return ">"; case If::geq: return ">="; + case If::aeq: return "aeq"; + case If::beq: return "beq"; } ShouldNotReachHere(); return NULL; }
*** 179,188 **** --- 181,195 ---- void InstructionPrinter::print_indexed(AccessIndexed* indexed) { print_value(indexed->array()); output()->put('['); print_value(indexed->index()); output()->put(']'); + if (indexed->length() != NULL) { + output()->put('('); + print_value(indexed->length()); + output()->put(')'); + } } void InstructionPrinter::print_monitor(AccessMonitor* monitor) { output()->print("monitor[%d](", monitor->monitor_no());
*** 371,388 **** --- 378,397 ---- void InstructionPrinter::do_LoadField(LoadField* x) { print_field(x); output()->print(" (%c)", type2char(x->field()->type()->basic_type())); + output()->print(" %s", x->field()->name()->as_utf8()); } void InstructionPrinter::do_StoreField(StoreField* x) { print_field(x); output()->print(" := "); print_value(x->value()); output()->print(" (%c)", type2char(x->field()->type()->basic_type())); + output()->print(" %s", x->field()->name()->as_utf8()); } void InstructionPrinter::do_ArrayLength(ArrayLength* x) { print_value(x->array());
*** 391,408 **** --- 400,423 ---- void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) { print_indexed(x); output()->print(" (%c)", type2char(x->elt_type())); + if (x->check_flag(Instruction::NeedsRangeCheckFlag)) { + output()->print(" [rc]"); + } } void InstructionPrinter::do_StoreIndexed(StoreIndexed* x) { print_indexed(x); output()->print(" := "); print_value(x->value()); output()->print(" (%c)", type2char(x->elt_type())); + if (x->check_flag(Instruction::NeedsRangeCheckFlag)) { + output()->print(" [rc]"); + } } void InstructionPrinter::do_NegateOp(NegateOp* x) { output()->put('-'); print_value(x->x());
*** 841,850 **** --- 856,884 ---- void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) { print_unsafe_object_op(x, "UnsafePrefetchRead"); output()->put(')'); } + void InstructionPrinter::do_RangeCheckPredicate(RangeCheckPredicate* x) { + + if (x->x() != NULL && x->y() != NULL) { + output()->print("if "); + print_value(x->x()); + output()->print(" %s ", cond_name(x->cond())); + print_value(x->y()); + output()->print(" then deoptimize!"); + } else { + output()->print("always deoptimize!"); + } + } + + void InstructionPrinter::do_Assert(Assert* x) { + output()->print("assert "); + print_value(x->x()); + output()->print(" %s ", cond_name(x->cond())); + print_value(x->y()); + } void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { print_unsafe_object_op(x, "UnsafePrefetchWrite"); output()->put(')'); }