]> granicus.if.org Git - gc/commitdiff
2011-04-10 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Sun, 10 Apr 2011 09:46:46 +0000 (09:46 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:57 +0000 (21:06 +0400)
* gcj_mlc.c (GC_gcj_malloc_initialized): Use STATIC unless
GC_ASSERTIONS.
* include/private/gc_priv.h (GC_gcj_malloc_initialized): Don't
declare (as external) unless GC_ASSERTIONS.
* os_dep.c (GC_win32_free_heap): Clear GC_heap_bases[] also for
Cygwin; add FIXME.
* include/private/gcconfig.h: Include <sys/unistd.h> for RTEMS.
* include/private/gcconfig.h: Add "#error" for every "-->" mark.
* include/private/gcconfig.h (CLEAR_DOUBLE): Turn the code into
an expression.
* include/private/pthread_support.h (SUSPENDED_EXT): Add new flag
(which existed previously as SUSPENDED and still exists in GCJ).
* include/private/pthread_support.h (DISABLED_GC): Change the
value (as it is already used by SUSPENDED_EXT).

ChangeLog
gcj_mlc.c
include/private/gc_priv.h
include/private/gcconfig.h
include/private/pthread_support.h
os_dep.c

index 7a60eddd65ce8bb6f4e47e9cf1ceedaeea6e1b85..f42aff4ddfb16a84ba43e829849639c11c9d39fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2011-04-10  Ivan Maidanski  <ivmai@mail.ru>
+
+       * gcj_mlc.c (GC_gcj_malloc_initialized): Use STATIC unless
+       GC_ASSERTIONS.
+       * include/private/gc_priv.h (GC_gcj_malloc_initialized): Don't
+       declare (as external) unless GC_ASSERTIONS.
+       * os_dep.c (GC_win32_free_heap): Clear GC_heap_bases[] also for
+       Cygwin; add FIXME.
+       * include/private/gcconfig.h: Include <sys/unistd.h> for RTEMS.
+       * include/private/gcconfig.h: Add "#error" for every "-->" mark.
+       * include/private/gcconfig.h (CLEAR_DOUBLE): Turn the code into
+       an expression.
+       * include/private/pthread_support.h (SUSPENDED_EXT): Add new flag
+       (which existed previously as SUSPENDED and still exists in GCJ).
+       * include/private/pthread_support.h (DISABLED_GC): Change the
+       value (as it is already used by SUSPENDED_EXT).
+
 2011-04-10  Ivan Maidanski  <ivmai@mail.ru> (mostly really Iain Sandoe)
 
        * tests/test.c (reverse_test):  Modify count (BIG) for
index 7afa6bf2425bc1ba014703e9693a85ae3b54b6cc..a3d9358f5c82f1dc382b2630d7719f872824f158 100644 (file)
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
 #include "gc_gcj.h"
 #include "private/dbg_mlc.h"
 
-GC_INNER GC_bool GC_gcj_malloc_initialized = FALSE;
+#ifdef GC_ASSERTIONS
+  GC_INNER /* variable is also used in thread_local_alloc.c */
+#else
+  STATIC
+#endif
+GC_bool GC_gcj_malloc_initialized = FALSE;
 
 int GC_gcj_kind = 0;    /* Object kind for objects with descriptors     */
                         /* in "vtable".                                 */
index 7f3f5081792df78679905ad834e4b5a71a2427e3..cb0bfb4ad96ef8dd87f0a9eb381c9c817da840b8 100644 (file)
@@ -2007,7 +2007,9 @@ GC_EXTERN signed_word GC_bytes_found;
 #endif
 
 #ifdef GC_GCJ_SUPPORT
-  GC_EXTERN GC_bool GC_gcj_malloc_initialized; /* defined in gcj_mlc.c */
+# ifdef GC_ASSERTIONS
+    GC_EXTERN GC_bool GC_gcj_malloc_initialized; /* defined in gcj_mlc.c */
+# endif
   GC_EXTERN ptr_t * GC_gcjobjfreelist;
 #endif
 
index 051391a3757625501dd2ff151f6c7eff7648b75e..ec5e96ed36fec6381738641a4ea400683631f738 100644 (file)
 #   endif
 #   ifdef RTEMS
 #       define OS_TYPE "RTEMS"
+#       include <sys/unistd.h>
         extern int etext[];
 #       define DATASTART ((ptr_t)((((word) (etext)) + 0xfffff) & ~0xfffff))
 #       define DATAENT   ((ptr_t)(DATASTART + 0xfffff))
 #         define ALIGNMENT 4
 #       else
 #         ifndef _LP64
-                ---> unknown ABI
+#           error --> unknown ABI
 #         endif
 #         define CPP_WORDSZ 64
             /* Requires 16 byte alignment for malloc */
 #   define USE_PROC_FOR_LIBRARIES
 #endif
 
-# ifndef STACK_GROWS_UP
-#   define STACK_GROWS_DOWN
-# endif
+#ifndef STACK_GROWS_UP
+# define STACK_GROWS_DOWN
+#endif
 
-# ifndef CPP_WORDSZ
-#   define CPP_WORDSZ 32
-# endif
+#ifndef CPP_WORDSZ
+# define CPP_WORDSZ 32
+#endif
 
-# ifndef OS_TYPE
-#   define OS_TYPE ""
-# endif
+#ifndef OS_TYPE
+# define OS_TYPE ""
+#endif
 
-# ifndef DATAEND
-    extern int end[];
-#   define DATAEND (ptr_t)(end)
-# endif
+#ifndef DATAEND
+  extern int end[];
+# define DATAEND (ptr_t)(end)
+#endif
 
-# if defined(SVR4) && !defined(GETPAGESIZE)
-#    include <unistd.h>
-#    define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
-# endif
+#if defined(SVR4) && !defined(GETPAGESIZE)
+# include <unistd.h>
+# define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
+#endif
 
-# ifndef GETPAGESIZE
-#   if defined(SOLARIS) || defined(IRIX5) || defined(LINUX) \
-       || defined(NETBSD) || defined(FREEBSD) || defined(HPUX)
-#       include <unistd.h>
-#   endif
-#   define GETPAGESIZE() getpagesize()
+#ifndef GETPAGESIZE
+# if defined(SOLARIS) || defined(IRIX5) || defined(LINUX) \
+     || defined(NETBSD) || defined(FREEBSD) || defined(HPUX)
+#   include <unistd.h>
 # endif
+# define GETPAGESIZE() getpagesize()
+#endif
 
-# if defined(SOLARIS) || defined(DRSNX) || defined(UTS4)
-            /* OS has SVR4 generic features.            */
-            /* Probably others also qualify.            */
-#   define SVR4
-# endif
+#if defined(SOLARIS) || defined(DRSNX) || defined(UTS4)
+        /* OS has SVR4 generic features.        */
+        /* Probably others also qualify.        */
+# define SVR4
+#endif
 
-# if defined(SOLARIS) || defined(DRSNX)
-            /* OS has SOLARIS style semi-undocumented interface */
-            /* to dynamic loader.                               */
-#   define SOLARISDL
-            /* OS has SOLARIS style signal handlers.            */
-#   define SUNOS5SIGS
-# endif
+#if defined(SOLARIS) || defined(DRSNX)
+        /* OS has SOLARIS style semi-undocumented interface     */
+        /* to dynamic loader.                                   */
+# define SOLARISDL
+        /* OS has SOLARIS style signal handlers.        */
+# define SUNOS5SIGS
+#endif
 
-# if defined(HPUX)
-#   define SUNOS5SIGS
-# endif
+#if defined(HPUX)
+# define SUNOS5SIGS
+#endif
 
-# if defined(FREEBSD) && \
-     (defined(__DragonFly__) || __FreeBSD__ >= 4 || (__FreeBSD_kernel__ >= 4))
-#   define SUNOS5SIGS
-# endif
+#if defined(FREEBSD) && (defined(__DragonFly__) || __FreeBSD__ >= 4 \
+                         || (__FreeBSD_kernel__ >= 4))
+# define SUNOS5SIGS
+#endif
 
