This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[boehm-gc] Import 6.3 alpha 1


I've merged the current boehm-gc release into the GCC tree.  This release
improves support for darwin and mingw/cygwin (among other things; these
targets happen to be significant to gcj and poorly supported in releases
up to and including 3.3).  The actual diff is quite large and boring, so
I've omitted it from this message.

The old configure.in, Makefile.am etc. have been preserved as closely as
possible.  Using the upstream versions isn't currently an option as they
are based on the latest auto* tools.

Tested on i686-pc-linux-gnu and sparc-sun-solaris2.8.  Darwin and Win32
testing would be very welcome.

I've noted the significant remaining divergences in gcc/boehm-gc below,
along with any relevant ChangeLog entries I could find.  Most of these are
likely bogus, though one is recent.

Hans, I wonder if you ever saw Richard's gc_locks.h patch to use ia64
builtins:

http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01809.html

which may be a good candidate to merge upstream.

Also the definition of GET_MEM for AMIGA in 6.3alpha1 seems to be missing
a '#' though it is correct in the local tree.

Jeff

ChangeLog entries of local changes:

2003-03-22  Richard Henderson  <rth@redhat.com>

        * include/private/gc_locks.h [IA64]: Include ia64intrin.h.
        (GC_test_and_set): Use __sync_lock_test_and_set.
        (GC_clear): Use volatile assignment.
        (GC_compare_and_exchange): Use __sync_bool_compare_and_swap.
        (GC_memory_write_barrier): Use __sync_synchronize.

2002-03-21  Loren J. Rittle  <ljrittle@acm.org>

        * os_dep.c: Do not include <machine/trap.h> unless available.

2001-10-22  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

        * include/gc.h (GC_init): Declare here. Add description.

Tue May 12 13:15:45 1998  Tom Tromey  <tromey@cygnus.com>

        * alloc.c: Don't call GET_TIME if NO_CLOCK defined.

Local diffs:

diff -ur /home/jsturm/gc6.3alpha1/alloc.c ./alloc.c
--- /home/jsturm/gc6.3alpha1/alloc.c	Tue May  6 17:18:36 2003
+++ ./alloc.c	Sun Jul 27 01:28:26 2003
@@ -126,6 +126,7 @@
     unsigned long time_diff;

     if ((count++ & 3) != 0) return(0);
+#ifndef NO_CLOCK
     GET_TIME(current_time);
     time_diff = MS_TIME_DIFF(current_time,GC_start_time);
     if (time_diff >= GC_time_limit) {
@@ -138,6 +139,7 @@
 #	endif
     	return(1);
     }
+#endif
     return(0);
   }
 #endif /* !SMALL_CONFIG */
diff -ur /home/jsturm/gc6.3alpha1/configure.in ./configure.in
--- /home/jsturm/gc6.3alpha1/configure.in	Sat Jul 26 22:22:13 2003
+++ ./configure.in	Sun Jul 27 01:28:26 2003
@@ -248,7 +248,7 @@
 AC_MSG_CHECKING(which machine-dependent code should be used)
 machdep=
 case "$host" in
- alpha-*-openbsd*)
+ alpha*-*-openbsd*)
     machdep="alpha_mach_dep.lo"
     if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
        AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
diff -ur /home/jsturm/gc6.3alpha1/include/gc.h ./include/gc.h
--- /home/jsturm/gc6.3alpha1/include/gc.h	Sat Jul  5 15:46:09 2003
+++ ./include/gc.h	Sun Jul 27 01:28:27 2003
@@ -218,6 +218,15 @@
 				/* Interferes with blacklisting.	*/
 				/* Wizards only.			*/

+/* Public procedures */
+
+/* Initialize the collector.  This is only required when using thread-local
+ * allocation, since unlike the regular allocation routines, GC_local_malloc
+ * is not self-initializing.  If you use GC_local_malloc you should arrange
+ * to call this somehow (e.g. from a constructor) before doing any allocation.
+ */
+GC_API void GC_init GC_PROTO((void));
+
 GC_API unsigned long GC_time_limit;
 				/* If incremental collection is enabled, */
 				/* We try to terminate collections	 */
diff -ur /home/jsturm/gc6.3alpha1/include/private/gc_locks.h ./include/private/gc_locks.h
--- /home/jsturm/gc6.3alpha1/include/private/gc_locks.h	Mon Jul 21 21:27:51 2003
+++ ./include/private/gc_locks.h	Sun Jul 27 01:46:53 2003
@@ -100,17 +100,13 @@
 #      define GC_TEST_AND_SET_DEFINED
 #    endif
 #    if defined(IA64)
+#     include <ia64intrin.h>
        inline static int GC_test_and_set(volatile unsigned int *addr) {
-	  long oldval, n = 1;
-	  __asm__ __volatile__("xchg4 %0=%1,%2"
-		: "=r"(oldval), "=m"(*addr)
-		: "r"(n), "1"(*addr) : "memory");
-	  return oldval;
+	  return __sync_lock_test_and_set(addr, 1);
        }
 #      define GC_TEST_AND_SET_DEFINED
-       /* Should this handle post-increment addressing?? */
        inline static void GC_clear(volatile unsigned int *addr) {
-	 __asm__ __volatile__("st4.rel %0=r0" : "=m" (*addr) : : "memory");
+	  *addr = 0;
        }
 #      define GC_CLEAR_DEFINED
 #    endif
@@ -412,20 +408,17 @@
 #     if defined(IA64)
 #      if !defined(GENERIC_COMPARE_AND_SWAP)
          inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,
