Author: yamakenz
Date: Wed Jul 18 00:53:03 2007
New Revision: 4738

Modified:
   libgcroots-trunk/Makefile.am
   libgcroots-trunk/configure.ac
   libgcroots-trunk/include/gc.h
   libgcroots-trunk/include/gc_config_macros.h
   libgcroots-trunk/include/gc_mark.h
   libgcroots-trunk/include/private/gc_hdrs.h
   libgcroots-trunk/include/private/gc_locks.h
   libgcroots-trunk/include/private/gc_priv.h
   libgcroots-trunk/include/private/gcconfig.h
   libgcroots-trunk/mach_dep.c
   libgcroots-trunk/mark.c
   libgcroots-trunk/sparc_mach_dep.S

Log:
* Merge diffs between gc7.0alpha7 and gc-7.0

* mach_dep.c
  - (GC_push_regs_and_stack): Merge gc-7.0
  - (GC_with_callee_saves_pushed):
    * Ditto
    * Replace HAVE_GETCONTEXT with (!defined(DARWIN) && !defined(ARM32)) as
      original source does, to disable broken getcontext() on cross build
* mark.c
  - Merge gc-7.0, but no actual changes
* include/gc.h
* include/gc_mark.h
* include/gc_config_macros.h
* include/private/gcconfig.h
* include/private/gc_priv.h
* include/private/gc_hdrs.h
* include/private/gc_locks.h
* sparc_mach_dep.S
* Makefile.am
  - Merge gc-7.0
* configure.ac
  - Merge gc-7.0
  - AC_DEFINE(SMALL_CONFIG) to define GC_abort() as abort()


Modified: libgcroots-trunk/Makefile.am
==============================================================================
--- libgcroots-trunk/Makefile.am        (original)
+++ libgcroots-trunk/Makefile.am        Wed Jul 18 00:53:03 2007
@@ -61,12 +61,6 @@
 EXTRA_DIST += gcroots.pc.in
 pkgconfig_DATA = gcroots.pc
 
-#include include/include.am
-#include cord/cord.am
-#include tests/tests.am
-#include doc/doc.am
-
-
 # C Library
 # ---------
 
@@ -119,7 +113,7 @@
 # linuxthread semaphore functions get linked:
 #libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS)
 #libgc_la_DEPENDENCIES = @addobjs@
-#libgc_la_LDFLAGS = -version-info 1:2:0
+#libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:3:0 -no-undefined
 
 #EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \
 #    mips_sgi_mach_dep.s mips_ultrix_mach_dep.s \
@@ -143,8 +137,8 @@
 #lib_LTLIBRARIES += libgccpp.la
 #pkginclude_HEADERS += include/gc_cpp.h include/gc_allocator.h
 #libgccpp_la_SOURCES = gc_cpp.cc
-#libgccpp_la_LIBADD = $(THREADDLLIBS) $(UNWINDLIBS)
-#libgccpp_la_LDFLAGS = -version-info 1:2:0
+#libgccpp_la_LIBADD = $(top_builddir)/libgc.la
+#libgccpp_la_LDFLAGS = -version-info 1:3:0 -no-undefined
 #endif
 
 # FIXME: If Visual C++ users use Makefile.am, this should go into
@@ -211,7 +205,8 @@
 #EXTRA_DIST += BCC_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE \
 #    OS2_MAKEFILE PCR-Makefile digimars.mak EMX_MAKEFILE       \
 #    Makefile.direct Makefile.dj       Makefile.DLLs SMakefile.amiga \
-#    WCC_MAKEFILE
+#    WCC_MAKEFILE configure_atomic_ops.sh \
+#    NT_STATIC_THREADS_MAKEFILE NT_X64_STATIC_THREADS_MAKEFILE
 
 # files used by makefiles other than Makefile.am
 #
@@ -222,9 +217,11 @@
 #    Mac_files/datastart.c Mac_files/dataend.c \
 #    Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
 #    include/private/msvc_dbg.h msvc_dbg.c
-# :CHECK: If pc_excludes still around, re-add to EXTRA_DIST.
 EXTRA_DIST += mach_dep.c
 
+# The libatomic_ops library.  This is not ideal, since we pick up junk from
+# there.  The hard-coded version number should also go.
+#EXTRA_DIST += libatomic_ops-1.2
 
 # this is an auxiliary shell file used by Makefile and Makefile.direct
 #
@@ -258,3 +255,12 @@
        if test '$(top_srcdir)' != '$(top_builddir)'; then      \
            rm -f ChangeLog;                                    \
        fi
+
+#include include/include.am
+#include cord/cord.am
+#include tests/tests.am
+#include doc/doc.am
+# Putting these at the top causes cord to be built first, and not find libgc.a
+# on HP/UX.  There may be a better fix.
+
+

Modified: libgcroots-trunk/configure.ac
==============================================================================
--- libgcroots-trunk/configure.ac       (original)
+++ libgcroots-trunk/configure.ac       Wed Jul 18 00:53:03 2007
@@ -18,14 +18,14 @@
 # Initialization
 # ==============
 
-dnl AC_INIT(gc,7.0alpha7,[EMAIL PROTECTED]) 
+dnl AC_INIT(gc,7.0,[EMAIL PROTECTED]) 
 dnl     ## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)?
 dnl AC_CONFIG_SRCDIR(gcj_mlc.c)
 AC_INIT([gcroots], [0.2.0], [EMAIL PROTECTED], [libgcroots]) 
 AC_CONFIG_SRCDIR(include/private/gcroots_priv.h)
 AC_CANONICAL_TARGET 
 AC_PREREQ(2.60b)
-dnl AC_REVISION($Revision: 1.14 $)
+dnl AC_REVISION($Revision: 1.25 $)
 dnl GC_SET_VERSION
 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
 AM_MAINTAINER_MODE
@@ -162,6 +162,11 @@
        AC_DEFINE(THREAD_LOCAL_ALLOC)
        AC_DEFINE(USE_COMPILER_TLS)
        ;;
