Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 1d7922586cf6 |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
503 __ movptr (rbx, rcx); // receiver is in rcx | 503 __ movptr (rbx, rcx); // receiver is in rcx |
504 __ movptr (rax, arg1->as_register()); | 504 __ movptr (rax, arg1->as_register()); |
505 | 505 |
506 // Get addresses of first characters from both Strings | 506 // Get addresses of first characters from both Strings |
507 __ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes())); | 507 __ load_heap_oop(rsi, Address(rax, java_lang_String::value_offset_in_bytes())); |
508 __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); | 508 if (java_lang_String::has_offset_field()) { |
509 __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); | 509 __ movptr (rcx, Address(rax, java_lang_String::offset_offset_in_bytes())); |
510 | 510 __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); |
511 __ lea (rsi, Address(rsi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); | |
512 } else { | |
513 __ movl (rax, Address(rsi, arrayOopDesc::length_offset_in_bytes())); | |
514 __ lea (rsi, Address(rsi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); | |
515 } | |
511 | 516 |
512 // rbx, may be NULL | 517 // rbx, may be NULL |
513 add_debug_info_for_null_check_here(info); | 518 add_debug_info_for_null_check_here(info); |
514 __ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes())); | 519 __ load_heap_oop(rdi, Address(rbx, java_lang_String::value_offset_in_bytes())); |
515 __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); | 520 if (java_lang_String::has_offset_field()) { |
516 __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); | 521 __ movptr (rcx, Address(rbx, java_lang_String::offset_offset_in_bytes())); |
522 __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); | |
523 __ lea (rdi, Address(rdi, rcx, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR))); | |
524 } else { | |
525 __ movl (rbx, Address(rdi, arrayOopDesc::length_offset_in_bytes())); | |
526 __ lea (rdi, Address(rdi, arrayOopDesc::base_offset_in_bytes(T_CHAR))); | |
527 } | |
517 | 528 |
518 // compute minimum length (in rax) and difference of lengths (on top of stack) | 529 // compute minimum length (in rax) and difference of lengths (on top of stack) |
519 __ movl (rbx, Address(rbx, java_lang_String::count_offset_in_bytes())); | |
520 __ movl (rax, Address(rax, java_lang_String::count_offset_in_bytes())); | |
521 __ mov (rcx, rbx); | 530 __ mov (rcx, rbx); |
522 __ subptr(rbx, rax); // subtract lengths | 531 __ subptr(rbx, rax); // subtract lengths |
523 __ push (rbx); // result | 532 __ push (rbx); // result |
524 __ cmov (Assembler::lessEqual, rax, rcx); | 533 __ cmov (Assembler::lessEqual, rax, rcx); |
525 | 534 |
1460 __ sarl(dest->as_register_hi(), 31); | 1469 __ sarl(dest->as_register_hi(), 31); |
1461 #endif // LP64 | 1470 #endif // LP64 |
1462 break; | 1471 break; |
1463 | 1472 |
1464 case Bytecodes::_l2i: | 1473 case Bytecodes::_l2i: |
1474 #ifdef _LP64 | |
1475 __ movl(dest->as_register(), src->as_register_lo()); | |
1476 #else | |
1465 move_regs(src->as_register_lo(), dest->as_register()); | 1477 move_regs(src->as_register_lo(), dest->as_register()); |
1478 #endif | |
1466 break; | 1479 break; |
1467 | 1480 |
1468 case Bytecodes::_i2b: | 1481 case Bytecodes::_i2b: |
1469 move_regs(src->as_register(), dest->as_register()); | 1482 move_regs(src->as_register(), dest->as_register()); |
1470 __ sign_extend_byte(dest->as_register()); | 1483 __ sign_extend_byte(dest->as_register()); |
2431 break; | 2444 break; |
2432 case lir_tan : | 2445 case lir_tan : |
2433 // Should consider not saving rbx, if not necessary | 2446 // Should consider not saving rbx, if not necessary |
2434 __ trigfunc('t', op->as_Op2()->fpu_stack_size()); | 2447 __ trigfunc('t', op->as_Op2()->fpu_stack_size()); |
2435 break; | 2448 break; |
2449 case lir_exp : | |
2450 __ exp_with_fallback(op->as_Op2()->fpu_stack_size()); | |
2451 break; | |
2452 case lir_pow : | |
2453 __ pow_with_fallback(op->as_Op2()->fpu_stack_size()); | |
2454 break; | |
2436 default : ShouldNotReachHere(); | 2455 default : ShouldNotReachHere(); |
2437 } | 2456 } |
2438 } else { | 2457 } else { |
2439 Unimplemented(); | 2458 Unimplemented(); |
2440 } | 2459 } |
2652 #else | 2671 #else |
2653 __ cmpoop(reg1, c->as_jobject()); | 2672 __ cmpoop(reg1, c->as_jobject()); |
2654 #endif // _LP64 | 2673 #endif // _LP64 |
2655 } | 2674 } |
2656 } else { | 2675 } else { |
2657 ShouldNotReachHere(); | 2676 fatal(err_msg("unexpected type: %s", basictype_to_str(c->type()))); |
2658 } | 2677 } |
2659 // cpu register - address | 2678 // cpu register - address |
2660 } else if (opr2->is_address()) { | 2679 } else if (opr2->is_address()) { |
2661 if (op->info() != NULL) { | 2680 if (op->info() != NULL) { |
2662 add_debug_info_for_null_check_here(op->info()); | 2681 add_debug_info_for_null_check_here(op->info()); |
3487 | 3506 |
3488 | 3507 |
3489 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) { | 3508 void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) { |
3490 ciMethod* method = op->profiled_method(); | 3509 ciMethod* method = op->profiled_method(); |
3491 int bci = op->profiled_bci(); | 3510 int bci = op->profiled_bci(); |
3511 ciMethod* callee = op->profiled_callee(); | |
3492 | 3512 |
3493 // Update counter for all call types | 3513 // Update counter for all call types |
3494 ciMethodData* md = method->method_data_or_null(); | 3514 ciMethodData* md = method->method_data_or_null(); |
3495 assert(md != NULL, "Sanity"); | 3515 assert(md != NULL, "Sanity"); |
3496 ciProfileData* data = md->bci_to_data(bci); | 3516 ciProfileData* data = md->bci_to_data(bci); |
3498 assert(op->mdo()->is_single_cpu(), "mdo must be allocated"); | 3518 assert(op->mdo()->is_single_cpu(), "mdo must be allocated"); |
3499 Register mdo = op->mdo()->as_register(); | 3519 Register mdo = op->mdo()->as_register(); |
3500 __ movoop(mdo, md->constant_encoding()); | 3520 __ movoop(mdo, md->constant_encoding()); |
3501 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset())); | 3521 Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset())); |
3502 Bytecodes::Code bc = method->java_code_at_bci(bci); | 3522 Bytecodes::Code bc = method->java_code_at_bci(bci); |
3523 const bool callee_is_static = callee->is_loaded() && callee->is_static(); | |
3503 // Perform additional virtual call profiling for invokevirtual and | 3524 // Perform additional virtual call profiling for invokevirtual and |
3504 // invokeinterface bytecodes | 3525 // invokeinterface bytecodes |
3505 if ((bc == Bytecodes::_invokevirtual || bc == Bytecodes::_invokeinterface) && | 3526 if ((bc == Bytecodes::_invokevirtual || bc == Bytecodes::_invokeinterface) && |
3527 !callee_is_static && // required for optimized MH invokes | |
3506 C1ProfileVirtualCalls) { | 3528 C1ProfileVirtualCalls) { |
3507 assert(op->recv()->is_single_cpu(), "recv must be allocated"); | 3529 assert(op->recv()->is_single_cpu(), "recv must be allocated"); |
3508 Register recv = op->recv()->as_register(); | 3530 Register recv = op->recv()->as_register(); |
3509 assert_different_registers(mdo, recv); | 3531 assert_different_registers(mdo, recv); |
3510 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls"); | 3532 assert(data->is_VirtualCallData(), "need VirtualCallData for virtual calls"); |