changeset 7883:c62971d23589

8069593: Changes to JavaThread::_thread_state must use acquire and release Reviewed-by: kvn, dlong
author aph
date Wed, 21 Jan 2015 14:38:48 -0800
parents 694f5e5bb982
children 0ab4623375c2
files src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp src/share/vm/runtime/thread.hpp src/share/vm/runtime/thread.inline.hpp
diffstat 4 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Tue Jan 20 15:24:58 2015 -0800
+++ b/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Wed Jan 21 14:38:48 2015 -0800
@@ -1845,7 +1845,8 @@
 
   // 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;
@@ -1902,7 +1903,8 @@
   //     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) {
@@ -1966,7 +1968,8 @@
 
   // 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;
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Tue Jan 20 15:24:58 2015 -0800
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Wed Jan 21 14:38:48 2015 -0800
@@ -1097,7 +1097,8 @@
 
   // 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);
@@ -1118,7 +1119,8 @@
 
   // 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) {
@@ -1165,7 +1167,8 @@
 
   // 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);
--- a/src/share/vm/runtime/thread.hpp	Tue Jan 20 15:24:58 2015 -0800
+++ b/src/share/vm/runtime/thread.hpp	Wed Jan 21 14:38:48 2015 -0800
@@ -1022,7 +1022,7 @@
   address last_Java_pc(void)                     { return _anchor.last_Java_pc(); }
 
   // Safepoint support
-#ifndef PPC64
+#if !(defined(PPC64) || defined(AARCH64))
   JavaThreadState thread_state() const           { return _thread_state; }
   void set_thread_state(JavaThreadState s)       { _thread_state = s;    }
 #else
--- a/src/share/vm/runtime/thread.inline.hpp	Tue Jan 20 15:24:58 2015 -0800
+++ b/src/share/vm/runtime/thread.inline.hpp	Wed Jan 21 14:38:48 2015 -0800
@@ -122,7 +122,7 @@
   set_has_async_exception();
 }
 
-#ifdef PPC64
+#if defined(PPC64) || defined (AARCH64)
 inline JavaThreadState JavaThread::thread_state() const    {
   return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state);
 }