+     *-*-gnu*)
+       AC_DEFINE(GC_GNU_THREADS)
+       AC_DEFINE(_REENTRANT)
+       AC_DEFINE(THREAD_LOCAL_ALLOC)
+       ;;
      *-*-netbsd*)
        AC_MSG_WARN("Only on NetBSD 2.0 or later.")
        AC_DEFINE(GC_NETBSD_THREADS)
@@ -183,6 +188,7 @@
        ;;
      *-*-cygwin*)
        AC_DEFINE(GC_WIN32_THREADS)
+       AC_DEFINE(THREAD_LOCAL_ALLOC)
        win32_threads=true
        ;;
      *-*-darwin*)
@@ -256,6 +262,54 @@
       ;;
 esac
 
+# Darwin needs a few extra special tests to deal with variation in the
+# system headers.
+case "$host" in
+  powerpc*-*-darwin*)
+    AC_CHECK_MEMBER(ppc_thread_state_t.r0,
+      AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
+       [ppc_thread_state_t has field r0]),,
+      [#include <mach/thread_status.h>])
+    AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
+      AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
+       [ppc_thread_state_t has field __r0]),,
+      [#include <mach/thread_status.h>])
+    AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
+      AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
+       [ppc_thread_state64_t has field r0]),,
+      [#include <mach/thread_status.h>])
+    AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
+      AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
+       [ppc_thread_state64_t has field __r0]),,
+      [#include <mach/thread_status.h>])
+    ;;
+  i?86*-*-darwin*)
+    AC_CHECK_MEMBER(x86_thread_state32_t.eax,
+      AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
+       [x86_thread_state32_t has field eax]),,
+      [#include <sys/cdefs.h>
+      #include <mach/thread_status.h>])
+    AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
+      AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
+       [x86_thread_state32_t has field __eax]),,
+      [#include <sys/cdefs.h>
+      #include <mach/thread_status.h>])
+    ;;
+  x86_64-*-darwin*)
+    AC_CHECK_MEMBER(x86_thread_state64_t.rax,
+      AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
+       [x86_thread_state64_t has field rax]),,
+      [#include <sys/cdefs.h>
+      #include <mach/thread_status.h>])
+    AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
+      AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
+       [x86_thread_state64_t has field __rax]),,
+      [#include <sys/cdefs.h>
+      #include <mach/thread_status.h>])
+     ;;
+  *) ;;
+esac
+
 AC_MSG_CHECKING(for xlc)
 AC_TRY_COMPILE([],[
  #ifndef __xlC__
@@ -273,11 +327,19 @@
 # dyld calls anyway
 case "$host" in
   *-*-darwin*) ;;
-  *) 
+  *)
     AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
     ;;
 esac
 
+# extra LD Flags which are required for targets
+case "${host}" in
+  *-*-darwin*)
+    extra_ldflags_libgc=-Wl,-single_module
+    ;;
+esac
+AC_SUBST(extra_ldflags_libgc)
+
 AC_SUBST(EXTRA_TEST_LIBS)
 
 dnl target_all=libgc.la
@@ -362,7 +424,9 @@
     ;; 
  mips-*-*)
     machdep="mach_dep.lo"
-    AC_DEFINE(NO_EXECUTE_PERMISSION)
+    dnl AC_DEFINE(NO_EXECUTE_PERMISSION)
+    dnl This is now redundant, but it is also important for incremental GC
+    dnl performance under Irix.
     ;;
  # should be replaced with sparc_mach_dep.lo?
  sparc-*-netbsd*)
@@ -530,6 +594,10 @@
    AC_DEFINE(SMALL_CONFIG)
    AC_DEFINE(NO_DEBUGGING)
 fi
+
+dnl libgcroots always define SMALL_CONFIG to define GC_abort() as abort()
+dnl   -- YamaKen 2007-07-18
+AC_DEFINE(SMALL_CONFIG)
 
 
 dnl Debugging

Modified: libgcroots-trunk/include/gc.h
==============================================================================
--- libgcroots-trunk/include/gc.h       (original)
+++ libgcroots-trunk/include/gc.h       Wed Jul 18 00:53:03 2007
@@ -3,6 +3,7 @@
  * Copyright (c) 1991-1995 by Xerox Corporation.  All rights reserved.
  * Copyright 1996-1999 by Silicon Graphics.  All rights reserved.
  * Copyright 1999 by Hewlett-Packard Company.  All rights reserved.
+ * Copyright (C) 2007 Free Software Foundation, Inc
  *
  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
@@ -51,8 +52,8 @@
   /* Win64 isn't really supported yet, but this is the first step. And */
   /* it might cause error messages to show up in more plausible places.        
*/
   /* This needs basetsd.h, which is included by windows.h.             */
-  typedef ULONG_PTR GC_word;
-  typedef LONG_PTR GC_word;
+  typedef unsigned long long GC_word;
+  typedef long long GC_signed_word;
 #endif
 
 /* Public read-only variables */
@@ -113,6 +114,8 @@
                        /* it a bit safer to use non-topologically-     */
                        /* ordered finalization.  Default value is      */
                        /* determined by JAVA_FINALIZATION macro.       */
+                       /* Enables register_finalizer_unreachable to    */
+                       /* work correctly.                              */
 
 GC_API void (* GC_finalizer_notifier)(void);
                        /* Invoked by the collector when there are      */
@@ -469,7 +472,8 @@
 # endif
 #endif
 
-#if defined(_MSC_VER) && _MSC_VER >= 1200 /* version 12.0+ (MSVC 6.0+)  */
+#if defined(_MSC_VER) && _MSC_VER >= 1200 /* version 12.0+ (MSVC 6.0+)  */ \
+    && !defined(_AMD64_)
 # ifndef GC_HAVE_NO_BUILTIN_BACKTRACE
 #   define GC_HAVE_BUILTIN_BACKTRACE
 # endif