-# ifdef GC_NETBSD_THREADS
-#   define SIGRTMIN 33
-#   define SIGRTMAX 63
-# endif
+#ifdef GC_NETBSD_THREADS
+# define SIGRTMIN 33
+# define SIGRTMAX 63
+#endif
 
-# if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
-            || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
-            || defined(DGUX) || defined(BSD) || defined(HURD) \
-            || defined(AIX) || defined(DARWIN) || defined(OSF1)
-#   define UNIX_LIKE   /* Basic Unix-like system calls work.    */
-# endif
+#if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
+    || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
+    || defined(DGUX) || defined(BSD) || defined(HURD) \
+    || defined(AIX) || defined(DARWIN) || defined(OSF1)
+# define UNIX_LIKE      /* Basic Unix-like system calls work.   */
+#endif
 
-# if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
-           -> bad word size
-# endif
+#if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
+# error --> bad word size
+#endif
 
-# ifndef ALIGNMENT
-    --> undefined ALIGNMENT
-# endif
+#ifndef ALIGNMENT
+# error --> undefined ALIGNMENT
+#endif
 
-# ifdef PCR
-#   undef DYNAMIC_LOADING
-#   undef STACKBOTTOM
-#   undef HEURISTIC1
-#   undef HEURISTIC2
-#   undef PROC_VDB
-#   undef MPROTECT_VDB
-#   define PCR_VDB
-# endif
+#ifdef PCR
+# undef DYNAMIC_LOADING
+# undef STACKBOTTOM
+# undef HEURISTIC1
+# undef HEURISTIC2
+# undef PROC_VDB
+# undef MPROTECT_VDB
+# define PCR_VDB
+#endif
 
