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,10 +55,12 @@
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,10 +181,15 @@
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,18 +378,20 @@
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,18 +400,24 @@
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,10 +856,29 @@
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(')');
}