src/cpu/aarch64/vm/templateInterpreter_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

@@ -1095,11 +1095,12 @@
   }
 #endif
 
   // Change state to native
   __ mov(rscratch1, _thread_in_native);
-  __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
+  __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
+  __ stlrw(rscratch1, rscratch2);
 
   // Call the native method.
   __ blrt(r10, rscratch1);
   __ maybe_isb();
   __ get_method(rmethod);

@@ -1116,11 +1117,12 @@
   __ push(dtos);
   __ push(ltos);
 
   // change thread state
   __ mov(rscratch1, _thread_in_native_trans);
-  __ strw(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
       __ dsb(Assembler::SY);

@@ -1163,11 +1165,12 @@
     __ bind(Continue);
   }
 
   // change thread state
   __ mov(rscratch1, _thread_in_Java);
-  __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));
+  __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
+  __ stlrw(rscratch1, rscratch2);
 
   // reset_last_Java_frame
   __ reset_last_Java_frame(true, true);
 
   // reset handle block