-# if !defined(STACKBOTTOM) && (defined(ECOS) || defined(NOSYS))
-#   error --> undefined STACKBOTTOM
-# endif
+#if !defined(STACKBOTTOM) && (defined(ECOS) || defined(NOSYS))
+# error --> undefined STACKBOTTOM
+#endif
 
-# ifdef IGNORE_DYNAMIC_LOADING
-#   undef DYNAMIC_LOADING
-# endif
+#ifdef IGNORE_DYNAMIC_LOADING
+# undef DYNAMIC_LOADING
+#endif
 
-# if defined(SMALL_CONFIG) && !defined(GC_DISABLE_INCREMENTAL)
-        /* Presumably not worth the space it takes. */
-#   define GC_DISABLE_INCREMENTAL
-# endif
+#if defined(SMALL_CONFIG) && !defined(GC_DISABLE_INCREMENTAL)
+  /* Presumably not worth the space it takes.   */
+# define GC_DISABLE_INCREMENTAL
+#endif
 
-# ifdef GC_DISABLE_INCREMENTAL
-#   undef GWW_VDB
-#   undef MPROTECT_VDB
-#   undef PCR_VDB
-#   undef PROC_VDB
-#   undef CHECKSUMS
-# endif
+#ifdef GC_DISABLE_INCREMENTAL
+# undef GWW_VDB
+# undef MPROTECT_VDB
+# undef PCR_VDB
+# undef PROC_VDB
+# undef CHECKSUMS
+#endif
 
-# ifdef USE_GLOBAL_ALLOC
-    /* Cannot pass MEM_WRITE_WATCH to GlobalAlloc().    */
-#   undef GWW_VDB
-# endif
+#ifdef USE_GLOBAL_ALLOC
+  /* Cannot pass MEM_WRITE_WATCH to GlobalAlloc().      */
+# undef GWW_VDB
+#endif
 
-# ifdef USE_MUNMAP
-    /* FIXME: Remove this undef if possible.    */
-#   undef MPROTECT_VDB  /* Can't deal with address space holes. */
-# endif
+#ifdef USE_MUNMAP
+  /* FIXME: Remove this undef if possible.      */
+# undef MPROTECT_VDB  /* Can't deal with address space holes.   */
+#endif
 
 /* PARALLEL_MARK does not cause undef MPROTECT_VDB any longer.  */
 