@@ -564,6 +568,8 @@
        GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
 #   define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
        GC_debug_register_finalizer_no_order(p, f, d, of, od)
+#   define GC_REGISTER_FINALIZER_UNREACHABLE(p, f, d, of, od) \
+       GC_debug_register_finalizer_unreachable(p, f, d, of, od)
 #   define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
 #   define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
 #   define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
@@ -587,6 +593,8 @@
        GC_register_finalizer_ignore_self(p, f, d, of, od)
 #   define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
        GC_register_finalizer_no_order(p, f, d, of, od)
+#   define GC_REGISTER_FINALIZER_UNREACHABLE(p, f, d, of, od) \
+       GC_register_finalizer_unreachable(p, f, d, of, od)
 #   define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
 #   define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
 #   define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
@@ -678,6 +686,28 @@
                (void * obj, GC_finalization_proc fn, void * cd,
                 GC_finalization_proc *ofn, void * *ocd);
 
+/* This is a special finalizer that is useful when an object's  */
+/* finalizer must be run when the object is known to be no      */
+/* longer reachable, not even from other finalizable objects.   */
+/* It behaves like "normal" finalization, except that the      */
+/* finalizer is not run while the object is reachable from     */
+/* other objects specifying unordered finalization.            */
+/* Effectively it allows an object referenced, possibly                */
+/* indirectly, from an unordered finalizable object to override */
+/* the unordered finalization request.                         */
+/* This can be used in combination with finalizer_no_order so   */
+/* as to release resources that must not be released while an   */
+/* object can still be brought back to life by other            */
+/* finalizers.                                                  */
+/* Only works if GC_java_finalization is set.  Probably only   */
+/* of interest when implementing a language that requires      */
+/* unordered finalization (e.g. Java, C#).                     */
+GC_API void GC_register_finalizer_unreachable
+                (void * obj, GC_finalization_proc fn, void * cd,
+                 GC_finalization_proc *ofn, void * *ocd);
+GC_API void GC_debug_register_finalizer_unreachable
+                (void * obj, GC_finalization_proc fn, void * cd,
+                 GC_finalization_proc *ofn, void * *ocd);
 
 /* The following routine may be used to break cycles between   */
 /* finalizable objects, thus causing cyclic finalizable                */
@@ -724,6 +754,15 @@
        /* the object containing link.  Explicitly deallocating */
        /* obj may or may not cause link to eventually be       */
        /* cleared.                                             */
+       /* This can be used to implement certain types of       */
+       /* weak pointers.  Note however that this generally     */
+       /* requires that thje allocation lock is held (see      */
+       /* GC_call_with_allock_lock() below) when the disguised */
+       /* pointer is accessed.  Otherwise a strong pointer     */
+       /* could be recreated between the time the collector    */
+       /* decides to reclaim the object and the link is        */
+       /* cleared.                                             */
+
 GC_API int GC_unregister_disappearing_link (void * * link);
        /* Returns 0 if link was not actually registered.       */
        /* Undoes a registration by either of the above two     */
@@ -740,6 +779,23 @@
        /* GC-finalize_on_demand is nonzero, it must be called  */
        /* explicitly.                                          */
 
+/* Explicitly tell the collector that an object is reachable   */
+/* at a particular program point.  This prevents the argument  */
+/* pointer from being optimized away, even it is otherwise no  */
+/* longer needed.  It should have no visible effect in the     */
+/* absence of finalizers or disappearing links.  But it may be */
+/* needed to prevent finalizers from running while the         */
+/* associated external resource is still in use.               */
+/* The function is sometimes called keep_alive in other                */
+/* settings.                                                   */
+# if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#   define GC_reachable_here(ptr) \
+    __asm__ volatile(" " : : "X"(ptr) : "memory");
+# else
+    GC_API void GC_noop1(GC_word x);
+#   define GC_reachable_here(ptr) GC_noop1((GC_word)(ptr));
+#endif
+
 /* GC_set_warn_proc can be used to redirect or filter warning messages.        
*/
 /* p may not be a NULL pointer.                                                
*/
 typedef void (*GC_warn_proc) (char *msg, GC_word arg);
@@ -925,7 +981,7 @@
 
 # if defined(PCR) || defined(GC_SOLARIS_THREADS) || \
      defined(GC_PTHREADS) || defined(GC_WIN32_THREADS)
-       /* Any flavor of threads except SRC_M3. */
+       /* Any flavor of threads.       */
 /* This returns a list of objects, linked through their first          */
 /* word.  Its use can greatly reduce lock contention problems, since   */
 /* the allocation lock can be acquired and released many fewer times.  */
@@ -936,7 +992,7 @@
                                        /* in returned list.            */
 extern void GC_thr_init(void); /* Needed for Solaris/X86 ??    */
 
-#endif /* THREADS && !SRC_M3 */
+#endif /* THREADS */
 
 /* Register a callback to control the scanning of dynamic libraries.
    When the GC scans the static data of a dynamic library, it will
@@ -948,9 +1004,19 @@
   (int (*callback)(const char *, void *, size_t));
 
 
-#if defined(GC_WIN32_THREADS) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
+#if defined(GC_WIN32_THREADS) && !defined(__CYGWIN32__) \
+       && !defined(__CYGWIN__) \
+       && !defined(GC_PTHREADS)
+
+#ifdef __cplusplus
+    }  /* Including windows.h in an extern "C" context no longer works. */
+#endif
+
 # include <windows.h>
 
