OSDN Git Service

* posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use write_barrier,
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Mar 2002 00:26:46 +0000 (00:26 +0000)
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Mar 2002 00:26:46 +0000 (00:26 +0000)
not release_set.
* sysdep/powerpc/locks.h (write_barrier): New function.
* sysdep/i386/locks.h (write_barrier): New function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51101 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/posix-threads.cc
libjava/sysdep/i386/locks.h
libjava/sysdep/powerpc/locks.h

index 38bcb31..677fd8e 100644 (file)
@@ -1,6 +1,13 @@
+2002-03-20  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
+
+       * posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use write_barrier,
+       not release_set.
+       * sysdep/powerpc/locks.h (write_barrier): New function.
+       * sysdep/i386/locks.h (write_barrier): New function.
+
 2002-03-19  Martin Kahlert  <martin.kahlert@infineon.com>
 
-       * include/jni.h Use correct C comments 
+       * include/jni.h Use correct C comments.
 
 2002-03-18  Tom Tromey  <tromey@redhat.com>
 
index 6442eaf..e92348b 100644 (file)
@@ -448,7 +448,8 @@ _Jv_ThreadSelf_out_of_line(volatile self_cache_entry *sce, size_t high_sp_bits)
 {
   pthread_t self = pthread_self();
   sce -> high_sp_bits = high_sp_bits;
-  release_set ((obj_addr_t *) &(sce -> self), self);
+  write_barrier();
+  sce -> self = self;
   return self;
 }
 
index 0c029ac..a9501ae 100644 (file)
@@ -62,4 +62,12 @@ read_barrier()
 {
 }
 
+// Ensure that prior stores to memory are completed with respect to other
+// processors.
+inline static void
+write_barrier()
+{
+  // X86 does not reorder writes. We just need to ensure that gcc also doesn't.
+  __asm__ __volatile__(" " : : : "memory");
+}
 #endif
index 414b5dc..4d4532b 100644 (file)
@@ -75,4 +75,12 @@ read_barrier()
   __asm__ __volatile__ ("isync" : : : "memory");
 }
 
+// Ensure that prior stores to memory are completed with respect to other
+// processors.
+inline static void
+write_barrier()
+{
+  __asm__ __volatile__ ("sync" : : : "memory");
+}
+
 #endif