-# if defined(MPROTECT_VDB) && defined(GC_PREFER_MPROTECT_VDB)
-    /* Choose MPROTECT_VDB manually (if multiple strategies available). */
-#   undef PCR_VDB
-#   undef PROC_VDB
-    /* #undef GWW_VDB - handled in os_dep.c */
-# endif
+#if defined(MPROTECT_VDB) && defined(GC_PREFER_MPROTECT_VDB)
+  /* Choose MPROTECT_VDB manually (if multiple strategies available).   */
+# undef PCR_VDB
+# undef PROC_VDB
+  /* #undef GWW_VDB - handled in os_dep.c       */
+#endif
 
-# if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB) \
+#if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB) \
     && !defined(GWW_VDB) && !defined(GC_DISABLE_INCREMENTAL)
-#   define DEFAULT_VDB
-# endif
+# define DEFAULT_VDB
+#endif
 
-# ifndef PREFETCH
-#   define PREFETCH(x)
-#   define NO_PREFETCH
-# endif
+#ifndef PREFETCH
+# define PREFETCH(x)
+# define NO_PREFETCH
+#endif
 
-# ifndef PREFETCH_FOR_WRITE
-#   define PREFETCH_FOR_WRITE(x)
-#   define NO_PREFETCH_FOR_WRITE
-# endif
+#ifndef PREFETCH_FOR_WRITE
+# define PREFETCH_FOR_WRITE(x)
+# define NO_PREFETCH_FOR_WRITE
+#endif
 
-# ifndef CACHE_LINE_SIZE
-#   define CACHE_LINE_SIZE 32   /* Wild guess   */
-# endif
+#ifndef CACHE_LINE_SIZE
+# define CACHE_LINE_SIZE 32     /* Wild guess   */
+#endif
 
-# ifndef STATIC
-#   ifndef NO_DEBUGGING
-#     define STATIC /* ignore to aid profiling and possibly debugging */
-#   else
-#     define STATIC static
-#   endif
+#ifndef STATIC
+# ifndef NO_DEBUGGING
+#   define STATIC /* ignore to aid profiling and possibly debugging     */
+# else
+#   define STATIC static
 # endif
+#endif
 
-# if defined(LINUX) || defined(HURD) || defined(__GLIBC__)
-#   define REGISTER_LIBRARIES_EARLY
-    /* We sometimes use dl_iterate_phdr, which may acquire an internal  */
-    /* lock.  This isn't safe after the world has stopped.  So we must  */
-    /* call GC_register_dynamic_libraries before stopping the world.    */
-    /* For performance reasons, this may be beneficial on other         */
-    /* platforms as well, though it should be avoided in win32.         */
-# endif /* LINUX */
+#if defined(LINUX) || defined(HURD) || defined(__GLIBC__)
+# define REGISTER_LIBRARIES_EARLY
+  /* We sometimes use dl_iterate_phdr, which may acquire an internal    */
+  /* lock.  This isn't safe after the world has stopped.  So we must    */
+  /* call GC_register_dynamic_libraries before stopping the world.      */
+  /* For performance reasons, this may be beneficial on other           */
+  /* platforms as well, though it should be avoided in win32.           */
+#endif /* LINUX */
+
+#if defined(SEARCH_FOR_DATA_START)
+  extern ptr_t GC_data_start;
+# define DATASTART GC_data_start
+#endif
 
-# if defined(SEARCH_FOR_DATA_START)
-    extern ptr_t GC_data_start;
-#   define DATASTART GC_data_start
-# endif
+#ifndef CLEAR_DOUBLE
+# define CLEAR_DOUBLE(x) (((word*)(x))[0] = 0, ((word*)(x))[1] = 0)
+#endif
 
-# ifndef CLEAR_DOUBLE
-#   define CLEAR_DOUBLE(x) \
-                ((word*)x)[0] = 0; \
-                ((word*)x)[1] = 0;
-# endif /* CLEAR_DOUBLE */
+#if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) \
+    && !defined(INCLUDE_LINUX_THREAD_DESCR)
+  /* Will not work, since libc and the dynamic loader use thread        */
+  /* locals, sometimes as the only reference.                           */
+# define INCLUDE_LINUX_THREAD_DESCR
+#endif
 