+#ifdef __cplusplus
+    extern "C" {
+#endif
   /*
    * All threads must be created using GC_CreateThread or GC_beginthreadex,
    * or must explicitly call GC_register_my_thread,
@@ -971,17 +1037,26 @@
       DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
       LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );
 
+
+   GC_API uintptr_t GC_beginthreadex(
+     void *security, unsigned stack_size,
+     unsigned ( __stdcall *start_address )( void * ),
+     void *arglist, unsigned initflag, unsigned *thrdaddr);
+
+   GC_API void GC_endthreadex(unsigned retval);
+
+   GC_API void WINAPI GC_ExitThread(DWORD dwExitCode);
+
 # if defined(_WIN32_WCE)
   /*
    * win32_threads.c implements the real WinMain, which will start a new thread
    * to call GC_WinMain after initializing the garbage collector.
    */
-  int WINAPI GC_WinMain(
+  GC_API int WINAPI GC_WinMain(
       HINSTANCE hInstance,
       HINSTANCE hPrevInstance,
       LPWSTR lpCmdLine,
       int nCmdShow );
-
 #  ifndef GC_BUILD
 #    define WinMain GC_WinMain
 #  endif
@@ -996,6 +1071,7 @@
 # define ExitThread GC_ExitThread
 # define _beginthreadex GC_beginthreadex
 # define _endthreadex GC_endthreadex
+# define _beginthread { > "Please use _beginthreadex instead of _beginthread" 
< }
 
 #endif /* defined(GC_WIN32_THREADS)  && !cygwin */
 

Modified: libgcroots-trunk/include/gc_config_macros.h
==============================================================================
--- libgcroots-trunk/include/gc_config_macros.h (original)
+++ libgcroots-trunk/include/gc_config_macros.h Wed Jul 18 00:53:03 2007
@@ -44,7 +44,8 @@
                             || defined(GC_HPUX_THREADS) \
                             || defined(GC_AIX_THREADS) \
                             || defined(GC_LINUX_THREADS) \
-                            || defined(GC_NETBSD_THREADS))
+                            || defined(GC_NETBSD_THREADS) \
+                            || defined(GC_GNU_THREADS))
 # define _REENTRANT
        /* Better late than never.  This fails if system headers that   */
        /* depend on this were previously included.                     */
@@ -63,17 +64,24 @@
        defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
        defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \
         defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \
-        (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__))
+        (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) || \
+       defined(GC_GNU_THREADS)
 #   define GC_PTHREADS
 # endif
 
+#if defined(GC_WIN32_PTHREADS)
+#   define GC_WIN32_THREADS
+#   define GC_PTHREADS
+#endif
+
 #if defined(GC_THREADS) && !defined(GC_PTHREADS)
 # if defined(__linux__)
 #   define GC_LINUX_THREADS
 #   define GC_PTHREADS
 # endif
 # if !defined(__linux__) && (defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
-                         || defined(hppa) || defined(__HPPA))
+                         || defined(hppa) || defined(__HPPA)) \
+                        || (defined(__ia64) && defined(_HPUX_SOURCE))
 #   define GC_HPUX_THREADS
 #   define GC_PTHREADS
 # endif
@@ -90,8 +98,7 @@
 #   define GC_SOLARIS_THREADS
 #   define GC_PTHREADS
 # endif
-
-# if defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
+# if defined(__APPLE__) && defined(__MACH__)
 #   define GC_DARWIN_THREADS
 #   define GC_PTHREADS
 # endif
@@ -126,6 +133,12 @@
 # define __GC
 # ifndef _WIN32_WCE
 #   include <stddef.h>
+#   if defined(__MINGW32__)
+#     include <stdint.h>
+      /* We mention uintptr_t.                                     */
+      /* Perhaps this should be included in pure msft environments  */
+      /* as well?                                                  */
+#   endif
 # else /* ! _WIN32_WCE */
 /* Yet more kluges for WinCE */
 #   include <stdlib.h>         /* size_t is defined here */

Modified: libgcroots-trunk/include/gc_mark.h
==============================================================================
--- libgcroots-trunk/include/gc_mark.h  (original)
+++ libgcroots-trunk/include/gc_mark.h  Wed Jul 18 00:53:03 2007
@@ -157,18 +157,18 @@
 void ** GC_new_free_list_inner(void);
 
 /* Return a new kind, as specified. */
