]> granicus.if.org Git - gc/commitdiff
2007-08-14 Hans Boehm <Hans.Boehm@hp.com> (really mostly Samuel Thibault)
authorhboehm <hboehm>
Tue, 14 Aug 2007 20:33:52 +0000 (20:33 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:41 +0000 (21:06 +0400)
* dbg_mlc.c: Use random() on all glibc systems.
* mach_dep.c (GC_with_callee_saves_pushed): Don't use getcontext() on
HURD.  Add comment.
* pthread_stop_world.c (GC_suspend_handler, GC_stop_init): Accomodate
systems without SA_SIGINFO.

ChangeLog
dbg_mlc.c
mach_dep.c
pthread_stop_world.c

index 40c37b2c6ec836884d0fb06128497605895fd34b..0ec91a14ef3cf55ec044c073cd89351999db3871 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-14  Hans Boehm <Hans.Boehm@hp.com> (really mostly Samuel Thibault)
+
+       * dbg_mlc.c: Use random() on all glibc systems.
+       * mach_dep.c (GC_with_callee_saves_pushed): Don't use getcontext() on
+       HURD.  Add comment.
+       * pthread_stop_world.c (GC_suspend_handler, GC_stop_init): Accomodate
+       systems without SA_SIGINFO.
+
 2007-08-14  Hans Boehm <Hans.Boehm@hp.com> (partly really Henrik Theiling)
 
        * include/gc.h (GC_PTR_STORE): Fix non-DEBUG parentheses.
index 70a23ab3dd854b49d4fc6c1d5e6856dc1522c281..4bb0e136d13a2eba7e0bb35efd150b42f69b74da 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -61,7 +61,7 @@ GC_bool GC_has_other_debug_info(ptr_t p)
 
 # include <stdlib.h>
 
-# if defined(LINUX) || defined(SOLARIS) \
+# if defined(__GLIBC__) || defined(SOLARIS) \
      || defined(HPUX) || defined(IRIX5) || defined(OSF1)
 #   define RANDOM() random()
 # else
index 4f05843c63588d7b136e2999d171e5d98914dd37..0491a52d7756d98c8b05b4c439be098ae13a783f 100644 (file)
@@ -174,7 +174,8 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
 
 #   if defined(HAVE_PUSH_REGS)
       GC_push_regs();
-#   elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32)
+#   elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32) && \
+        !defined(HURD)
       /* Older versions of Darwin seem to lack getcontext(). */
       /* ARM Linux often doesn't support a real getcontext(). */
       ucontext_t ctxt;
@@ -219,6 +220,8 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
          /* _setjmp won't, but is less portable.               */
 #       endif
 #   endif /* !HAVE_PUSH_REGS ... */
+    /* FIXME: context here is sometimes just zero.  At the moment the callees  */
+    /* don't really need it.                                                   */
     fn(arg, context);
     /* Strongly discourage the compiler from treating the above        */
     /* as a tail-call, since that would pop the register       */
index 3a1524b96b244cdfe3026ad51a4231382efb3734..003eddebc75585169d32cde1686991fb148ea493 100644 (file)
@@ -116,7 +116,11 @@ sem_t GC_suspend_ack_sem;
 void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
 
 #if defined(IA64) || defined(HP_PA) || defined(M68K)
+#ifdef SA_SIGINFO
 void GC_suspend_handler(int sig, siginfo_t *info, void *context)
+#else
+void GC_suspend_handler(int sig)
+#endif
 {
   int old_errno = errno;
   GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
@@ -125,9 +129,16 @@ void GC_suspend_handler(int sig, siginfo_t *info, void *context)
 #else
 /* We believe that in all other cases the full context is already      */
 /* in the signal handler frame.                                                */
+#ifdef SA_SIGINFO
 void GC_suspend_handler(int sig, siginfo_t *info, void *context)
+#else
+void GC_suspend_handler(int sig)
+#endif
 {
   int old_errno = errno;
+# ifndef SA_SIGINFO
+    void *context = 0;
+# endif
   GC_suspend_handler_inner((ptr_t)(word)sig, context);
   errno = old_errno;
 }
@@ -498,19 +509,29 @@ void GC_stop_init() {
        ABORT("sem_init failed");
 #   endif
 
-    act.sa_flags = SA_RESTART | SA_SIGINFO;
+    act.sa_flags = SA_RESTART
+#   ifdef SA_SIGINFO
+       | SA_SIGINFO
+#   endif
+       ;
     if (sigfillset(&act.sa_mask) != 0) {
        ABORT("sigfillset() failed");
     }
     GC_remove_allowed_signals(&act.sa_mask);
     /* SIG_THR_RESTART is set in the resulting mask.           */
     /* It is unmasked by the handler when necessary.           */
+#   ifdef SA_SIGINFO
     act.sa_sigaction = GC_suspend_handler;
+#   else
+    act.sa_handler = GC_suspend_handler;
+#   endif
     if (sigaction(SIG_SUSPEND, &act, NULL) != 0) {
        ABORT("Cannot set SIG_SUSPEND handler");
     }
 
+#   ifdef SA_SIGINFO
     act.sa_flags &= ~ SA_SIGINFO;
+#   endif
     act.sa_handler = GC_restart_handler;
     if (sigaction(SIG_THR_RESTART, &act, NULL) != 0) {
        ABORT("Cannot set SIG_THR_RESTART handler");