-# if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) \
-     && !defined(INCLUDE_LINUX_THREAD_DESCR)
-    /* Will not work, since libc and the dynamic loader use thread      */
-    /* locals, sometimes as the only reference.                         */
-#   define INCLUDE_LINUX_THREAD_DESCR
-# endif
+#if defined(GC_IRIX_THREADS) && !defined(IRIX5)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_LINUX_THREADS) && !defined(LINUX) && !defined(NACL)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_NETBSD_THREADS) && !defined(NETBSD)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_FREEBSD_THREADS) && !defined(FREEBSD)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_SOLARIS_THREADS) && !defined(SOLARIS)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_HPUX_THREADS) && !defined(HPUX)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_AIX_THREADS) && !defined(_AIX)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_GNU_THREADS) && !defined(HURD)
+# error --> inconsistent configuration
+#endif
+#if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32) \
+    && !defined(MSWINCE)
+# error --> inconsistent configuration
+#endif
 
-# if defined(GC_IRIX_THREADS) && !defined(IRIX5)
-        --> inconsistent configuration
-# endif
-# if defined(GC_LINUX_THREADS) && !defined(LINUX) && !defined(NACL)
-        --> inconsistent configuration
-# endif
-# if defined(GC_NETBSD_THREADS) && !defined(NETBSD)
-        --> inconsistent configuration
-# endif
-# if defined(GC_FREEBSD_THREADS) && !defined(FREEBSD)
-        --> inconsistent configuration
-# endif
-# if defined(GC_SOLARIS_THREADS) && !defined(SOLARIS)
-        --> inconsistent configuration
-# endif
-# if defined(GC_HPUX_THREADS) && !defined(HPUX)
-        --> inconsistent configuration
-# endif
-# if defined(GC_AIX_THREADS) && !defined(_AIX)
-        --> inconsistent configuration
-# endif
-# if defined(GC_GNU_THREADS) && !defined(HURD)
-        --> inconsistent configuration
-# endif
-# if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32) \
-        && !defined(MSWINCE)
-        --> inconsistent configuration
-# endif
+#if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS) \
+    || defined(SN_TARGET_PS3)
+# define THREADS
+#endif
 
-# if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS) \
-        || defined(SN_TARGET_PS3)
-#   define THREADS
-# endif
+#if defined(UNIX_LIKE) && defined(THREADS) && !defined(NO_CANCEL_SAFE) \
+    && !defined(PLATFORM_ANDROID)
+  /* Make the code cancellation-safe.  This basically means that we     */
+  /* ensure that cancellation requests are ignored while we are in      */
+  /* the collector.  This applies only to Posix deferred cancellation;  */
+  /* we don't handle Posix asynchronous cancellation.                   */
+  /* Note that this only works if pthread_setcancelstate is             */
+  /* async-signal-safe, at least in the absence of asynchronous         */
+  /* cancellation.  This appears to be true for the glibc version,      */
+  /* though it is not documented.  Without that assumption, there       */
+  /* seems to be no way to safely wait in a signal handler, which       */
+  /* we need to do for thread suspension.                               */
+  /* Also note that little other code appears to be cancellation-safe.  */
+  /* Hence it may make sense to turn this off for performance.          */
+# define CANCEL_SAFE
+#endif
 
-# if defined(UNIX_LIKE) && defined(THREADS) && !defined(NO_CANCEL_SAFE) \
-     && !defined(PLATFORM_ANDROID)
-    /* Make the code cancellation-safe.  This basically means that we   */
-    /* ensure that cancellation requests are ignored while we are in    */
-    /* the collector.  This applies only to Posix deferred cancellation;*/
-    /* we don't handle Posix asynchronous cancellation.                 */
-    /* Note that this only works if pthread_setcancelstate is           */
-    /* async-signal-safe, at least in the absence of asynchronous       */
-    /* cancellation.  This appears to be true for the glibc version,    */
-    /* though it is not documented.  Without that assumption, there     */
-    /* seems to be no way to safely wait in a signal handler, which     */
-    /* we need to do for thread suspension.                             */
-    /* Also note that little other code appears to be cancellation-safe.*/
-    /* Hence it may make sense to turn this off for performance.        */
-#   define CANCEL_SAFE
-# endif
+#ifdef CANCEL_SAFE
+# define IF_CANCEL(x) x
+#else
+# define IF_CANCEL(x) /* empty */
+#endif
 
