]> granicus.if.org Git - gc/commitdiff
2009-10-17 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Sat, 17 Oct 2009 20:12:19 +0000 (20:12 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:50 +0000 (21:06 +0400)
* backgraph.c (SET_OH_BG_PTR): Place outermost parenthesis
properly.
* darwin_stop_world.c: Replace "if DEBUG_THREADS" with
"ifdef DEBUG_THREADS".
* pthread_stop_world.c: Ditto.
* pthread_support.c: Ditto.
* include/gc_inline.h: Guard with GC_INLINE_H.

ChangeLog
backgraph.c
darwin_stop_world.c
include/gc_inline.h
pthread_stop_world.c
pthread_support.c

index 0a5f877cebf4b7380023e98edaa99ba3533ed5ba..74aceac02968cccb13b7706247e21249634d6d7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-17  Ivan Maidanski <ivmai@mail.ru>
+
+       * backgraph.c (SET_OH_BG_PTR): Place outermost parenthesis
+       properly.
+       * darwin_stop_world.c: Replace "if DEBUG_THREADS" with
+       "ifdef DEBUG_THREADS".
+       * pthread_stop_world.c: Ditto.
+       * pthread_support.c: Ditto.
+       * include/gc_inline.h: Guard with GC_INLINE_H.
+
 2009-10-17  Ivan Maidanski <ivmai@mail.ru>
 
        * alloc.c (GC_copyright): Define as const.
index 40d6cff2eaf4417499e9446050b59aa9b3190a26..a45586975964b341be0c1027065f735210c59d63 100644 (file)
@@ -167,7 +167,7 @@ static void pop_in_progress(ptr_t p)
 
 #define GET_OH_BG_PTR(p) \
                 (ptr_t)REVEAL_POINTER(((oh *)(p)) -> oh_bg_ptr)
-#define SET_OH_BG_PTR(p,q) (((oh *)(p)) -> oh_bg_ptr) = HIDE_POINTER(q)
+#define SET_OH_BG_PTR(p,q) (((oh *)(p)) -> oh_bg_ptr = HIDE_POINTER(q))
 
 /* Execute s once for each predecessor q of p in the points-to graph.   */
 /* s should be a bracketed statement.  We declare q.                    */
index edd707f2275fc7b0d5c669ccfc9119734f03cc4b..b39ef5feae0a9a4069bf57e2ecfc9b4b26f88bda 100644 (file)
@@ -224,7 +224,7 @@ void GC_push_all_stacks(void)
         hi = GC_stackbottom;
       else
         hi = p->stack_end;
-#     if DEBUG_THREADS
+#     ifdef DEBUG_THREADS
         GC_printf("Darwin: Stack for thread 0x%lx = [%lx,%lx)\n",
                   (unsigned long) p -> id, (unsigned long) lo,
                   (unsigned long) hi);
@@ -399,7 +399,7 @@ void GC_push_all_stacks(void)
 #       error FIXME for non-x86 || ppc || arm architectures
 #     endif
       }
-#     if DEBUG_THREADS
+#     ifdef DEBUG_THREADS
         GC_printf("Darwin: Stack for thread 0x%lx = [%p,%p)\n",
                   (unsigned long) thread, lo, hi);
 #     endif
