524 |
524 |
525 bool result_is_oop = result->is_valid() ? result->is_oop() : false; |
525 bool result_is_oop = result->is_valid() ? result->is_oop() : false; |
526 |
526 |
527 // Note: we do not need to round double result; float result has the right precision |
527 // Note: we do not need to round double result; float result has the right precision |
528 // the poll sets the condition code, but no data registers |
528 // the poll sets the condition code, but no data registers |
529 AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type); |
529 |
530 |
530 if (SafepointMechanism::uses_thread_local_poll()) { |
531 if (Assembler::is_polling_page_far()) { |
531 #ifdef _LP64 |
532 __ lea(rscratch1, polling_page); |
532 __ movptr(rscratch1, Address(r15_thread, Thread::polling_page_offset())); |
533 __ relocate(relocInfo::poll_return_type); |
533 __ relocate(relocInfo::poll_return_type); |
534 __ testl(rax, Address(rscratch1, 0)); |
534 __ testl(rax, Address(rscratch1, 0)); |
|
535 #else |
|
536 ShouldNotReachHere(); |
|
537 #endif |
535 } else { |
538 } else { |
536 __ testl(rax, polling_page); |
539 AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type); |
|
540 |
|
541 if (Assembler::is_polling_page_far()) { |
|
542 __ lea(rscratch1, polling_page); |
|
543 __ relocate(relocInfo::poll_return_type); |
|
544 __ testl(rax, Address(rscratch1, 0)); |
|
545 } else { |
|
546 __ testl(rax, polling_page); |
|
547 } |
537 } |
548 } |
538 __ ret(0); |
549 __ ret(0); |
539 } |
550 } |
540 |
551 |
541 |
552 |
542 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) { |
553 int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) { |
543 AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type); |
|
544 guarantee(info != NULL, "Shouldn't be NULL"); |
554 guarantee(info != NULL, "Shouldn't be NULL"); |
545 int offset = __ offset(); |
555 int offset = __ offset(); |
546 if (Assembler::is_polling_page_far()) { |
556 if (SafepointMechanism::uses_thread_local_poll()) { |
547 __ lea(rscratch1, polling_page); |
557 #ifdef _LP64 |
548 offset = __ offset(); |
558 __ movptr(rscratch1, Address(r15_thread, Thread::polling_page_offset())); |
549 add_debug_info_for_branch(info); |
559 add_debug_info_for_branch(info); |
550 __ relocate(relocInfo::poll_type); |
560 __ relocate(relocInfo::poll_type); |
|
561 address pre_pc = __ pc(); |
551 __ testl(rax, Address(rscratch1, 0)); |
562 __ testl(rax, Address(rscratch1, 0)); |
|
563 address post_pc = __ pc(); |
|
564 guarantee(pointer_delta(post_pc, pre_pc, 1) == 3, "must be exact length"); |
|
565 #else |
|
566 ShouldNotReachHere(); |
|
567 #endif |
552 } else { |
568 } else { |
553 add_debug_info_for_branch(info); |
569 AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_type); |
554 __ testl(rax, polling_page); |
570 if (Assembler::is_polling_page_far()) { |
|
571 __ lea(rscratch1, polling_page); |
|
572 offset = __ offset(); |
|
573 add_debug_info_for_branch(info); |
|
574 __ relocate(relocInfo::poll_type); |
|
575 __ testl(rax, Address(rscratch1, 0)); |
|
576 } else { |
|
577 add_debug_info_for_branch(info); |
|
578 __ testl(rax, polling_page); |
|
579 } |
555 } |
580 } |
556 return offset; |
581 return offset; |
557 } |
582 } |
558 |
583 |
559 |
584 |