-int GC_new_kind(void **free_list, GC_word mark_descriptor_template,
+unsigned GC_new_kind(void **free_list, GC_word mark_descriptor_template,
                int add_size_to_descriptor, int clear_new_objects);
                /* The last two parameters must be zero or one. */
-int GC_new_kind_inner(void **free_list,
+unsigned GC_new_kind_inner(void **free_list,
                      GC_word mark_descriptor_template,
                      int add_size_to_descriptor,
                      int clear_new_objects);
 
 /* Return a new mark procedure identifier, suitable for use as */
 /* the first argument in GC_MAKE_PROC.                         */
-int GC_new_proc(GC_mark_proc);
-int GC_new_proc_inner(GC_mark_proc);
+unsigned GC_new_proc(GC_mark_proc);
+unsigned GC_new_proc_inner(GC_mark_proc);
 
 /* Allocate an object of a given kind.  Note that in multithreaded     */
 /* contexts, this is usually unsafe for kinds that have the descriptor */

Modified: libgcroots-trunk/include/private/gc_hdrs.h
==============================================================================
--- libgcroots-trunk/include/private/gc_hdrs.h  (original)
+++ libgcroots-trunk/include/private/gc_hdrs.h  Wed Jul 18 00:53:03 2007
@@ -198,9 +198,9 @@
                            
 /* Is the result a forwarding address to someplace closer to the       */
 /* beginning of the block or NIL?                                      */
-# define IS_FORWARDING_ADDR_OR_NIL(hhdr) ((unsigned long) (hhdr) <= MAX_JUMP)
+# define IS_FORWARDING_ADDR_OR_NIL(hhdr) ((size_t) (hhdr) <= MAX_JUMP)
 
 /* Get an HBLKSIZE aligned address closer to the beginning of the block */
 /* h.  Assumes hhdr == HDR(h) and IS_FORWARDING_ADDR(hhdr).            */
-# define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (unsigned long)(hhdr))
+# define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (size_t)(hhdr))
 # endif /*  GC_HEADERS_H */

Modified: libgcroots-trunk/include/private/gc_locks.h
==============================================================================
--- libgcroots-trunk/include/private/gc_locks.h (original)
+++ libgcroots-trunk/include/private/gc_locks.h Wed Jul 18 00:53:03 2007
@@ -23,13 +23,6 @@
  * Needed if there is more than one allocator thread.
  * DCL_LOCK_STATE declares any local variables needed by LOCK and UNLOCK.
  *
- * In the PARALLEL_MARK case, we also need to define a number of
- * other inline finctions here:
- *   GC_bool GC_compare_and_exchange( volatile GC_word *addr,
- *                                   GC_word old, GC_word new )
- *   GC_word GC_atomic_add( volatile GC_word *addr, GC_word how_much )
- *   void GC_memory_barrier( )
- *   
  * Note that I_HOLD_LOCK and I_DONT_HOLD_LOCK are used only positively
  * in assertions, and may return TRUE in the "dont know" case.
  */  
@@ -47,7 +40,7 @@
 #    define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
 #  endif
 
-#  if !defined(AO_HAVE_test_and_set_acquire)
+#  if !defined(AO_HAVE_test_and_set_acquire) && defined(GC_PTHREADS)
 #    define USE_PTHREAD_LOCKS
 #  endif
 
@@ -78,8 +71,39 @@
 #    define I_DONT_HOLD_LOCK() (!GC_need_to_lock \
                           || GC_lock_holder != GetCurrentThreadId())
 #  elif defined(GC_PTHREADS)
-#    define NO_THREAD (pthread_t)(-1)
 #    include <pthread.h>
+     
+     /* Posix allows pthread_t to be a struct, though it rarely is.    */
+     /* Unfortunately, we need to use a pthread_t to index a data      */
+     /* structure.  It also helps if comparisons don't involve a       */
+     /* function call.  Hence we introduce platform-dependent macros   */
+     /* to compare pthread_t ids and to map them to integers.          */
+     /* the mapping to integers does not need to result in different   */
+     /* integers for each thread, though that should be true as much   */
+     /* as possible.                                                   */
+     /* Refine to exclude platforms on which pthread_t is struct */
+#    if !defined(GC_WIN32_PTHREADS)
+#      define NUMERIC_THREAD_ID(id) ((unsigned long)(id))
+#      define THREAD_EQUAL(id1, id2) ((id1) == (id2))
+#      define NUMERIC_THREAD_ID_UNIQUE
+#    else
+#      if defined(GC_WIN32_PTHREADS)
+#       define NUMERIC_THREAD_ID(id) ((unsigned long)(id.p))
+        /* Using documented internal details of win32_pthread library. */
+        /* Faster than pthread_equal(). Should not change with         */
+        /* future versions of win32_pthread library.                   */
+#       define THREAD_EQUAL(id1, id2) ((id1.p == id2.p) && (id1.x == id2.x))
+#        undef NUMERIC_THREAD_ID_UNIQUE
+#      else
+        /* Generic definitions that always work, but will result in    */
+        /* poor performance and weak assertion checking.               */
+#       define NUMERIC_THREAD_ID(id) 1l
+#       define THREAD_EQUAL(id1, id2) pthread_equal(id1, id2)
+#        undef NUMERIC_THREAD_ID_UNIQUE
+#      endif
+#    endif
+#    define NO_THREAD (-1l)
+               /* != NUMERIC_THREAD_ID(pthread_self()) for any thread */
 
 #    if !defined(THREAD_LOCAL_ALLOC) && !defined(USE_PTHREAD_LOCKS)
       /* In the THREAD_LOCAL_ALLOC case, the allocation lock tends to  */
@@ -131,19 +155,26 @@
 #        define UNCOND_UNLOCK() pthread_mutex_unlock(&GC_allocate_ml)
 #      endif /* !GC_ASSERTIONS */
 #    endif /* USE_PTHREAD_LOCKS */
-#    define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
+#    define SET_LOCK_HOLDER() \
+               GC_lock_holder = NUMERIC_THREAD_ID(pthread_self())
 #    define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
-#    define I_HOLD_LOCK() (!GC_need_to_lock \
-                          || pthread_equal(GC_lock_holder, pthread_self()))
-#    define I_DONT_HOLD_LOCK() (!GC_need_to_lock \
-                          || !pthread_equal(GC_lock_holder, pthread_self()))
+#    define I_HOLD_LOCK() \
+               (!GC_need_to_lock || \
+                GC_lock_holder == NUMERIC_THREAD_ID(pthread_self()))
+#    ifndef NUMERIC_THREAD_ID_UNIQUE
+#      define I_DONT_HOLD_LOCK() 1  /* Conservatively say yes */
+#    else
+#      define I_DONT_HOLD_LOCK() \
+               (!GC_need_to_lock \
+                || GC_lock_holder != NUMERIC_THREAD_ID(pthread_self()))
+#    endif
      extern volatile GC_bool GC_collecting;
 #    define ENTER_GC() GC_collecting = 1;
 #    define EXIT_GC() GC_collecting = 0;
      extern void GC_lock(void);
-     extern pthread_t GC_lock_holder;
+     extern unsigned long GC_lock_holder;
 #    ifdef GC_ASSERTIONS
-      extern pthread_t GC_mark_lock_holder;
+      extern unsigned long GC_mark_lock_holder;
 #    endif
 #  endif /* GC_PTHREADS with linux_threads.c implementation */
 

Modified: libgcroots-trunk/include/private/gc_priv.h
==============================================================================
--- libgcroots-trunk/include/private/gc_priv.h  (original)
+++ libgcroots-trunk/include/private/gc_priv.h  Wed Jul 18 00:53:03 2007
@@ -36,6 +36,10 @@
 #   include <sys/resource.h>
 #endif /* BSD_TIME */
 
+#ifdef PARALLEL_MARK
+#   define AO_REQUIRE_CAS
+#endif
+
 #ifndef _GC_H
 #   include "../gc.h"
 #endif
@@ -363,6 +367,54 @@
 #   define GETENV(name) 0
 #endif
 
