]> granicus.if.org Git - gc/commitdiff
2011-05-11 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Wed, 11 May 2011 13:27:30 +0000 (13:27 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:59 +0000 (21:06 +0400)
* backgraph.c (add_edge): Recognize DEBUG_PRINT_BIG_N_EDGES macro.
* os_dep.c (GC_set_and_save_fault_handler): Recognize
SIGACTION_FLAGS_NODEFER_HACK macro.
* pthread_support.c (mark_mutex): Recognize GLIBC_2_1_MUTEX_HACK
macro.
* pthread_support.c (GC_acquire_mark_lock): Remove commented out
code.
* include/gc_inline.h (GC_MALLOC_WORDS, GC_MALLOC_ATOMIC_WORDS,
GC_CONS): Remove trailing space (before back-slash).
* include/private/gc_hdrs.h (GET_BI, GET_HDR_ADDR): Ditto.
* include/private/gc_pmark.h (PUSH_OBJ, PUSH_CONTENTS,
SET_MARK_BIT_EXIT_IF_SET, LONG_MULT, PUSH_CONTENTS_HDR,
GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP): Ditto.
* include/private/thread_local_alloc.h (GC_key_create): Ditto.
* include/private/gc_priv.h (SUNOS5SIGS): Don't include
sys/siginfo.h on Linux.
* include/private/gcconfig.h: Reformat comments (and some code).
* include/private/gcconfig.h (FORCE_WRITE_PREFETCH): New macro
recognized, force PREFETCH_FOR_WRITE to be defined on x86.
* include/private/gcconfig.h (USE_HPUX_FIXED_STACKBOTTOM): New
macro recognized (for HP/UX).

ChangeLog
backgraph.c
include/gc_inline.h
include/private/gc_hdrs.h
include/private/gc_pmark.h
include/private/gc_priv.h
include/private/gcconfig.h
include/private/thread_local_alloc.h
os_dep.c
pthread_support.c

index dff02807fd71209aa5548cf5945226c489bb5fcf..1ccedb2812480b5005eb9b2eb143b2f1e88101f1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2011-05-11  Ivan Maidanski  <ivmai@mail.ru>
+
+       * backgraph.c (add_edge): Recognize DEBUG_PRINT_BIG_N_EDGES macro.
+       * os_dep.c (GC_set_and_save_fault_handler): Recognize
+       SIGACTION_FLAGS_NODEFER_HACK macro.
+       * pthread_support.c (mark_mutex): Recognize GLIBC_2_1_MUTEX_HACK
+       macro.
+       * pthread_support.c (GC_acquire_mark_lock): Remove commented out
+       code.
+       * include/gc_inline.h (GC_MALLOC_WORDS, GC_MALLOC_ATOMIC_WORDS,
+       GC_CONS): Remove trailing space (before back-slash).
+       * include/private/gc_hdrs.h (GET_BI, GET_HDR_ADDR): Ditto.
+       * include/private/gc_pmark.h (PUSH_OBJ, PUSH_CONTENTS,
+       SET_MARK_BIT_EXIT_IF_SET, LONG_MULT, PUSH_CONTENTS_HDR,
+       GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP): Ditto.
+       * include/private/thread_local_alloc.h (GC_key_create): Ditto.
+       * include/private/gc_priv.h (SUNOS5SIGS): Don't include
+       sys/siginfo.h on Linux.
+       * include/private/gcconfig.h: Reformat comments (and some code).
+       * include/private/gcconfig.h (FORCE_WRITE_PREFETCH): New macro
+       recognized, force PREFETCH_FOR_WRITE to be defined on x86.
+       * include/private/gcconfig.h (USE_HPUX_FIXED_STACKBOTTOM): New
+       macro recognized (for HP/UX).
+
 2011-05-11  Ivan Maidanski  <ivmai@mail.ru>
 
        * os_dep.c (GC_gww_page_was_ever_dirty): Fix comment (for
index 60d000cf29903639b4d84507995b5c4d85bbcbc4..60a9e0f9bb01e087e6245a22426b3039c2521071 100644 (file)
@@ -254,14 +254,12 @@ static void add_edge(ptr_t p, ptr_t q)
     }
     be_cont -> edges[i] = p;
     be -> n_edges++;
-    if (be -> n_edges == 100) {
-#       if 0
-          if (GC_print_stats) {
-            GC_err_printf("The following object has in-degree >= 100:\n");
-            GC_print_heap_obj(q);
-          }
-#       endif
-    }
+#   ifdef DEBUG_PRINT_BIG_N_EDGES
+      if (GC_print_stats == VERBOSE && be -> n_edges == 100) {
+        GC_err_printf("The following object has big in-degree:\n");
+        GC_print_heap_obj(q);
+      }
+#   endif
 }
 
 typedef void (*per_object_func)(ptr_t p, size_t n_bytes, word gc_descr);