-						       GC_word old, GC_word new_val)
+						       GC_word old,
+						       GC_word new_val)
 	 {
-	  unsigned long oldval;
-	  __asm__ __volatile__("mov ar.ccv=%4 ;; cmpxchg8.rel %0=%1,%2,ar.ccv"
-		: "=r"(oldval), "=m"(*addr)
-		: "r"(new_val), "1"(*addr), "r"(old) : "memory");
-	  return (oldval == old);
+	   return __sync_bool_compare_and_swap (addr, old, new_val);
          }
 #      endif /* !GENERIC_COMPARE_AND_SWAP */
 #      if 0
 	/* Shouldn't be needed; we use volatile stores instead. */
         inline static void GC_memory_barrier()
         {
-          __asm__ __volatile__("mf" : : : "memory");
+          __sync_synchronize ();
         }
 #      endif /* 0 */
 #     endif /* IA64 */
diff -ur /home/jsturm/gc6.3alpha1/include/private/gcconfig.h ./include/private/gcconfig.h
--- /home/jsturm/gc6.3alpha1/include/private/gcconfig.h	Fri Jun 27 13:51:18 2003
+++ ./include/private/gcconfig.h	Sun Jul 27 01:52:25 2003
@@ -115,8 +115,8 @@
 #    if defined(nec_ews) || defined(_nec_ews)
 #      define EWS4800
 #    endif
-#    if !defined(LINUX) && !defined(EWS4800)
-#      if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
+#    if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
+#      if defined(ultrix) || defined(__ultrix)
 #	 define ULTRIX
 #      else
 #	 if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
@@ -127,9 +127,6 @@
 #	 endif
 #      endif
 #    endif /* !LINUX */
-#    if defined(__NetBSD__) && defined(__MIPSEL__)
-#      undef ULTRIX
-#    endif
 #    define mach_type_known
 # endif
 # if defined(DGUX) && (defined(i386) || defined(__i386__))
@@ -496,6 +493,9 @@
  * DATAEND, if not `end' where `end' is defined as ``extern int end[];''.
  * RTH suggests gaining access to linker script synth'd values with
  * this idiom instead of `&end' where `end' is defined as ``extern int end;'' .
+ * Otherwise, ``GCC will assume these are in .sdata/.sbss'' and it will, e.g.,
+ * cause failures on alpha*-*-* with ``-msmall-data or -fpic'' or mips-*-*
+ * without any special options.
  *
  * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
  * the pointer size.
@@ -1325,10 +1325,8 @@
 #       define DATAEND /* not needed */
 #   endif
 #   if defined(NETBSD)
-      /* This also checked for __MIPSEL__ .  Why?  NETBSD recognition	*/
-      /* should be handled at the top of the file.			*/
-#     define ALIGNMENT 4
 #     define OS_TYPE "NETBSD"
+#     define ALIGNMENT 4
 #     define HEURISTIC2
 #     define USE_GENERIC_PUSH_REGS
 #     ifdef __ELF__
@@ -2106,7 +2104,7 @@
 #	    else
 #	      if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
 			extern void *GC_amiga_get_mem(size_t size);
-			define GET_MEM(bytes) HBLKPTR((size_t) \
+#			define GET_MEM(bytes) HBLKPTR((size_t) \
 			  GC_amiga_get_mem((size_t)bytes + GC_page_size) \
 			  + GC_page_size-1)
 #	      else
diff -ur /home/jsturm/gc6.3alpha1/os_dep.c ./os_dep.c
--- /home/jsturm/gc6.3alpha1/os_dep.c	Fri Jun 13 15:11:00 2003
+++ ./os_dep.c	Sun Jul 27 01:58:02 2003
@@ -91,6 +91,10 @@
 #   include <setjmp.h>
 #endif

+#if defined(FREEBSD) && defined(I386)
+#  include <machine/trap.h>
+#endif
+
 #ifdef AMIGA
 # define GC_AMIGA_DEF
 # include "AmigaOS.c"
@@ -786,31 +790,31 @@
     ptr_t p;
     GC_bool up;
     {
-        static VOLATILE ptr_t result;
-    		/* Needs to be static, since otherwise it may not be	*/
-    		/* preserved across the longjmp.  Can safely be 	*/
-    		/* static since it's only called once, with the		*/
-    		/* allocation lock held.				*/
-
-
-	GC_setup_temporary_fault_handler();
-	if (setjmp(GC_jmp_buf) == 0) {
-	    result = (ptr_t)(((word)(p))
-			      & ~(MIN_PAGE_SIZE-1));
-	    for (;;) {
- 	        if (up) {
-		    result += MIN_PAGE_SIZE;
- 	        } else {
-		    result -= MIN_PAGE_SIZE;
- 	        }
-		GC_noop1((word)(*result));
-	    }
-	}
-	GC_reset_fault_handler();
- 	if (!up) {
+      static VOLATILE ptr_t result;
+  		/* Needs to be static, since otherwise it may not be	*/
+  		/* preserved across the longjmp.  Can safely be 	*/
+  		/* static since it's only called once, with the		*/
+  		/* allocation lock held.				*/
+
+
+      GC_setup_temporary_fault_handler();
+      if (setjmp(GC_jmp_buf) == 0) {
+	result = (ptr_t)(((word)(p))
+			 & ~(MIN_PAGE_SIZE-1));
+	for (;;) {
+	  if (up) {
 	    result += MIN_PAGE_SIZE;
- 	}
-	return(result);
+	  } else {
+	    result -= MIN_PAGE_SIZE;
+	  }
+	  GC_noop1((word)(*result));
+	}
+      }
+      GC_reset_fault_handler();
+      if (!up) {
+	result += MIN_PAGE_SIZE;
+      }
+      return(result);
     }
 # endif



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]