+#if defined(DARWIN)
+#      if defined(POWERPC)
+#              if CPP_WORDSZ == 32
+#                 define GC_THREAD_STATE_T ppc_thread_state_t
+#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE
+#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
+#                define GC_MACH_HEADER mach_header
+#                define GC_MACH_SECTION section
+#              else
+#                 define GC_THREAD_STATE_T ppc_thread_state64_t
+#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
+#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
+#                define GC_MACH_HEADER mach_header_64
+#                define GC_MACH_SECTION section_64
+#              endif
+#      elif defined(I386) || defined(X86_64)
+#               if CPP_WORDSZ == 32
+#                define GC_THREAD_STATE_T x86_thread_state32_t
+#                define GC_MACH_THREAD_STATE x86_THREAD_STATE32
+#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
+#                define GC_MACH_HEADER mach_header
+#                define GC_MACH_SECTION section
+#               else
+#                define GC_THREAD_STATE_T x86_thread_state64_t
+#                define GC_MACH_THREAD_STATE x86_THREAD_STATE64
+#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
+#                define GC_MACH_HEADER mach_header_64
+#                define GC_MACH_SECTION section_64
+#               endif
+#      else
+#              error define GC_THREAD_STATE_T
+#              define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
+#              define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
+#      endif
+/* Try to work out the right way to access thread state structure members.
+   The structure has changed its definition in different Darwin versions.
+   This now defaults to the (older) names without __, thus hopefully,
+   not breaking any existing Makefile.direct builds.  */
+#       if defined (HAS_PPC_THREAD_STATE___R0) \
+         || defined (HAS_PPC_THREAD_STATE64___R0) \
+         || defined (HAS_X86_THREAD_STATE32___EAX) \
+         || defined (HAS_X86_THREAD_STATE64___RAX)
+#         define THREAD_FLD(x) __ ## x
+#       else
+#         define THREAD_FLD(x) x
+#       endif
+#endif
+
 /*********************************/
 /*                               */
 /* Word-size-dependent defines   */
@@ -501,7 +553,7 @@
  
 # define HBLKPTR(objptr) ((struct hblk *)(((word) (objptr)) & ~(HBLKSIZE-1)))
 
-# define HBLKDISPL(objptr) (((word) (objptr)) & (HBLKSIZE-1))
+# define HBLKDISPL(objptr) (((size_t) (objptr)) & (HBLKSIZE-1))
 
 /* Round up byte allocation requests to integral number of words, etc. */
 # define ROUNDED_UP_WORDS(n) \
@@ -856,7 +908,7 @@
     word _unmapped_bytes;
 # endif
 
-    unsigned _size_map[MAXOBJBYTES+1];
+    size_t _size_map[MAXOBJBYTES+1];
        /* Number of words to allocate for a given allocation request in */
        /* bytes.                                                        */
 
@@ -1080,7 +1132,7 @@
 #   define IS_UNCOLLECTABLE(k) ((k) == UNCOLLECTABLE)
 # endif
 
-extern int GC_n_kinds;
+extern unsigned GC_n_kinds;
 
 GC_API word GC_fo_entries;
 
@@ -1189,7 +1241,7 @@
 #endif /* !USE_MARK_BYTES */
 
 #ifdef MARK_BIT_PER_OBJ
-#  define MARK_BIT_NO(offset, sz) ((offset)/(sz))
+#  define MARK_BIT_NO(offset, sz) (((unsigned)(offset))/(sz))
        /* Get the mark bit index corresponding to the given byte       */
        /* offset and size (in bytes).                                  */
 #  define MARK_BIT_OFFSET(sz) 1
@@ -1198,7 +1250,7 @@
 #  define FINAL_MARK_BIT(sz) ((sz) > MAXOBJBYTES? 1 : HBLK_OBJS(sz))
        /* Position of final, always set, mark bit.                     */
 #else /* MARK_BIT_PER_GRANULE */
-#  define MARK_BIT_NO(offset, sz) BYTES_TO_GRANULES(offset)
+#  define MARK_BIT_NO(offset, sz) BYTES_TO_GRANULES((unsigned)(offset))
 #  define MARK_BIT_OFFSET(sz) BYTES_TO_GRANULES(sz)
 #  define IF_PER_OBJ(x)
 #  define FINAL_MARK_BIT(sz) \
@@ -1490,7 +1542,7 @@
                                /* called explicitly without GC lock.   */
 
 struct hblk * GC_allochblk (size_t size_in_bytes, int kind,
-                           unsigned char flags);
+                           unsigned flags);
                                /* Allocate a heap block, inform        */
                                /* the marker that block is valid       */
                                /* for objects of indicated size.       */
@@ -1534,6 +1586,13 @@
 GC_bool GC_reclaim_all(GC_stop_func stop_func, GC_bool ignore_old);
                                /* Reclaim all blocks.  Abort (in a     */
                                /* consistent state) if f returns TRUE. */
+ptr_t GC_reclaim_generic(struct hblk * hbp, hdr *hhdr, size_t sz,
+                        GC_bool init, ptr_t list, signed_word *count);
+                               /* Rebuild free list in hbp with        */
+                               /* header hhdr, with objects of size sz */
+                               /* bytes.  Add list to the end of the   */
+                               /* free list.  Add the number of        */
+                               /* reclaimed bytes to *count.           */
 GC_bool GC_block_empty(hdr * hhdr);
                                /* Block completely unmarked?   */
 GC_bool GC_never_stop_func(void);
@@ -1946,7 +2005,7 @@
 #   define NEED_FIND_LIMIT
 # endif
 
-#if defined(FREEBSD) && (defined(I386) || defined(powerpc) \
+#if defined(FREEBSD) && (defined(I386) || defined(X86_64) || defined(powerpc) \
     || defined(__powerpc__))
 #  include <machine/trap.h>
 #  if !defined(PCR)

