Mercurial > hg > truffle
comparison src/share/vm/c1/c1_InstructionPrinter.cpp @ 8860:46f6f063b272
7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by: never, kvn, twisti
Contributed-by: thomaswue <thomas.wuerthinger@oracle.com>
author | roland |
---|---|
date | Thu, 21 Mar 2013 09:27:54 +0100 |
parents | 203f64878aab |
children | acadb114c818 |
comparison
equal
deleted
inserted
replaced
8780:98f3af397705 | 8860:46f6f063b272 |
---|---|
55 case If::neq: return "!="; | 55 case If::neq: return "!="; |
56 case If::lss: return "<"; | 56 case If::lss: return "<"; |
57 case If::leq: return "<="; | 57 case If::leq: return "<="; |
58 case If::gtr: return ">"; | 58 case If::gtr: return ">"; |
59 case If::geq: return ">="; | 59 case If::geq: return ">="; |
60 case If::aeq: return "|>=|"; | |
61 case If::beq: return "|<=|"; | |
60 } | 62 } |
61 ShouldNotReachHere(); | 63 ShouldNotReachHere(); |
62 return NULL; | 64 return NULL; |
63 } | 65 } |
64 | 66 |
179 void InstructionPrinter::print_indexed(AccessIndexed* indexed) { | 181 void InstructionPrinter::print_indexed(AccessIndexed* indexed) { |
180 print_value(indexed->array()); | 182 print_value(indexed->array()); |
181 output()->put('['); | 183 output()->put('['); |
182 print_value(indexed->index()); | 184 print_value(indexed->index()); |
183 output()->put(']'); | 185 output()->put(']'); |
186 if (indexed->length() != NULL) { | |
187 output()->put('('); | |
188 print_value(indexed->length()); | |
189 output()->put(')'); | |
190 } | |
184 } | 191 } |
185 | 192 |
186 | 193 |
187 void InstructionPrinter::print_monitor(AccessMonitor* monitor) { | 194 void InstructionPrinter::print_monitor(AccessMonitor* monitor) { |
188 output()->print("monitor[%d](", monitor->monitor_no()); | 195 output()->print("monitor[%d](", monitor->monitor_no()); |
371 | 378 |
372 | 379 |
373 void InstructionPrinter::do_LoadField(LoadField* x) { | 380 void InstructionPrinter::do_LoadField(LoadField* x) { |
374 print_field(x); | 381 print_field(x); |
375 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); | 382 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); |
383 output()->print(" %s", x->field()->name()->as_utf8()); | |
376 } | 384 } |
377 | 385 |
378 | 386 |
379 void InstructionPrinter::do_StoreField(StoreField* x) { | 387 void InstructionPrinter::do_StoreField(StoreField* x) { |
380 print_field(x); | 388 print_field(x); |
381 output()->print(" := "); | 389 output()->print(" := "); |
382 print_value(x->value()); | 390 print_value(x->value()); |
383 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); | 391 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); |
392 output()->print(" %s", x->field()->name()->as_utf8()); | |
384 } | 393 } |
385 | 394 |
386 | 395 |
387 void InstructionPrinter::do_ArrayLength(ArrayLength* x) { | 396 void InstructionPrinter::do_ArrayLength(ArrayLength* x) { |
388 print_value(x->array()); | 397 print_value(x->array()); |
391 | 400 |
392 | 401 |
393 void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) { | 402 void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) { |
394 print_indexed(x); | 403 print_indexed(x); |
395 output()->print(" (%c)", type2char(x->elt_type())); | 404 output()->print(" (%c)", type2char(x->elt_type())); |
405 if (x->check_flag(Instruction::NeedsRangeCheckFlag)) { | |
406 output()->print(" [rc]"); | |
407 } | |
396 } | 408 } |
397 | 409 |
398 | 410 |
399 void InstructionPrinter::do_StoreIndexed(StoreIndexed* x) { | 411 void InstructionPrinter::do_StoreIndexed(StoreIndexed* x) { |
400 print_indexed(x); | 412 print_indexed(x); |
401 output()->print(" := "); | 413 output()->print(" := "); |
402 print_value(x->value()); | 414 print_value(x->value()); |
403 output()->print(" (%c)", type2char(x->elt_type())); | 415 output()->print(" (%c)", type2char(x->elt_type())); |
416 if (x->check_flag(Instruction::NeedsRangeCheckFlag)) { | |
417 output()->print(" [rc]"); | |
418 } | |
404 } | 419 } |
405 | 420 |
406 void InstructionPrinter::do_NegateOp(NegateOp* x) { | 421 void InstructionPrinter::do_NegateOp(NegateOp* x) { |
407 output()->put('-'); | 422 output()->put('-'); |
408 print_value(x->x()); | 423 print_value(x->x()); |
841 void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) { | 856 void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) { |
842 print_unsafe_object_op(x, "UnsafePrefetchRead"); | 857 print_unsafe_object_op(x, "UnsafePrefetchRead"); |
843 output()->put(')'); | 858 output()->put(')'); |
844 } | 859 } |
845 | 860 |
861 void InstructionPrinter::do_RangeCheckPredicate(RangeCheckPredicate* x) { | |
862 | |
863 if (x->x() != NULL && x->y() != NULL) { | |
864 output()->print("if "); | |
865 print_value(x->x()); | |
866 output()->print(" %s ", cond_name(x->cond())); | |
867 print_value(x->y()); | |
868 output()->print(" then deoptimize!"); | |
869 } else { | |
870 output()->print("always deoptimize!"); | |
871 } | |
872 } | |
873 | |
874 void InstructionPrinter::do_Assert(Assert* x) { | |
875 output()->print("assert "); | |
876 print_value(x->x()); | |
877 output()->print(" %s ", cond_name(x->cond())); | |
878 print_value(x->y()); | |
879 } | |
846 | 880 |
847 void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { | 881 void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { |
848 print_unsafe_object_op(x, "UnsafePrefetchWrite"); | 882 print_unsafe_object_op(x, "UnsafePrefetchWrite"); |
849 output()->put(')'); | 883 output()->put(')'); |
850 } | 884 } |