1640 __ add(c_rarg0, Rthread, in_bytes(JavaThread::jni_environment_offset()));
1641
1642 // Perform thread state transition
1643 __ mov(Rtemp, _thread_in_native);
1644 #ifdef AARCH64
1645 // stlr instruction is used to force all preceding writes to be observed prior to thread state change
1646 __ add(Rtemp2, Rthread, in_bytes(JavaThread::thread_state_offset()));
1647 __ stlr_w(Rtemp, Rtemp2);
1648 #else
1649 __ str(Rtemp, Address(Rthread, JavaThread::thread_state_offset()));
1650 #endif // AARCH64
1651
1652 // Finally, call the native method
1653 __ call(method->native_function());
1654
1655 // Set FPSCR/FPCR to a known state
1656 if (AlwaysRestoreFPU) {
1657 __ restore_default_fp_mode();
1658 }
1659
1660 // Do a safepoint check while thread is in transition state
1661 InlinedAddress safepoint_state(SafepointSynchronize::address_of_state());
1662 Label call_safepoint_runtime, return_to_java;
1663 __ mov(Rtemp, _thread_in_native_trans);
1664 __ ldr_literal(R2, safepoint_state);
1665 __ str_32(Rtemp, Address(Rthread, JavaThread::thread_state_offset()));
1666
1667 // make sure the store is observed before reading the SafepointSynchronize state and further mem refs
1668 __ membar(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreLoad | MacroAssembler::StoreStore), Rtemp);
1669
1670 __ ldr_s32(R2, Address(R2));
1671 __ ldr_u32(R3, Address(Rthread, JavaThread::suspend_flags_offset()));
1672 __ cmp(R2, SafepointSynchronize::_not_synchronized);
1673 __ cond_cmp(R3, 0, eq);
1674 __ b(call_safepoint_runtime, ne);
1675 __ bind(return_to_java);
1676
1677 // Perform thread state transition and reguard stack yellow pages if needed
1678 Label reguard, reguard_done;
1679 __ mov(Rtemp, _thread_in_Java);
|
1640 __ add(c_rarg0, Rthread, in_bytes(JavaThread::jni_environment_offset()));
1641
1642 // Perform thread state transition
1643 __ mov(Rtemp, _thread_in_native);
1644 #ifdef AARCH64
1645 // stlr instruction is used to force all preceding writes to be observed prior to thread state change
1646 __ add(Rtemp2, Rthread, in_bytes(JavaThread::thread_state_offset()));
1647 __ stlr_w(Rtemp, Rtemp2);
1648 #else
1649 __ str(Rtemp, Address(Rthread, JavaThread::thread_state_offset()));
1650 #endif // AARCH64
1651
1652 // Finally, call the native method
1653 __ call(method->native_function());
1654
1655 // Set FPSCR/FPCR to a known state
1656 if (AlwaysRestoreFPU) {
1657 __ restore_default_fp_mode();
1658 }
1659
1660 // Ensure a Boolean result is mapped to 0..1
1661 if (ret_type == T_BOOLEAN) {
1662 __ c2bool(R0);
1663 }
1664
1665 // Do a safepoint check while thread is in transition state
1666 InlinedAddress safepoint_state(SafepointSynchronize::address_of_state());
1667 Label call_safepoint_runtime, return_to_java;
1668 __ mov(Rtemp, _thread_in_native_trans);
1669 __ ldr_literal(R2, safepoint_state);
1670 __ str_32(Rtemp, Address(Rthread, JavaThread::thread_state_offset()));
1671
1672 // make sure the store is observed before reading the SafepointSynchronize state and further mem refs
1673 __ membar(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreLoad | MacroAssembler::StoreStore), Rtemp);
1674
1675 __ ldr_s32(R2, Address(R2));
1676 __ ldr_u32(R3, Address(Rthread, JavaThread::suspend_flags_offset()));
1677 __ cmp(R2, SafepointSynchronize::_not_synchronized);
1678 __ cond_cmp(R3, 0, eq);
1679 __ b(call_safepoint_runtime, ne);
1680 __ bind(return_to_java);
1681
1682 // Perform thread state transition and reguard stack yellow pages if needed
1683 Label reguard, reguard_done;
1684 __ mov(Rtemp, _thread_in_Java);
|