comparison src/cpu/sparc/vm/c1_LIRAssembler_sparc.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 d804e148cff8
children 46c544b8fbfc
comparison
equal deleted inserted replaced
8780:98f3af397705 8860:46f6f063b272
3359 void LIR_Assembler::get_thread(LIR_Opr result_reg) { 3359 void LIR_Assembler::get_thread(LIR_Opr result_reg) {
3360 assert(result_reg->is_register(), "check"); 3360 assert(result_reg->is_register(), "check");
3361 __ mov(G2_thread, result_reg->as_register()); 3361 __ mov(G2_thread, result_reg->as_register());
3362 } 3362 }
3363 3363
3364 #ifdef ASSERT
3365 // emit run-time assertion
3366 void LIR_Assembler::emit_assert(LIR_OpAssert* op) {
3367 assert(op->code() == lir_assert, "must be");
3368
3369 if (op->in_opr1()->is_valid()) {
3370 assert(op->in_opr2()->is_valid(), "both operands must be valid");
3371 comp_op(op->condition(), op->in_opr1(), op->in_opr2(), op);
3372 } else {
3373 assert(op->in_opr2()->is_illegal(), "both operands must be illegal");
3374 assert(op->condition() == lir_cond_always, "no other conditions allowed");
3375 }
3376
3377 Label ok;
3378 if (op->condition() != lir_cond_always) {
3379 Assembler::Condition acond;
3380 switch (op->condition()) {
3381 case lir_cond_equal: acond = Assembler::equal; break;
3382 case lir_cond_notEqual: acond = Assembler::notEqual; break;
3383 case lir_cond_less: acond = Assembler::less; break;
3384 case lir_cond_lessEqual: acond = Assembler::lessEqual; break;
3385 case lir_cond_greaterEqual: acond = Assembler::greaterEqual; break;
3386 case lir_cond_greater: acond = Assembler::greater; break;
3387 case lir_cond_aboveEqual: acond = Assembler::greaterEqualUnsigned; break;
3388 case lir_cond_belowEqual: acond = Assembler::lessEqualUnsigned; break;
3389 default: ShouldNotReachHere();
3390 };
3391 __ br(acond, false, Assembler::pt, ok);
3392 __ delayed()->nop();
3393 }
3394 if (op->halt()) {
3395 const char* str = __ code_string(op->msg());
3396 __ stop(str);
3397 } else {
3398 breakpoint();
3399 }
3400 __ bind(ok);
3401 }
3402 #endif
3364 3403
3365 void LIR_Assembler::peephole(LIR_List* lir) { 3404 void LIR_Assembler::peephole(LIR_List* lir) {
3366 LIR_OpList* inst = lir->instructions_list(); 3405 LIR_OpList* inst = lir->instructions_list();
3367 for (int i = 0; i < inst->length(); i++) { 3406 for (int i = 0; i < inst->length(); i++) {
3368 LIR_Op* op = inst->at(i); 3407 LIR_Op* op = inst->at(i);