]> granicus.if.org Git - gc/commitdiff
In libgc/:
authorZoltan Varga <vargaz@gmail.com>
Fri, 5 Mar 2010 14:22:32 +0000 (14:22 +0000)
committerguest <ivmai@mail.ru>
Fri, 29 Jul 2011 11:31:22 +0000 (15:31 +0400)
2010-03-04  David S. Miller  <davem@davemloft.net>

       * include/private/gc_locks.h: Add SPARC implementations of
       GC_compare_and_exchange and GC_memory_barrier.

In mono/mini/:

2010-03-04  David S. Miller  <davem@davemloft.net>

       * mini-sparc.h: Always use MONO_ARCH_USE_SIGACTION.  Linux kernels
       that don't provide the siginfo in the second signal handler argument
       are buggy, and this has been fixed for years.
       * mini.h (GET_CONTEXT): Remove __sparc__ special case.
       (SIG_HANDLER_SIGNATURE, SIG_HANDLER_PARMS): Likewise.

svn path=/trunk/mono/; revision=153114

ChangeLog
include/private/gc_locks.h

index 0dcfc7e5a794ebaaff7a0c7ce01b34d2ae1223f8..5734f44a3609e260c901faf37e1819fc4dc20443 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-04  David S. Miller  <davem@davemloft.net>
+
+       * include/private/gc_locks.h: Add SPARC implementations of
+       GC_compare_and_exchange and GC_memory_barrier.
+
 2010-02-22  Zoltan Varga  <vargaz@gmail.com>
 
        * obj_map.c (GC_add_map_entry): Speed this up for the common case where
index 23a506a923625ac6ff3f1df8d9ad4fda9a22b0f7..3803f6acc44766c5b7552386025d2fdb7ee3fb99 100644 (file)
         }
 #     endif /* POWERPC */
 
+#     if defined(SPARC)
+#      if !defined(GENERIC_COMPARE_AND_SWAP)
+#       if CPP_WORDSZ == 64
+        /* Returns TRUE if the comparison succeeded. */
+        inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,
+            GC_word old, GC_word new_val)
+        {
+            unsigned long result;
+            __asm__ __volatile__(
+               "casx [%2], %3, %0"
+                :  "=r" (result)
+                :  "0" (new_val), "r" (addr), "r" (old)
+                : "memory");
+            return (GC_bool) (result == old);
+        }
+#       else
+        /* Returns TRUE if the comparison succeeded. */
+        inline static GC_bool GC_compare_and_exchange(volatile GC_word *_addr,
+            GC_word _old, GC_word _new_val)
+        {
+           register unsigned long result asm("o0");
+           register unsigned long old asm("o1");
+           register volatile GC_word *addr asm("o2");
+           result = _new_val;
+           old = _old;
+           addr = _addr;
+            __asm__ __volatile__(
+               /* We encode the instruction directly so that it
+                  doesn't taint the whole binary as v9-only.  */
+               ".word 0xd1e29009" /* cas [%o2], %o1, %o0 */
+                :  "=r" (result)
+                :  "0" (result), "r" (addr), "r"(old)
+                : "memory");
+            return (GC_bool) (result == old);
+        }
+#       endif
+#      endif /* !GENERIC_COMPARE_AND_SWAP */
+        inline static void GC_memory_barrier()
+        {
+           /* All sparc v9 chips provice procesor consistent ordering. */
+           /* Thus a compiler barrier should suffice.                  */
+            __asm__ __volatile__("" : : : "memory");
+        }
+#     endif /* SPARC */
+
 #     if defined(IA64)
 #      if !defined(GENERIC_COMPARE_AND_SWAP)
          inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,