Преглед изворни кода

In libgc/:

2010-03-04  David S. Miller  <[email protected]>

       * 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  <[email protected]>

       * 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
Zoltan Varga пре 16 година
родитељ
комит
3e035004df
5 измењених фајлова са 58 додато и 13 уклоњено
  1. 5 0
      libgc/ChangeLog
  2. 45 0
      libgc/include/private/gc_locks.h
  3. 8 0
      mono/mini/ChangeLog
  4. 0 7
      mono/mini/mini-sparc.h
  5. 0 6
      mono/mini/mini.h

+ 5 - 0
libgc/ChangeLog

@@ -1,3 +1,8 @@
+2010-03-04  David S. Miller  <[email protected]>
+
+       * include/private/gc_locks.h: Add SPARC implementations of
+       GC_compare_and_exchange and GC_memory_barrier.
+
 2010-02-22  Zoltan Varga  <[email protected]>
 2010-02-22  Zoltan Varga  <[email protected]>
 
 
 	* obj_map.c (GC_add_map_entry): Speed this up for the common case where
 	* obj_map.c (GC_add_map_entry): Speed this up for the common case where

+ 45 - 0
libgc/include/private/gc_locks.h

@@ -500,6 +500,51 @@
         }
         }
 #     endif /* POWERPC */
 #     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(IA64)
 #      if !defined(GENERIC_COMPARE_AND_SWAP)
 #      if !defined(GENERIC_COMPARE_AND_SWAP)
          inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,
          inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,

+ 8 - 0
mono/mini/ChangeLog

@@ -1,3 +1,11 @@
+2010-03-04  David S. Miller  <[email protected]>
+
+       * 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.
+
 2010-03-04  Zoltan Varga  <[email protected]>
 2010-03-04  Zoltan Varga  <[email protected]>
 
 
 	* aot-runtime.c (find_symbol): Fix a leak.
 	* aot-runtime.c (find_symbol): Fix a leak.

+ 0 - 7
mono/mini/mini-sparc.h

@@ -100,14 +100,7 @@ typedef struct MonoCompileArch {
 		MONO_CONTEXT_SET_SP ((ctx), __builtin_frame_address (0));	\
 		MONO_CONTEXT_SET_SP ((ctx), __builtin_frame_address (0));	\
 	} while (0)
 	} while (0)
 
 
-#ifndef __linux__
-/* 
- * Can't use sigaction on sparc/linux, since it doesn't support SA_SIGINFO. Instead, we
- * have to use the obsolete sigcontext parameter:
- * http://www.ussg.iu.edu/hypermail/linux/kernel/0110.3/1531.html.
- */
 #define MONO_ARCH_USE_SIGACTION 1
 #define MONO_ARCH_USE_SIGACTION 1
-#endif
 
 
 #ifdef HAVE_WORKING_SIGALTSTACK
 #ifdef HAVE_WORKING_SIGALTSTACK
 /*#define MONO_ARCH_SIGSEGV_ON_ALTSTACK*/
 /*#define MONO_ARCH_SIGSEGV_ON_ALTSTACK*/

+ 0 - 6
mono/mini/mini.h

@@ -2061,9 +2061,6 @@ gboolean mono_gdb_render_native_backtraces (void) MONO_INTERNAL;
 #ifdef MONO_ARCH_USE_SIGACTION
 #ifdef MONO_ARCH_USE_SIGACTION
 #define GET_CONTEXT \
 #define GET_CONTEXT \
     void *ctx = context;
     void *ctx = context;
-#elif defined(__sparc__)
-#define GET_CONTEXT \
-    void *ctx = sigctx;
 #else
 #else
 #define GET_CONTEXT \
 #define GET_CONTEXT \
 	void **_p = (void **)&_dummy; \
 	void **_p = (void **)&_dummy; \
@@ -2078,9 +2075,6 @@ gboolean mono_gdb_render_native_backtraces (void) MONO_INTERNAL;
 #elif defined(HOST_WIN32)
 #elif defined(HOST_WIN32)
 #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, EXCEPTION_RECORD *info, void *context)
 #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, EXCEPTION_RECORD *info, void *context)
 #define SIG_HANDLER_PARAMS _dummy, info, context
 #define SIG_HANDLER_PARAMS _dummy, info, context
-#elif defined(__sparc__)
-#define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy, void *sigctx)
-#define SIG_HANDLER_PARAMS _dummy, sigctx
 #else
 #else
 #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy)
 #define SIG_HANDLER_SIGNATURE(ftn) ftn (int _dummy)
 #define SIG_HANDLER_PARAMS _dummy
 #define SIG_HANDLER_PARAMS _dummy