1825 break; // can't de-handlize until after safepoint check
1826 case T_VOID: break;
1827 case T_LONG: break;
1828 default : ShouldNotReachHere();
1829 }
1830
1831 // Switch thread to "native transition" state before reading the synchronization state.
1832 // This additional state is necessary because reading and testing the synchronization
1833 // state is not atomic w.r.t. GC, as this scenario demonstrates:
1834 // Java thread A, in _thread_in_native state, loads _not_synchronized and is preempted.
1835 // VM thread changes sync state to synchronizing and suspends threads for GC.
1836 // Thread A is resumed to finish this native method, but doesn't block here since it
1837 // didn't see any synchronization is progress, and escapes.
1838 __ mov(rscratch1, _thread_in_native_trans);
1839
1840 __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
1841
1842 // Force this write out before the read below
1843 __ dmb(Assembler::ISH);
1844
1845 // check for safepoint operation in progress and/or pending suspend requests
1846 Label safepoint_in_progress, safepoint_in_progress_done;
1847 {
1848 __ safepoint_poll_acquire(safepoint_in_progress);
1849 __ ldrw(rscratch1, Address(rthread, JavaThread::suspend_flags_offset()));
1850 __ cbnzw(rscratch1, safepoint_in_progress);
1851 __ bind(safepoint_in_progress_done);
1852 }
1853
1854 // change thread state
1855 Label after_transition;
1856 __ mov(rscratch1, _thread_in_Java);
1857 __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1858 __ stlrw(rscratch1, rscratch2);
1859 __ bind(after_transition);
1860
1861 Label reguard;
1862 Label reguard_done;
1863 __ ldrb(rscratch1, Address(rthread, JavaThread::stack_guard_state_offset()));
1864 __ cmpw(rscratch1, JavaThread::stack_guard_yellow_reserved_disabled);
|
1825 break; // can't de-handlize until after safepoint check
1826 case T_VOID: break;
1827 case T_LONG: break;
1828 default : ShouldNotReachHere();
1829 }
1830
1831 // Switch thread to "native transition" state before reading the synchronization state.
1832 // This additional state is necessary because reading and testing the synchronization
1833 // state is not atomic w.r.t. GC, as this scenario demonstrates:
1834 // Java thread A, in _thread_in_native state, loads _not_synchronized and is preempted.
1835 // VM thread changes sync state to synchronizing and suspends threads for GC.
1836 // Thread A is resumed to finish this native method, but doesn't block here since it
1837 // didn't see any synchronization is progress, and escapes.
1838 __ mov(rscratch1, _thread_in_native_trans);
1839
1840 __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
1841
1842 // Force this write out before the read below
1843 __ dmb(Assembler::ISH);
1844
1845 if (UseSVE > 0) {
1846 // Make sure that jni code does not change SVE vector length.
1847 __ verify_sve_vector_length();
1848 }
1849
1850 // check for safepoint operation in progress and/or pending suspend requests
1851 Label safepoint_in_progress, safepoint_in_progress_done;
1852 {
1853 __ safepoint_poll_acquire(safepoint_in_progress);
1854 __ ldrw(rscratch1, Address(rthread, JavaThread::suspend_flags_offset()));
1855 __ cbnzw(rscratch1, safepoint_in_progress);
1856 __ bind(safepoint_in_progress_done);
1857 }
1858
1859 // change thread state
1860 Label after_transition;
1861 __ mov(rscratch1, _thread_in_Java);
1862 __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1863 __ stlrw(rscratch1, rscratch2);
1864 __ bind(after_transition);
1865
1866 Label reguard;
1867 Label reguard_done;
1868 __ ldrb(rscratch1, Address(rthread, JavaThread::stack_guard_state_offset()));
1869 __ cmpw(rscratch1, JavaThread::stack_guard_yellow_reserved_disabled);
|