-# ifdef CANCEL_SAFE
-#   define IF_CANCEL(x) x
+#if !defined(USE_MARK_BITS) && !defined(USE_MARK_BYTES)
+# if defined(THREADS) && defined(PARALLEL_MARK)
+#   define USE_MARK_BYTES
 # else
-#   define IF_CANCEL(x)
-# endif
-
-# if !defined(USE_MARK_BITS) && !defined(USE_MARK_BYTES)
-#   if defined(THREADS) && defined(PARALLEL_MARK)
-#     define USE_MARK_BYTES
-#   else
-#     define USE_MARK_BITS
-#   endif
-# endif
-
-# if defined(MSWINCE) && !defined(__CEGCC__) && !defined(NO_GETENV)
-#   define NO_GETENV
+#   define USE_MARK_BITS
 # endif
+#endif
 
-# if (defined(NO_GETENV) || defined(MSWINCE)) && !defined(NO_GETENV_WIN32)
-#   define NO_GETENV_WIN32
-# endif
+#if defined(MSWINCE) && !defined(__CEGCC__) && !defined(NO_GETENV)
+# define NO_GETENV
+#endif
 
-# ifndef STRTOULL
-#   if defined(_WIN64) && !defined(__GNUC__)
-#     define STRTOULL _strtoui64
-#   elif defined(_LLP64) || defined(__LLP64__) || defined(_WIN64)
-#     define STRTOULL strtoull
-#   else
-        /* strtoul() fits since sizeof(long) >= sizeof(word).           */
-#     define STRTOULL strtoul
-#   endif
-# endif
+#if (defined(NO_GETENV) || defined(MSWINCE)) && !defined(NO_GETENV_WIN32)
+# define NO_GETENV_WIN32
+#endif
 
-# if defined(SPARC)
-#   define ASM_CLEAR_CODE       /* Stack clearing is crucial, and we    */
-                                /* include assembly code to do it well. */
+#ifndef STRTOULL
+# if defined(_WIN64) && !defined(__GNUC__)
+#   define STRTOULL _strtoui64
+# elif defined(_LLP64) || defined(__LLP64__) || defined(_WIN64)
+#   define STRTOULL strtoull
+# else
+    /* strtoul() fits since sizeof(long) >= sizeof(word).       */
+#   define STRTOULL strtoul
 # endif
+#endif
 
-  /* Can we save call chain in objects for debugging?                   */
-  /* SET NFRAMES (# of saved frames) and NARGS (#of args for each       */
-  /* frame) to reasonable values for the platform.                      */
-  /* Set SAVE_CALL_CHAIN if we can.  SAVE_CALL_COUNT can be specified   */
-  /* at build time, though we feel free to adjust it slightly.          */
-  /* Define NEED_CALLINFO if we either save the call stack or           */
-  /* GC_ADD_CALLER is defined.                                          */
-  /* GC_CAN_SAVE_CALL_STACKS is set in gc.h.                            */
+#if defined(SPARC)
+# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we    */
+                        /* include assembly code to do it well. */
+#endif
 
+/* Can we save call chain in objects for debugging?                     */
+/* SET NFRAMES (# of saved frames) and NARGS (#of args for each         */
+/* frame) to reasonable values for the platform.                        */
+/* Set SAVE_CALL_CHAIN if we can.  SAVE_CALL_COUNT can be specified     */
+/* at build time, though we feel free to adjust it slightly.            */
+/* Define NEED_CALLINFO if we either save the call stack or             */
+/* GC_ADD_CALLER is defined.                                            */
+/* GC_CAN_SAVE_CALL_STACKS is set in gc.h.                              */
 #if defined(SPARC)
 # define CAN_SAVE_CALL_ARGS
 #endif
