src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
Print this page
rev 7516 : 8069593: AARCH64: Changes to JavaThread::_thread_state must use acquire and release
Summary: Use release stores for all changes to thread state.
Reviewed-by: kvn
@@ -1843,11 +1843,12 @@
__ lea(c_rarg0, Address(rthread, in_bytes(JavaThread::jni_environment_offset())));
}
// Now set thread in native
__ mov(rscratch1, _thread_in_native);
- __ str(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
+ __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
+ __ stlrw(rscratch1, rscratch2);
{
int return_type = 0;
switch (ret_type) {
case T_VOID: break;
@@ -1900,11 +1901,12 @@
// Java thread A, in _thread_in_native state, loads _not_synchronized and is preempted.
// VM thread changes sync state to synchronizing and suspends threads for GC.
// Thread A is resumed to finish this native method, but doesn't block here since it
// didn't see any synchronization is progress, and escapes.
__ mov(rscratch1, _thread_in_native_trans);
- __ str(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
+ __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
+ __ stlrw(rscratch1, rscratch2);
if(os::is_MP()) {
if (UseMembar) {
// Force this write out before the read below
__ dmb(Assembler::SY);
@@ -1964,11 +1966,12 @@
__ bind(Continue);
}
// change thread state
__ mov(rscratch1, _thread_in_Java);
- __ str(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
+ __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
+ __ stlrw(rscratch1, rscratch2);
__ bind(after_transition);
Label reguard;
Label reguard_done;
__ ldrb(rscratch1, Address(rthread, JavaThread::stack_guard_state_offset()));