Modified: libgcroots-trunk/include/private/gcconfig.h
==============================================================================
--- libgcroots-trunk/include/private/gcconfig.h (original)
+++ libgcroots-trunk/include/private/gcconfig.h Wed Jul 18 00:53:03 2007
@@ -295,8 +295,10 @@
 #   if defined(__ppc__)  || defined(__ppc64__)
 #    define POWERPC
 #    define mach_type_known
-#   endif
-#   if defined(__i386__)
+#   elif defined(__x86_64__)
+#    define X86_64
+#    define mach_type_known
+#   elif defined(__i386__)
 #    define I386
 #    define mach_type_known
 #   endif
@@ -320,6 +322,10 @@
 #   define I386
 #   define mach_type_known
 # endif
+# if defined(FREEBSD) && defined(__x86_64__)
+#   define X86_64
+#   define mach_type_known
+# endif
 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
 #   define I386
 #   define mach_type_known
@@ -331,7 +337,7 @@
 # if defined(FREEBSD) && defined(__sparc__)
 #    define SPARC
 #    define mach_type_known
-#endif
+# endif
 # if defined(bsdi) && (defined(i386) || defined(__i386__))
 #    define I386
 #    define BSDI
@@ -368,8 +374,12 @@
 # else
 #   if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
         || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
-#     define I386
-#     define MSWIN32   /* or Win32s */
+#     if defined(__LP64__) || defined(_WIN64)
+#      define X86_64
+#     else
+#       define I386
+#     endif
+#     define MSWIN32   /* or Win64 */
 #     define mach_type_known
 #   endif
 #   if defined(_MSC_VER) && defined(_M_IA64)
@@ -460,7 +470,7 @@
 /* SYSV on an M68K actually means A/UX.                                        
*/
 /* The distinction in these cases is usually the stack starting address */
 # ifndef mach_type_known
-       --> unknown machine type
+#   error "The collector has not been ported to this machine/OS combination."
 # endif
                    /* Mapping is: M68K       ==> Motorola 680X0        */
                    /*             (NEXT, and SYSV (A/UX),              */
@@ -659,8 +669,8 @@
 #   endif
 #   ifdef LINUX
 #       define OS_TYPE "LINUX"
-#       define STACKBOTTOM ((ptr_t)0xf0000000)
-/* #       define MPROTECT_VDB - Reported to not work  9/17/01 */
+#       define LINUX_STACKBOTTOM
+#       define MPROTECT_VDB
 #       ifdef __ELF__
 #            define DYNAMIC_LOADING
 #           include <features.h>
@@ -742,24 +752,27 @@
 #     define DATAEND (_end)
 #   endif
 #   ifdef DARWIN
-#     ifdef __ppc64__
+#     define OS_TYPE "DARWIN"
+#     define DYNAMIC_LOADING
+#     if defined(__ppc64__)
 #       define ALIGNMENT 8
 #       define CPP_WORDSZ 64
+#       define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
+#       define CACHE_LINE_SIZE 64
+#       ifndef HBLKSIZE
+#         define HBLKSIZE 4096
+#       endif
 #     else
 #       define ALIGNMENT 4
+#       define STACKBOTTOM ((ptr_t) 0xc0000000)
 #     endif
-#     define OS_TYPE "DARWIN"
-#     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) */
+        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 USE_MMAP
 #     define USE_MMAP_ANON
 #     ifdef GC_DARWIN_THREADS
-       /* This is potentially buggy. It needs more testing. See the comments in
-          os_dep.c.  It relies on threads to track writes. */
 #       define MPROTECT_VDB
 #     endif
 #     include <unistd.h>
@@ -772,7 +785,7 @@
          __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 */
+        should be looked into some more */
 #     define NO_PTHREAD_TRYLOCK
 #   endif
 #   ifdef FREEBSD
@@ -979,8 +992,7 @@
 # ifdef I386
 #   define MACH_TYPE "I386"
 #   if defined(__LP64__) || defined(_WIN64)
-#     define CPP_WORDSZ 64
-#     define ALIGNMENT 8
+#     error This should be handled as X86_64
 #   else
 #     define CPP_WORDSZ 32
 #     define ALIGNMENT 4
@@ -1257,10 +1269,11 @@
 #     define OS_TYPE "HURD"
 #     define STACK_GROWS_DOWN
 #     define HEURISTIC2
-      extern int  __data_start[];
-#     define DATASTART ( (ptr_t) (__data_start))
-      extern int   _end[];
-#     define DATAEND ( (ptr_t) (_end))
+#     define SIG_SUSPEND SIGUSR1
+#     define SIG_THR_RESTART SIGUSR2
+#     define SEARCH_FOR_DATA_START
+      extern int _end[];
+#     define DATAEND ((ptr_t) (_end))
 /* #     define MPROTECT_VDB  Not quite working yet? */
 #     define DYNAMIC_LOADING
 #   endif
@@ -1269,21 +1282,19 @@
 #     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) */
+        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 USE_MMAP
 #     define USE_MMAP_ANON
-      /* This is potentially buggy. It needs more testing. See the comments in
-        os_dep.c.  It relies on threads to track writes. */
 #     ifdef GC_DARWIN_THREADS
-/* #       define MPROTECT_VDB -- disabled for now.  May work for some apps. */
+#       define MPROTECT_VDB
 #     endif
 #     include <unistd.h>
 #     define GETPAGESIZE() getpagesize()
       /* There seems to be some issues with trylock hanging on darwin. This
-         should be looked into some more */
+        should be looked into some more */
 #      define NO_PTHREAD_TRYLOCK
 #   endif /* DARWIN */
 # endif
@@ -1397,10 +1408,9 @@
 #    define OS_TYPE "NONSTOP"
 #    define ALIGNMENT 4
 #    define DATASTART ((ptr_t) 0x08000000)
-     extern int _end[];
-#    define DATAEND (_end)
+     extern char **environ;
+#    define DATAEND ((ptr_t)(environ - 0x10))
 #    define STACKBOTTOM ((ptr_t) 0x4fffffff)