-#if (defined(I386) || defined(X86_64)) && (defined(LINUX) || defined(__GLIBC__))
-            /* SAVE_CALL_CHAIN is supported if the code is compiled to save     */
-            /* frame pointers by default, i.e. no -fomit-frame-pointer flag.    */
+#if (defined(I386) || defined(X86_64)) \
+    && (defined(LINUX) || defined(__GLIBC__))
+  /* SAVE_CALL_CHAIN is supported if the code is compiled to save       */
+  /* frame pointers by default, i.e. no -fomit-frame-pointer flag.      */
 # define CAN_SAVE_CALL_ARGS
 #endif
 
-# if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
-             && defined(GC_CAN_SAVE_CALL_STACKS)
-#   define SAVE_CALL_CHAIN
-# endif
-# ifdef SAVE_CALL_CHAIN
-#   if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
-#     define NARGS SAVE_CALL_NARGS
-#   else
-#     define NARGS 0    /* Number of arguments to save for each call.   */
-#   endif
-# endif
-# ifdef SAVE_CALL_CHAIN
-#   ifndef SAVE_CALL_COUNT
-#     define NFRAMES 6  /* Number of frames to save. Even for           */
-                        /* alignment reasons.                           */
-#   else
-#     define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
-#   endif
-#   define NEED_CALLINFO
-# endif /* SAVE_CALL_CHAIN */
-# ifdef GC_ADD_CALLER
-#   define NFRAMES 1
-#   define NARGS 0
-#   define NEED_CALLINFO
+#if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
+    && defined(GC_CAN_SAVE_CALL_STACKS)
+# define SAVE_CALL_CHAIN
+#endif
+#ifdef SAVE_CALL_CHAIN
+# if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
+#   define NARGS SAVE_CALL_NARGS
+# else
+#   define NARGS 0      /* Number of arguments to save for each call.   */
 # endif
+#endif
+#ifdef SAVE_CALL_CHAIN
+# ifndef SAVE_CALL_COUNT
+#   define NFRAMES 6    /* Number of frames to save. Even for   */
+                        /* alignment reasons.                   */
+# else
+#   define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
+# endif
+# define NEED_CALLINFO
+#endif /* SAVE_CALL_CHAIN */
+#ifdef GC_ADD_CALLER
+# define NFRAMES 1
+# define NARGS 0
+# define NEED_CALLINFO
+#endif
 
-# if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
-#   define DBG_HDRS_ALL
-# endif
+#if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
+# define DBG_HDRS_ALL
+#endif
 
-# if defined(POINTER_MASK) && !defined(POINTER_SHIFT)
-#   define POINTER_SHIFT 0
-# endif
+#if defined(POINTER_MASK) && !defined(POINTER_SHIFT)
+# define POINTER_SHIFT 0
+#endif
 
-# if defined(POINTER_SHIFT) && !defined(POINTER_MASK)
-#   define POINTER_MASK ((GC_word)(-1))
-# endif
+#if defined(POINTER_SHIFT) && !defined(POINTER_MASK)
+# define POINTER_MASK ((GC_word)(-1))
+#endif
 
-# if !defined(FIXUP_POINTER) && defined(POINTER_MASK)
-#   define FIXUP_POINTER(p) (p = ((p) & POINTER_MASK) << POINTER_SHIFT)
-# endif
+#if !defined(FIXUP_POINTER) && defined(POINTER_MASK)
+# define FIXUP_POINTER(p) (p = ((p) & POINTER_MASK) << POINTER_SHIFT)
+#endif
 
-# if defined(FIXUP_POINTER)
-#   define NEED_FIXUP_POINTER 1
-# else
-#   define NEED_FIXUP_POINTER 0
-#   define FIXUP_POINTER(p)
-# endif
+#if defined(FIXUP_POINTER)
+# define NEED_FIXUP_POINTER 1
+#else
+# define NEED_FIXUP_POINTER 0
+# define FIXUP_POINTER(p)
+#endif
 
