3744 if (tmp == noreg) push(rax);
3745 else if (tmp != rax) mov(tmp, rax);
3746 }
3747
3748 // Write serialization page so VM thread can do a pseudo remote membar.
3749 // We use the current thread pointer to calculate a thread specific
3750 // offset to write to within the page. This minimizes bus traffic
3751 // due to cache line collision.
3752 void MacroAssembler::serialize_memory(Register thread, Register tmp) {
3753 movl(tmp, thread);
3754 shrl(tmp, os::get_serialize_page_shift_count());
3755 andl(tmp, (os::vm_page_size() - sizeof(int)));
3756
3757 Address index(noreg, tmp, Address::times_1);
3758 ExternalAddress page(os::get_memory_serialize_page());
3759
3760 // Size of store must match masking code above
3761 movl(as_Address(ArrayAddress(page, index)), tmp);
3762 }
3763
3764 #ifdef _LP64
3765 void MacroAssembler::safepoint_poll(Label& slow_path, Register thread_reg, Register temp_reg) {
3766 if (SafepointMechanism::uses_thread_local_poll()) {
3767 testb(Address(r15_thread, Thread::polling_page_offset()), SafepointMechanism::poll_bit());
3768 jcc(Assembler::notZero, slow_path); // handshake bit set implies poll
3769 } else {
3770 cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
3771 SafepointSynchronize::_not_synchronized);
3772 jcc(Assembler::notEqual, slow_path);
3773 }
3774 }
3775 #else
3776 void MacroAssembler::safepoint_poll(Label& slow_path) {
3777 cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
3778 SafepointSynchronize::_not_synchronized);
3779 jcc(Assembler::notEqual, slow_path);
3780 }
3781 #endif
3782
3783 // Calls to C land
3784 //
3785 // When entering C land, the rbp, & rsp of the last Java frame have to be recorded
3786 // in the (thread-local) JavaThread object. When leaving C land, the last Java fp
3787 // has to be reset to 0. This is required to allow proper stack traversal.
3788 void MacroAssembler::set_last_Java_frame(Register java_thread,
3789 Register last_java_sp,
3790 Register last_java_fp,
3791 address last_java_pc) {
3792 vzeroupper();
3793 // determine java_thread register
3794 if (!java_thread->is_valid()) {
3795 java_thread = rdi;
3796 get_thread(java_thread);
3797 }
3798 // determine last_java_sp register
3799 if (!last_java_sp->is_valid()) {
3800 last_java_sp = rsp;
3801 }
|
3744 if (tmp == noreg) push(rax);
3745 else if (tmp != rax) mov(tmp, rax);
3746 }
3747
3748 // Write serialization page so VM thread can do a pseudo remote membar.
3749 // We use the current thread pointer to calculate a thread specific
3750 // offset to write to within the page. This minimizes bus traffic
3751 // due to cache line collision.
3752 void MacroAssembler::serialize_memory(Register thread, Register tmp) {
3753 movl(tmp, thread);
3754 shrl(tmp, os::get_serialize_page_shift_count());
3755 andl(tmp, (os::vm_page_size() - sizeof(int)));
3756
3757 Address index(noreg, tmp, Address::times_1);
3758 ExternalAddress page(os::get_memory_serialize_page());
3759
3760 // Size of store must match masking code above
3761 movl(as_Address(ArrayAddress(page, index)), tmp);
3762 }
3763
3764 void MacroAssembler::safepoint_poll(Label& slow_path, Register thread_reg, Register temp_reg) {
3765 if (SafepointMechanism::uses_thread_local_poll()) {
3766 #ifndef AMD64
3767 if (thread_reg == noreg) {
3768 thread_reg = temp_reg;
3769 get_thread(thread_reg);
3770 }
3771 #endif
3772 testb(Address(thread_reg, Thread::polling_page_offset()), SafepointMechanism::poll_bit());
3773 jcc(Assembler::notZero, slow_path); // handshake bit set implies poll
3774 } else {
3775 cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
3776 SafepointSynchronize::_not_synchronized);
3777 jcc(Assembler::notEqual, slow_path);
3778 }
3779 }
3780
3781 // Calls to C land
3782 //
3783 // When entering C land, the rbp, & rsp of the last Java frame have to be recorded
3784 // in the (thread-local) JavaThread object. When leaving C land, the last Java fp
3785 // has to be reset to 0. This is required to allow proper stack traversal.
3786 void MacroAssembler::set_last_Java_frame(Register java_thread,
3787 Register last_java_sp,
3788 Register last_java_fp,
3789 address last_java_pc) {
3790 vzeroupper();
3791 // determine java_thread register
3792 if (!java_thread->is_valid()) {
3793 java_thread = rdi;
3794 get_thread(java_thread);
3795 }
3796 // determine last_java_sp register
3797 if (!last_java_sp->is_valid()) {
3798 last_java_sp = rsp;
3799 }
|