-#    define USE_GENERIC_PUSH_REGS
 #   endif
 # endif
 
@@ -1418,9 +1428,6 @@
 #       define MPROTECT_VDB
 #     endif
 #   else
-#     define GENERIC_COMPARE_AND_SWAP
-       /* No compare-and-swap instruction.  Use pthread mutexes        */
-       /* when we absolutely have to.                                  */
 #     ifdef PARALLEL_MARK
 #      define USE_MARK_BYTES
                /* Minimize compare-and-swap usage.             */
@@ -1862,6 +1869,26 @@
 #          define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
 #      endif
 #   endif
+#   ifdef DARWIN
+#     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) */
+#     define DATASTART ((ptr_t) get_etext())
+#     define DATAEND   ((ptr_t) get_end())
+#     define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
+#     define USE_MMAP
+#     define USE_MMAP_ANON
+#     ifdef GC_DARWIN_THREADS
+#       define MPROTECT_VDB
+#     endif
+#     include <unistd.h>
+#     define GETPAGESIZE() getpagesize()
+      /* 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
 #      define OS_TYPE "FREEBSD"
 #      ifndef GC_FREEBSD_THREADS
@@ -1934,6 +1961,20 @@
 #        define HEAP_START DATAEND
 #       endif
 #   endif
+#   ifdef MSWIN32
+#      define OS_TYPE "MSWIN32"
+               /* STACKBOTTOM and DATASTART are handled specially in   */
+               /* os_dep.c.                                            */
+#       if !defined(__WATCOMC__)
+#        define MPROTECT_VDB
+         /* We also avoided doing this in the past with GC_WIN32_THREADS */
+         /* Hopefully that's fixed.                                      */
+#      endif
+#      if _MSC_VER >= 1300  /* .NET, i.e. > VisualStudio 6     */
+#         define GWW_VDB
+#      endif
+#       define DATAEND  /* not needed */
+#   endif
 # endif
 
 #if defined(LINUX) && defined(USE_MMAP)
@@ -2024,7 +2065,8 @@
 # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
            || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
            || defined(DGUX) || defined(BSD) \
-           || defined(AIX) || defined(DARWIN) || defined(OSF1)
+           || defined(AIX) || defined(DARWIN) || defined(OSF1) \
+           || defined(HURD)
 #   define UNIX_LIKE   /* Basic Unix-like system calls work.   */
 # endif
 
@@ -2042,12 +2084,6 @@
 #   define PCR_VDB
 # endif
 
-# ifdef SRC_M3
-       /* Postponed for now. */
-#   undef PROC_VDB
-#   undef MPROTECT_VDB
-# endif
-
 # ifdef SMALL_CONFIG
        /* Presumably not worth the space it takes. */
 #   undef PROC_VDB
@@ -2081,7 +2117,7 @@
 #   define CACHE_LINE_SIZE 32  /* Wild guess   */
 # endif
 
-# if defined(LINUX) || defined(__GLIBC__)
+# 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 */
@@ -2126,13 +2162,14 @@
 # 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)
        --> inconsistent configuration
 # endif
 
-# if defined(PCR) || defined(SRC_M3) || \
-               defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
-               defined(GC_PTHREADS)
+# if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS)
 #   define THREADS
 # endif
 
@@ -2224,8 +2261,20 @@
 #   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(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
 
 #ifdef GC_PRIVATE_H

Modified: libgcroots-trunk/mach_dep.c
==============================================================================
--- libgcroots-trunk/mach_dep.c (original)
+++ libgcroots-trunk/mach_dep.c Wed Jul 18 00:53:03 2007
@@ -175,10 +175,12 @@
 
 #   if defined(HAVE_PUSH_REGS)
       GC_push_regs();
-#   elif defined(UNIX_LIKE) && HAVE_GETCONTEXT
+#   elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32)
       /* Older versions of Darwin seem to lack getcontext(). */
+      /* ARM Linux often doesn't support a real getcontext(). */
       ucontext_t ctxt;
-      getcontext(&ctxt);
+      if (getcontext(&ctxt) < 0)
+       ABORT ("Getcontext failed: Use another register retrieval method?");
       context = &ctxt;
 #     if defined(SPARC) || defined(IA64)
         /* On a register window machine, we need to save register      */
@@ -225,8 +227,7 @@
     GC_noop1((word)(&dummy));
 }
 
-void GC_push_regs_and_stack(cold_gc_frame)
-ptr_t cold_gc_frame;
+void GC_push_regs_and_stack(ptr_t cold_gc_frame)
 {
     GC_with_callee_saves_pushed(GC_push_current_stack, cold_gc_frame);
 }

Modified: libgcroots-trunk/mark.c
==============================================================================
--- libgcroots-trunk/mark.c     (original)
+++ libgcroots-trunk/mark.c     Wed Jul 18 00:53:03 2007
@@ -21,6 +21,9 @@
  * 2006-12-23 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
  *            - Imported from mark.c of gc7.0alpha7
  *            - Remove all functions but GC_noop1()
+ * 2007-07-18 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
+ *            - Update to gc-7.0
+ *            - Keep all functions but GC_noop1() removed
  */
 
 # include "private/gcroots_priv.h"

Modified: libgcroots-trunk/sparc_mach_dep.S
==============================================================================
--- libgcroots-trunk/sparc_mach_dep.S   (original)
+++ libgcroots-trunk/sparc_mach_dep.S   Wed Jul 18 00:53:03 2007
@@ -25,7 +25,7 @@
 
 ! GCROOTS_clear_stack_inner(arg, limit) clears stack area up to limit and
 ! returns arg.  Stack clearing is crucial on SPARC, so we supply
-! an assembly version that's more careful.  Assumes limit is hotter
+! an assembly version that s more careful.  Assumes limit is hotter
 ! than sp, and limit is 8 byte aligned.        
        .globl  GCROOTS_clear_stack_inner
 GCROOTS_clear_stack_inner:

Reply via email to