-# if !defined(MARK_BIT_PER_GRANULE) && !defined(MARK_BIT_PER_OBJ)
-#   define MARK_BIT_PER_GRANULE /* Usually faster */
-# endif
+#if !defined(MARK_BIT_PER_GRANULE) && !defined(MARK_BIT_PER_OBJ)
+# define MARK_BIT_PER_GRANULE   /* Usually faster       */
+#endif
 
 /* Some static sanity tests.    */
-# if defined(MARK_BIT_PER_GRANULE) && defined(MARK_BIT_PER_OBJ)
-#   error Define only one of MARK_BIT_PER_GRANULE and MARK_BIT_PER_OBJ.
-# endif
+#if defined(MARK_BIT_PER_GRANULE) && defined(MARK_BIT_PER_OBJ)
+# error Define only one of MARK_BIT_PER_GRANULE and MARK_BIT_PER_OBJ.
+#endif
 
-# if defined(STACK_GROWS_UP) && defined(STACK_GROWS_DOWN)
-#   error "Only one of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd."
-# endif
-# if !defined(STACK_GROWS_UP) && !defined(STACK_GROWS_DOWN)
-#   error "One of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd."
-# endif
+#if defined(STACK_GROWS_UP) && defined(STACK_GROWS_DOWN)
+# error "Only one of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd."
+#endif
+#if !defined(STACK_GROWS_UP) && !defined(STACK_GROWS_DOWN)
+# error "One of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd."
+#endif
 
-# if defined(REDIRECT_MALLOC) && defined(THREADS) && !defined(LINUX)
-#   error "REDIRECT_MALLOC with THREADS works at most on Linux."
-# endif
+#if defined(REDIRECT_MALLOC) && defined(THREADS) && !defined(LINUX)
+# error "REDIRECT_MALLOC with THREADS works at most on Linux."
+#endif
 
 #ifdef GC_PRIVATE_H
         /* This relies on some type definitions from gc_priv.h, from    */
index 73fa8feef41c0ca4ca509b716fddb59b5cf0b1e3..2b16bd56642d9cbcfd80632d741485e3277cecfc 100644 (file)
@@ -53,7 +53,7 @@ typedef struct GC_Thread_Rep {
     struct thread_stop_info stop_info;
 
     unsigned char flags;
-#       define FINISHED 1       /* Thread has exited.   */
+#       define FINISHED 1       /* Thread has exited.                   */
 #       define DETACHED 2       /* Thread is treated as detached.       */
                                 /* Thread may really be detached, or    */
                                 /* it may have have been explicitly     */
@@ -62,7 +62,10 @@ typedef struct GC_Thread_Rep {
                                 /* it unregisters itself, since it      */
                                 /* may not return a GC pointer.         */
 #       define MAIN_THREAD 4    /* True for the original thread only.   */
-#       define DISABLED_GC 8    /* Collections are disabled while the   */
+#       define SUSPENDED_EXT 8  /* Thread was suspended externally      */
+                                /* (this is not used by the unmodified  */
+                                /* GC itself at present).               */
+#       define DISABLED_GC 0x10 /* Collections are disabled while the   */
                                 /* thread is exiting.                   */
 
     unsigned char thread_blocked;
index 9fa42a5bfddf48e8711f70fcdee1648c13651123..eed14b8f9ddc22542b243ca9ab426654f8d7e0a8 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -2257,13 +2257,18 @@ void * os2_alloc(size_t bytes)
   GC_API void GC_CALL GC_win32_free_heap(void)
   {
 #   ifndef CYGWIN32
-      if (GC_no_win32_dlls) {
-        while (GC_n_heap_bases > 0) {
-          GlobalFree (GC_heap_bases[--GC_n_heap_bases]);
-          GC_heap_bases[GC_n_heap_bases] = 0;
-        }
-      }
+      if (GC_no_win32_dlls)
 #   endif
+    {
+      while (GC_n_heap_bases-- > 0) {
+#       ifdef CYGWIN32
+          /* FIXME: Is it ok to use non-GC free() here? */
+#       else
+          GlobalFree(GC_heap_bases[GC_n_heap_bases]);
+#       endif
+        GC_heap_bases[GC_n_heap_bases] = 0;
+      }
+    }
   }
 #endif /* MSWIN32 || CYGWIN32 */