index e2bb881e377b425bcd15eeea6bb82dfa3d2524b3..cc49da228648ea589d25f30d2c3a849cc695706c 100644 (file)
@@ -118,7 +118,7 @@ GC_API void GC_CALL GC_generic_malloc_many(size_t /* lb */, int /* k */,
 /* free list array.  For single-threaded applications, this may be      */
 /* a global array.                                                      */
 # define GC_MALLOC_WORDS(result,n,tiny_fl) \
-{       \
+{ \
     size_t grans = GC_WORDS_TO_WHOLE_GRANULES(n); \
     GC_FAST_MALLOC_GRANS(result, grans, tiny_fl, 0, \
                          NORMAL, GC_malloc(grans*GC_GRANULE_BYTES), \
@@ -126,7 +126,7 @@ GC_API void GC_CALL GC_generic_malloc_many(size_t /* lb */, int /* k */,
 }
 
 # define GC_MALLOC_ATOMIC_WORDS(result,n,tiny_fl) \
-{       \
+{ \
     size_t grans = GC_WORDS_TO_WHOLE_GRANULES(n); \
     GC_FAST_MALLOC_GRANS(result, grans, tiny_fl, 0, \
                          PTRFREE, GC_malloc_atomic(grans*GC_GRANULE_BYTES), \
@@ -135,12 +135,12 @@ GC_API void GC_CALL GC_generic_malloc_many(size_t /* lb */, int /* k */,
 
 /* And once more for two word initialized objects: */
 # define GC_CONS(result, first, second, tiny_fl) \
-{       \
+{ \
     size_t grans = GC_WORDS_TO_WHOLE_GRANULES(2); \
     GC_FAST_MALLOC_GRANS(result, grans, tiny_fl, 0, \
                          NORMAL, GC_malloc(grans*GC_GRANULE_BYTES), \
                          *(void **)(result) = (void *)(first)); \
-    ((void **)(result))[1] = (void *)(second);  \
+    ((void **)(result))[1] = (void *)(second); \
 }
 
 #endif /* !GC_INLINE_H */
index 777b016a2f9fe7a978680e2dfc92fa8586f74cb9..0360adbcc3e80c10eef55888778a9c9f3cd54184 100644 (file)
@@ -176,7 +176,6 @@ typedef struct bi {
           register word hi = \
               (word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \
           register bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \
-          \
           while (_bi -> key != hi && _bi != GC_all_nils) \
               _bi = _bi -> hash_link; \
           (bottom_indx) = _bi; \
@@ -184,8 +183,7 @@ typedef struct bi {
 # define GET_HDR_ADDR(p, ha) \
       { \
           register bottom_index * bi; \
-          \
-          GET_BI(p, bi);      \
+          GET_BI(p, bi); \
           (ha) = &(HDR_FROM_BI(bi, p)); \
       }
 # define GET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \
index 3064050554ab5b090c84ba4763e56632453b54a5..42fbb20481d529cf67a8d0ca85b0af4364d64263 100644 (file)
@@ -133,7 +133,6 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp);
 #define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \
 { \
     register word _descr = (hhdr) -> hb_descr; \
-        \
     GC_ASSERT(!HBLK_IS_FREE(hhdr)); \
     if (_descr != 0) { \
         mark_stack_top++; \
@@ -153,10 +152,9 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp);
                       source, exit_label) \
 { \
     hdr * my_hhdr; \
- \
     HC_GET_HDR(current, my_hhdr, source, exit_label); \
     PUSH_CONTENTS_HDR(current, mark_stack_top, mark_stack_limit, \
-                  source, exit_label, my_hhdr, TRUE);   \
+                  source, exit_label, my_hhdr, TRUE); \
 exit_label: ; \
 }
 
@@ -169,7 +167,7 @@ exit_label: ; \
     { \
         char * mark_byte_addr = (char *)hhdr -> hb_marks + (bit_no); \
         if (*mark_byte_addr) goto exit_label; \
-        *mark_byte_addr = 1;  \
+        *mark_byte_addr = 1; \
     }
 #else
 # ifdef PARALLEL_MARK
@@ -227,8 +225,8 @@ exit_label: ; \
 # define LONG_MULT(hprod, lprod, x, y) { \
         unsigned long long prod = (unsigned long long)(x) \
                                   * (unsigned long long)(y); \
-        hprod = prod >> 32;  \
-        lprod = (unsigned32)prod;  \
+        hprod = prod >> 32; \
+        lprod = (unsigned32)prod; \
   }
 #endif /* !I386 */
 
@@ -250,16 +248,16 @@ exit_label: ; \
     /* first block, then we are in the all_interior_pointers case, and  */ \
     /* it is safe to use any displacement value.                        */ \
     size_t gran_displ = BYTES_TO_GRANULES(displ); \
-    size_t gran_offset = hhdr -> hb_map[gran_displ];    \
+    size_t gran_offset = hhdr -> hb_map[gran_displ]; \
     size_t byte_offset = displ & (GRANULE_BYTES - 1); \
-    ptr_t base = current;  \
+    ptr_t base = current; \
     /* The following always fails for large block references. */ \
     if (EXPECT((gran_offset | byte_offset) != 0, FALSE))  { \
         if (hhdr -> hb_large_block) { \
           /* gran_offset is bogus.      */ \
           size_t obj_displ; \
           base = (ptr_t)(hhdr -> hb_block); \
-          obj_displ = (ptr_t)(current) - base;  \
+          obj_displ = (ptr_t)(current) - base; \
           if (obj_displ != displ) { \
             GC_ASSERT(obj_displ < hhdr -> hb_sz); \
             /* Must be in all_interior_pointer case, not first block */ \
@@ -308,7 +306,7 @@ exit_label: ; \
     size_t displ = HBLKDISPL(current); /* Displacement in block; in bytes. */\
     unsigned32 low_prod, high_prod; \
     unsigned32 inv_sz = hhdr -> hb_inv_sz; \
-    ptr_t base = current;  \
+    ptr_t base = current; \
     LONG_MULT(high_prod, low_prod, displ, inv_sz); \
     /* product is > and within sz_in_bytes of displ * sz_in_bytes * 2**32 */ \
     if (EXPECT(low_prod >> 16 != 0, FALSE))  { \
@@ -316,7 +314,7 @@ exit_label: ; \
         if (inv_sz == LARGE_INV_SZ) { \
           size_t obj_displ; \
           base = (ptr_t)(hhdr -> hb_block); \
-          obj_displ = (ptr_t)(current) - base;  \
+          obj_displ = (ptr_t)(current) - base; \
           if (obj_displ != displ) { \
             GC_ASSERT(obj_displ < hhdr -> hb_sz); \
             /* Must be in all_interior_pointer case, not first block */ \
@@ -377,20 +375,20 @@ exit_label: ; \
 #if NEED_FIXUP_POINTER
     /* Try both the raw version and the fixed up one.   */
 # define GC_PUSH_ONE_STACK(p, source) \
-      if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr     \
-         && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) {      \
-         PUSH_ONE_CHECKED_STACK(p, source);     \
+      if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \
+          && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \
+         PUSH_ONE_CHECKED_STACK(p, source); \
       } \
       FIXUP_POINTER(p); \
-      if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr     \
-         && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) {      \
-         PUSH_ONE_CHECKED_STACK(p, source);     \
+      if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \
+          && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \
+         PUSH_ONE_CHECKED_STACK(p, source); \
       }
 #else /* !NEED_FIXUP_POINTER */
 # define GC_PUSH_ONE_STACK(p, source) \
-      if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr     \
-         && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) {      \
-         PUSH_ONE_CHECKED_STACK(p, source);     \
+      if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \
+          && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \
+         PUSH_ONE_CHECKED_STACK(p, source); \
       }
 #endif
 
@@ -401,9 +399,9 @@ exit_label: ; \
  */
 #define GC_PUSH_ONE_HEAP(p,source) \
     FIXUP_POINTER(p); \
-    if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr       \
-         && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) {      \
-            GC_mark_stack_top = GC_mark_and_push( \
+    if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \
+         && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \
+      GC_mark_stack_top = GC_mark_and_push( \
                             (void *)(p), GC_mark_stack_top, \
                             GC_mark_stack_limit, (void * *)(source)); \
     }
index 84d40f546cdd69f79e9042cdda1940929a10ba4c..71ef9ff5eb4dcc43a0dc68529325ca4c4b57efe7 100644 (file)
@@ -2113,7 +2113,7 @@ GC_EXTERN signed_word GC_bytes_found;
 /* possible/needed.                                             */
 #if defined(UNIX_LIKE) || (defined(NEED_FIND_LIMIT) && defined(CYGWIN32))
 # include <setjmp.h>
-# if defined(SUNOS5SIGS) && !defined(FREEBSD)
+# if defined(SUNOS5SIGS) && !defined(FREEBSD) && !defined(LINUX)
 #  include <sys/siginfo.h>
 # endif
   /* Define SETJMP and friends to be the version that restores  */
index 22ce8a28f70a4fdf1f5309c0674c9d7f7bb81808..54d93645812903ce44da4e5f125169ed131cf95d 100644 (file)
@@ -54,8 +54,8 @@
 # endif
 
 /* And one for FreeBSD: */
-# if (defined(__FreeBSD__) || defined(__DragonFly__) || \
-      defined(__FreeBSD_kernel__)) && !defined(FREEBSD)
+# if (defined(__FreeBSD__) || defined(__DragonFly__) \
+      || defined(__FreeBSD_kernel__)) && !defined(FREEBSD)
 #    define FREEBSD
 # endif
 
 #    endif
 #    define mach_type_known
 # endif
-# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || \
-                        defined(powerpc64) || defined(__powerpc64__))
+# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) \
+                        || defined(powerpc64) || defined(__powerpc64__))
 #    define POWERPC
 #    define mach_type_known
 # endif
  * allocation.
  */
 
-/* If we are using a recent version of gcc, we can use __builtin_unwind_init()
- * to push the relevant registers onto the stack.
- */
-# if defined(__GNUC__) && ((__GNUC__ >= 3) || \
-                           (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
+/* If we are using a recent version of gcc, we can use                    */
+/* __builtin_unwind_init() to push the relevant registers onto the stack. */
+# if defined(__GNUC__) && ((__GNUC__ >= 3) \
+                           || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
                        && !defined(__INTEL_COMPILER) && !defined(__PATHCC__)
 #   define HAVE_BUILTIN_UNWIND_INIT
 # endif
 #     include <LowMem.h>
 #     endif
 #     define OS_TYPE "MACOS"
-                        /* see os_dep.c for details of global data segments. */
+                /* see os_dep.c for details of global data segments. */
 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
 #     define DATAEND    /* not needed */
 #     define GETPAGESIZE() 4096
 #       define ALIGNMENT 4
 #       define STACKBOTTOM ((ptr_t) 0xc0000000)
 #     endif
-      /* XXX: see get_end(3), get_etext() and get_end() should not be used.
-         These aren't used when dyld support is enabled (it is by default) */
+      /* XXX: see get_end(3), get_etext() and get_end() should not be used. */
+      /* These aren't used when dyld support is enabled (it is by default). */
 #     define DATASTART ((ptr_t) get_etext())
 #     define DATAEND   ((ptr_t) get_end())
 #     ifndef USE_MMAP
 #       define PREFETCH_FOR_WRITE(x) \
           __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
 #     endif
-      /* There seems to be some issues with trylock hanging on darwin. This
-         should be looked into some more */
+      /* There seems to be some issues with trylock hanging on darwin.  */
+      /* This should be looked into some more.                          */
 #     define NO_PTHREAD_TRYLOCK
 #   endif
 #   ifdef OPENBSD
 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
 #       endif
 #       ifdef USE_I686_PREFETCH
-          /* FIXME: Thus should use __builtin_prefetch, but we'll leave that    */
-          /* for the next rtelease.                                             */
+          /* FIXME: Thus should use __builtin_prefetch, but we'll leave that */
+          /* for the next rtelease.                                          */
 #         define PREFETCH(x) \
-            __asm__ __volatile__ ("     prefetchnta     %0": : "m"(*(char *)(x)))
-            /* Empirically prefetcht0 is much more effective at reducing        */
-            /* cache miss stalls for the targeted load instructions.  But it    */
-            /* seems to interfere enough with other cache traffic that the net  */
-            /* result is worse than prefetchnta.                                */
-#         if 0
-            /* Using prefetches for write seems to have a slight negative       */
-            /* impact on performance, at least for a PIII/500.                  */
+            __asm__ __volatile__ ("prefetchnta %0" : : "m"(*(char *)(x)))
+            /* Empirically prefetcht0 is much more effective at reducing     */
+            /* cache miss stalls for the targeted load instructions.  But it */
+            /* seems to interfere enough with other cache traffic that the   */
+            /* net result is worse than prefetchnta.                         */
+#         ifdef FORCE_WRITE_PREFETCH
+            /* Using prefetches for write seems to have a slight negative    */
+            /* impact on performance, at least for a PIII/500.               */
 #           define PREFETCH_FOR_WRITE(x) \
-              __asm__ __volatile__ ("   prefetcht0      %0": : "m"(*(char *)(x)))
+              __asm__ __volatile__ ("prefetcht0 %0" : : "m"(*(char *)(x)))
 #         endif
 #       endif
 #       ifdef USE_3DNOW_PREFETCH
 #         define PREFETCH(x) \
-            __asm__ __volatile__ ("     prefetch        %0": : "m"(*(char *)(x)))
+            __asm__ __volatile__ ("prefetch %0" : : "m"(*(char *)(x)))
 #         define PREFETCH_FOR_WRITE(x) \
-            __asm__ __volatile__ ("     prefetchw       %0": : "m"(*(char *)(x)))
+            __asm__ __volatile__ ("prefetchw %0" : : "m"(*(char *)(x)))
 #       endif
 #   endif
 #   ifdef CYGWIN32
         extern int _stklen;
         extern int __djgpp_stack_limit;
 #       define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
-/* #       define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
-                                                     + _stklen)) */
+/* #define STACKBOTTOM ((ptr_t)((word)_stubinfo+_stubinfo->size+_stklen)) */
 #       define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
                 /* This may not be right.  */
 #   endif
       extern long __nullarea;
       extern char _end;
       extern char *_STACKTOP;
-      /* Depending on calling conventions Watcom C either precedes
-         or does not precedes with underscore names of C-variables.
-         Make sure startup code variables always have the same names.  */
+      /* Depending on calling conventions Watcom C either precedes      */
+      /* or does not precedes with underscore names of C-variables.     */
+      /* Make sure startup code variables always have the same names.   */
       #pragma aux __nullarea "*";
       #pragma aux _end "*";
 #     define STACKBOTTOM ((ptr_t) _STACKTOP)
 #     define OS_TYPE "DARWIN"
 #     define DARWIN_DONT_PARSE_STACK
 #     define DYNAMIC_LOADING
-      /* XXX: see get_end(3), get_etext() and get_end() should not be used.
-         These aren't used when dyld support is enabled (it is by default) */
+      /* XXX: see get_end(3), get_etext() and get_end() should not be used. */
+      /* These aren't used when dyld support is enabled (it is by default). */
 #     define DATASTART ((ptr_t) get_etext())
 #     define DATAEND   ((ptr_t) get_end())
 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
 #     define MPROTECT_VDB
 #     include <unistd.h>
 #     define GETPAGESIZE() getpagesize()
-      /* There seems to be some issues with trylock hanging on darwin. This
-         should be looked into some more */
+      /* There seems to be some issues with trylock hanging on darwin.  */
+      /* This should be looked into some more.                          */
 #     define NO_PTHREAD_TRYLOCK
 #   endif /* DARWIN */
 # endif
 #     define OS_TYPE "HPUX"
       extern int __data_start[];
 #     define DATASTART ((ptr_t)(__data_start))
-#     if 0
+#     ifdef USE_HPUX_FIXED_STACKBOTTOM
         /* The following appears to work for 7xx systems running HP/UX  */
         /* 9.xx Furthermore, it might result in much faster             */
         /* collections than HEURISTIC2, which may involve scanning      */
 #     define OS_TYPE "DARWIN"
 #     define DARWIN_DONT_PARSE_STACK
 #     define DYNAMIC_LOADING
-      /* XXX: see get_end(3), get_etext() and get_end() should not be used.
-         These aren't used when dyld support is enabled (it is by default) */
+      /* XXX: see get_end(3), get_etext() and get_end() should not be used. */
+      /* These aren't used when dyld support is enabled (it is by default)  */
 #     define DATASTART ((ptr_t) get_etext())
 #     define DATAEND   ((ptr_t) get_end())
 #     define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
 #     define MPROTECT_VDB
 #     include <unistd.h>
 #     define GETPAGESIZE() getpagesize()
-      /* There seems to be some issues with trylock hanging on darwin. This
-         should be looked into some more */
+      /* There seems to be some issues with trylock hanging on darwin.  */
+      /* This should be looked into some more.                          */
 #     define NO_PTHREAD_TRYLOCK
 #   endif
 #   ifdef FREEBSD
index 93f943d2a0d9655d50d50ac5ad87c1f4988a70f8..b36fffdd7e2230e0107cb6a8218de79ffd2a3005 100644 (file)
@@ -116,7 +116,7 @@ typedef struct thread_local_freelists {
       /* this is currently missing in WinCE */
 #     define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF
 #   endif
-#   define GC_key_create(key, d)  \
+#   define GC_key_create(key, d) \
         ((d) != 0 || (*(key) = TlsAlloc()) == TLS_OUT_OF_INDEXES ? -1 : 0)
         /* Need TlsFree on process exit/detach ? */
     typedef DWORD GC_key_t;
index ed8726e0565a543591cab416ac3cd6216a35b76c..bff6cde9103f13d14bb431e8207f62fe005f08ec 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -855,16 +855,17 @@ GC_INNER word GC_page_size = 0;
 
     GC_INNER void GC_set_and_save_fault_handler(GC_fault_handler_t h)
     {
-#       if defined(SUNOS5SIGS) || defined(IRIX5)  \
+#       if defined(SUNOS5SIGS) || defined(IRIX5) \
            || defined(OSF1) || defined(HURD) || defined(NETBSD)
-          struct sigaction      act;
+          struct sigaction act;
 
-          act.sa_handler        = h;
-#         if 0 /* Was necessary for Solaris 2.3 and very temporary      */
-               /* NetBSD bugs.                                          */
-            act.sa_flags          = SA_RESTART | SA_NODEFER;
+          act.sa_handler = h;
+#         ifdef SIGACTION_FLAGS_NODEFER_HACK
+            /* Was necessary for Solaris 2.3 and very temporary */
+            /* NetBSD bugs.                                     */
+            act.sa_flags = SA_RESTART | SA_NODEFER;
 #         else
-            act.sa_flags          = SA_RESTART;
+            act.sa_flags = SA_RESTART;
 #         endif
 
           (void) sigemptyset(&act.sa_mask);
@@ -893,8 +894,8 @@ GC_INNER word GC_page_size = 0;
     }
 # endif /* NEED_FIND_LIMIT || UNIX_LIKE */
 
-# if defined(NEED_FIND_LIMIT) || \
-     defined(USE_PROC_FOR_LIBRARIES) && defined(THREADS)
+# if defined(NEED_FIND_LIMIT) \
+     || (defined(USE_PROC_FOR_LIBRARIES) && defined(THREADS))
   /* Some tools to implement HEURISTIC2 */
 #   define MIN_PAGE_SIZE 256    /* Smallest conceivable page size, bytes */
 
index af16a57d2c5bce27f429a443cc1e7952c12ca0ec..8caaee07e5ca6071654a757e1621fbb1c755e654 100644 (file)
@@ -1767,7 +1767,7 @@ GC_INNER void GC_lock(void)
   GC_INNER unsigned long GC_mark_lock_holder = NO_THREAD;
 #endif
 
-#if 0
+#ifdef GLIBC_2_1_MUTEX_HACK
   /* Ugly workaround for a linux threads bug in the final versions      */
   /* of glibc2.1.  Pthread_mutex_trylock sets the mutex owner           */
   /* field even when it fails to acquire the mutex.  This causes        */
@@ -1785,11 +1785,6 @@ static pthread_cond_t builder_cv = PTHREAD_COND_INITIALIZER;
 
 GC_INNER void GC_acquire_mark_lock(void)
 {
-/*
-    if (pthread_mutex_lock(&mark_mutex) != 0) {
-        ABORT("pthread_mutex_lock failed");
-    }
-*/
     GC_generic_lock(&mark_mutex);
 #   ifdef GC_ASSERTIONS
         GC_mark_lock_holder = NUMERIC_THREAD_ID(pthread_self());