Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @ 2404:b40d4fa697bf
6964776: c2 should ensure the polling page is reachable on 64 bit
Summary: Materialize the pointer to the polling page in a register instead of using rip-relative addressing when the distance from the code cache is larger than disp32.
Reviewed-by: never, kvn
author | iveresov |
---|---|
date | Sun, 27 Mar 2011 13:17:37 -0700 |
parents | 1b4e6a5d98e0 |
children | 09f96c3ff1ad |
comparison
equal
deleted
inserted
replaced
2403:1927db75dd85 | 2404:b40d4fa697bf |
---|---|
646 // Note: we do not need to round double result; float result has the right precision | 646 // Note: we do not need to round double result; float result has the right precision |
647 // the poll sets the condition code, but no data registers | 647 // the poll sets the condition code, but no data registers |
648 AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), | 648 AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), |
649 relocInfo::poll_return_type); | 649 relocInfo::poll_return_type); |
650 | 650 |
651 // NOTE: the requires that the polling page be reachable else the reloc | 651 if (Assembler::is_polling_page_far()) { |
652 // goes to the movq that loads the address and not the faulting instruction | 652 __ lea(rscratch1, polling_page); |
653 // which breaks the signal handler code | 653 __ relocate(relocInfo::poll_return_type); |
654 | 654 __ testl(rax, Address(rscratch1, 0)); |
655 __ test32(rax, polling_page); | 655 } else { |
656 | 656 __ testl(rax, polling_page); |
657 } | |
657 __ ret(0); | 658 __ ret(0); |
658 } | 659 } |
659 | 660 |
660 | 661 |
661 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) { | 662 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) { |
662 AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), | 663 AddressLiteral polling_page(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()), |
663 relocInfo::poll_type); | 664 relocInfo::poll_type); |
664 | 665 guarantee(info != NULL, "Shouldn't be NULL"); |
665 if (info != NULL) { | 666 int offset = __ offset(); |
667 if (Assembler::is_polling_page_far()) { | |
668 __ lea(rscratch1, polling_page); | |
669 offset = __ offset(); | |
666 add_debug_info_for_branch(info); | 670 add_debug_info_for_branch(info); |
671 __ testl(rax, Address(rscratch1, 0)); | |
667 } else { | 672 } else { |
668 ShouldNotReachHere(); | 673 add_debug_info_for_branch(info); |
669 } | 674 __ testl(rax, polling_page); |
670 | 675 } |
671 int offset = __ offset(); | |
672 | |
673 // NOTE: the requires that the polling page be reachable else the reloc | |
674 // goes to the movq that loads the address and not the faulting instruction | |
675 // which breaks the signal handler code | |
676 | |
677 __ test32(rax, polling_page); | |
678 return offset; | 676 return offset; |
679 } | 677 } |
680 | 678 |
681 | 679 |
682 void LIR_Assembler::move_regs(Register from_reg, Register to_reg) { | 680 void LIR_Assembler::move_regs(Register from_reg, Register to_reg) { |