@@ -440,7 +440,7 @@ STATIC int GC_suspend_thread_list(thread_act_array_t act_list, int count,
 
   for(i = 0; i < count; i++) {
     thread_act_t thread = act_list[i];
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("Attempting to suspend thread %p\n", thread);
 #   endif
     /* find the current thread in the old list */
@@ -478,7 +478,7 @@ STATIC int GC_suspend_thread_list(thread_act_array_t act_list, int count,
         }
         continue;
       }
-#     if DEBUG_THREADS
+#     ifdef DEBUG_THREADS
         GC_printf("Thread state for 0x%lx = %d\n", (unsigned long)thread,
                   info.run_state);
 #     endif
@@ -489,7 +489,7 @@ STATIC int GC_suspend_thread_list(thread_act_array_t act_list, int count,
       if (info.suspend_count)
         continue;
 
-#     if DEBUG_THREADS
+#     ifdef DEBUG_THREADS
         GC_printf("Suspending 0x%lx\n", (unsigned long)thread);
 #     endif
       /* Suspend the thread */
@@ -526,7 +526,7 @@ void GC_stop_world(void)
     thread_act_array_t act_list, prev_list;
     mach_msg_type_number_t listcount, prevcount;
 
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("Stopping the world from 0x%lx\n",
                 (unsigned long)mach_thread_self());
 #   endif
@@ -596,7 +596,7 @@ void GC_stop_world(void)
       if (GC_parallel)
         GC_release_mark_lock();
 #   endif
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("World stopped from 0x%lx\n", (unsigned long)my_thread);
 #   endif
 
@@ -617,7 +617,7 @@ void GC_start_world(void)
   struct thread_basic_info info;
   mach_msg_type_number_t outCount = THREAD_INFO_MAX;
 
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("World starting\n");
 #   endif
 
@@ -637,7 +637,7 @@ void GC_start_world(void)
         for(j = 0; j < GC_mach_threads_count; j++) {
           if (thread == GC_mach_threads[j].thread) {
             if (GC_mach_threads[j].already_suspended) {
-#             if DEBUG_THREADS
+#             ifdef DEBUG_THREADS
                 GC_printf("Not resuming already suspended thread %p\n", thread);
 #             endif
               continue;
@@ -646,7 +646,7 @@ void GC_start_world(void)
                                       (thread_info_t)&info, &outCount);
             if(kern_result != KERN_SUCCESS)
               ABORT("thread_info failed");
-#           if DEBUG_THREADS
+#           ifdef DEBUG_THREADS
               GC_printf("Thread state for 0x%lx = %d\n", (unsigned long)thread,
                          info.run_state);
               GC_printf("Resuming 0x%lx\n", (unsigned long)thread);
@@ -664,7 +664,7 @@ void GC_start_world(void)
                   sizeof(thread_t) * listcount);
 
     mach_port_deallocate(my_task, my_thread);
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("World started\n");
 #   endif
 }
index 2eb9472bdb48e239cabcf2fda9c76e141138aae8..4b8e3b5ca3cdf3d446218ea2b86e20599539725b 100644 (file)
@@ -13,6 +13,9 @@
  * modified is included with the above copyright notice.
  */
 
+#ifndef GC_INLINE_H
+#define GC_INLINE_H
+
 /* WARNING:                                                             */
 /* Note that for these routines, it is the clients responsibility to    */
 /* add the extra byte at the end to deal with one-past-the-end pointers.*/
                          (void)0 /* no initialization */); \
 }
 
-
 /* And once more for two word initialized objects: */
 # define GC_CONS(result, first, second, tiny_fl) \
 {       \
                          *(void **)result = (void *)(first)); \
     ((void **)(result))[1] = (void *)(second);  \
 }
+
+#endif /* !GC_INLINE_H */
index 424e90facdf38e08abfad9fa65f1e9036b65758b..fdf2157bb0dc1bafb9dc423367a27608a12ba50c 100644 (file)
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include "atomic_ops.h"
 
-#if DEBUG_THREADS
+#ifdef DEBUG_THREADS
 
 #ifndef NSIG
 # if defined(MAXSIG)
@@ -54,7 +54,7 @@ void GC_print_sig_mask(void)
     GC_printf("\n");
 }
 
-#endif
+#endif /* DEBUG_THREADS */
 
 /* Remove the signals that we want to allow in thread stopping  */
 /* handler from a set.                                          */
@@ -184,7 +184,7 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context)
         /* out of it.  In fact, it looks to me like an async-signal-safe  */
         /* cancellation point is inherently a problem, unless there is    */
         /* some way to disable cancellation in the handler.               */
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("Suspending 0x%x\n", (unsigned)my_thread);
 #   endif
 
@@ -238,7 +238,7 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context)
     /* Simply dropping the sigsuspend call should be safe, but is unlikely  */
     /* to be efficient.                                                     */
 
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("Continuing 0x%x\n", (unsigned)my_thread);
 #   endif
     RESTORE_CANCEL(cancel_state);
@@ -260,7 +260,7 @@ STATIC void GC_restart_handler(int sig)
     ** will thus not interrupt the sigsuspend() above.
     */
 
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("In GC_restart_handler for 0x%x\n", (unsigned)pthread_self());
 #   endif
 }
@@ -286,8 +286,8 @@ void GC_push_all_stacks(void)
     pthread_t me = pthread_self();
 
     if (!GC_thr_initialized) GC_thr_init();
-#   if DEBUG_THREADS
-        GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me);
+#   ifdef DEBUG_THREADS
+      GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me);
 #   endif
     for (i = 0; i < THREAD_TABLE_SZ; i++) {
       for (p = GC_threads[i]; p != 0; p = p -> next) {
@@ -314,14 +314,14 @@ void GC_push_all_stacks(void)
             hi = GC_stackbottom;
             IF_IA64(bs_lo = BACKING_STORE_BASE;)
         }
-#       if DEBUG_THREADS
-            GC_printf("Stack for thread 0x%x = [%p,%p)\n",
-                      (unsigned)(p -> id), lo, hi);
+#       ifdef DEBUG_THREADS
+          GC_printf("Stack for thread 0x%x = [%p,%p)\n",
+                    (unsigned)(p -> id), lo, hi);
 #       endif
         if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
         GC_push_all_stack_frames(lo, hi, p -> activation_frame);
 #       ifdef IA64
-#         if DEBUG_THREADS
+#         ifdef DEBUG_THREADS
             GC_printf("Reg stack for thread 0x%x = [%p,%p)\n",
                       (unsigned)p -> id, bs_lo, bs_hi);
 #         endif
@@ -341,9 +341,9 @@ void GC_push_all_stacks(void)
 
 /* There seems to be a very rare thread stopping problem.  To help us  */
 /* debug that, we save the ids of the stopping thread. */
-#if DEBUG_THREADS
-pthread_t GC_stopping_thread;
-int GC_stopping_pid = 0;
+#ifdef DEBUG_THREADS
+  pthread_t GC_stopping_thread;
+  int GC_stopping_pid = 0;
 #endif
 
 /* We hold the allocation lock.  Suspend all threads that might */
@@ -357,7 +357,7 @@ STATIC int GC_suspend_all(void)
     int result;
     pthread_t my_thread = pthread_self();
 
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_stopping_thread = my_thread;
       GC_stopping_pid = getpid();
 #   endif
@@ -368,7 +368,7 @@ STATIC int GC_suspend_all(void)
             if (p -> stop_info.last_stop_count == GC_stop_count) continue;
             if (p -> thread_blocked) /* Will wait */ continue;
             n_live_threads++;
-#           if DEBUG_THREADS
+#           ifdef DEBUG_THREADS
               GC_printf("Sending suspend signal to 0x%x\n",
                         (unsigned)(p -> id));
 #           endif
@@ -397,7 +397,7 @@ void GC_stop_world(void)
     int code;
 
     GC_ASSERT(I_HOLD_LOCK());
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self());
 #   endif
 
@@ -460,7 +460,7 @@ void GC_stop_world(void)
       if (GC_parallel)
         GC_release_mark_lock();
 #   endif
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("World stopped from 0x%x\n", (unsigned)pthread_self());
       GC_stopping_thread = 0;
 #   endif
@@ -479,7 +479,7 @@ void GC_start_world(void)
       int code;
 #   endif
 
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
       GC_printf("World starting\n");
 #   endif
 
@@ -490,7 +490,7 @@ void GC_start_world(void)
             if (p -> flags & FINISHED) continue;
             if (p -> thread_blocked) continue;
             n_live_threads++;
-#           if DEBUG_THREADS
+#           ifdef DEBUG_THREADS
               GC_printf("Sending restart signal to 0x%x\n",
                         (unsigned)(p -> id));
 #           endif
@@ -518,8 +518,8 @@ void GC_start_world(void)
                 ABORT("sem_wait() for restart handler failed");
             }
 #    endif
-#    if DEBUG_THREADS
-      GC_printf("World started\n");
+#    ifdef DEBUG_THREADS
+       GC_printf("World started\n");
 #    endif
 }
 
index fc9aae681511bf11f6d53e5c2e15cf98b87c42d8..12fb106fa8c79eee47128c4e8bf1c5814fc5f144 100644 (file)
@@ -43,7 +43,7 @@
 
 /*#define DEBUG_THREADS 1*/
 
-# include "private/pthread_support.h"
+#include "private/pthread_support.h"
 
 # if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS)
 
@@ -310,7 +310,7 @@ STATIC void * GC_mark_thread(void * id)
         my_mark_no = GC_mark_no;
     }
 #   ifdef DEBUG_THREADS
-        GC_printf("Starting mark helper for mark number %lu\n",
+      GC_printf("Starting mark helper for mark number %lu\n",
                 (unsigned long)my_mark_no);
 #   endif
     GC_help_marker(my_mark_no);
@@ -761,7 +761,7 @@ STATIC int GC_get_nprocs(void)
       numCpus = pm_sysinfo.idle_vp_count;
 
 #  ifdef DEBUG_THREADS
-    GC_printf("Number of active CPUs in this system: %d\n", numCpus);
+     GC_printf("Number of active CPUs in this system: %d\n", numCpus);
 #  endif
     return(numCpus);
 }
@@ -1195,7 +1195,7 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
 }
 
 STATIC void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb,
-                                                void * arg)
+                                                 void * arg)
 {
     struct start_info * si = arg;
     void * result;
@@ -1226,7 +1226,7 @@ STATIC void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb,
                                         /* OK to deallocate.    */
     pthread_cleanup_push(GC_thread_exit_proc, 0);
     result = (*start)(start_arg);
-#   if DEBUG_THREADS
+#   ifdef DEBUG_THREADS
         GC_printf("Finishing thread 0x%x\n", (unsigned)pthread_self());
 #   endif
     me -> status = result;