Updated boehm to 7.2d

This commit is contained in:
Scott McCreary
2013-03-27 08:15:19 +00:00
parent d6b0f885a3
commit ce3ab9d62a
2 changed files with 281 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
DESCRIPTION="The Boehm-Demers-Weiser conservative garbage collector"
HOMEPAGE="http://www.hpl.hp.com/personal/Hans_Boehm/gc/"
SRC_URI="http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2d.tar.gz"
REVISION="1"
STATUS_HAIKU="stable"
DEPEND=""
CHECKSUM_MD5="91340b28c61753a789eb6077675d87d2"
BUILD {
cd gc-7.2
libtoolize --force --copy --install
autoconf -f
./configure --prefix=$(finddir B_COMMON_DIRECTORY) \
--datadir=$(finddir B_COMMON_DOCUMENTATION_DIRECTORY) \
--enable-threads=posix --enable-thread-local-alloc --enable-parallel-mark
make
}
INSTALL {
cd gc-7.2
make install
}
TEST {
cd gc-7.2
make check
}
LICENSE="BOEHM"
COPYRIGHT="1988, 1989 Hans-J. Boehm, Alan J. Demers
1991-1996 by Xerox Corporation. All rights reserved.
1996-1999 by Silicon Graphics. All rights reserved.
1999-2011 Hewlett-Packard Development Company, L.P."

View File

@@ -0,0 +1,248 @@
diff -urN gc-7.2/configure.ac gc-7.2-haiku/configure.ac
--- gc-7.2/configure.ac 2012-08-09 13:25:13.047185920 -0700
+++ gc-7.2-haiku/configure.ac 2013-03-27 00:43:42.665321472 -0700
@@ -89,6 +89,7 @@
AH_TEMPLATE([GC_DARWIN_THREADS], [Define to support Darwin pthreads.])
AH_TEMPLATE([GC_FREEBSD_THREADS], [Define to support FreeBSD pthreads.])
AH_TEMPLATE([GC_GNU_THREADS], [Define to support GNU pthreads.])
+AH_TEMPLATE([GC_HAIKU_THREADS], [Define to support Haiku pthreads.])
AH_TEMPLATE([GC_HPUX_THREADS], [Define to support HP/UX 11 pthreads.])
AH_TEMPLATE([GC_IRIX_THREADS], [Define to support Irix pthreads.])
AH_TEMPLATE([GC_LINUX_THREADS], [Define to support pthreads on Linux.])
@@ -140,6 +141,10 @@
AC_DEFINE(GC_AIX_THREADS)
AC_DEFINE(_REENTRANT)
;;
+ *-*-haiku*)
+ AC_DEFINE(GC_HAIKU_THREADS)
+ AC_DEFINE(_REENTRANT)
+ ;;
*-*-hpux11*)
AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.")
AC_DEFINE(GC_HPUX_THREADS)
diff -urN gc-7.2/dyn_load.c gc-7.2-haiku/dyn_load.c
--- gc-7.2/dyn_load.c 2012-08-09 13:25:13.034603008 -0700
+++ gc-7.2-haiku/dyn_load.c 2013-03-27 00:43:42.670564352 -0700
@@ -63,7 +63,7 @@
!(defined(FREEBSD) && defined(__ELF__)) && \
!(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) && \
!(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
- !defined(DARWIN) && !defined(CYGWIN32)
+ !defined(DARWIN) && !defined(CYGWIN32) && !defined(HAIKU)
--> We only know how to find data segments of dynamic libraries for the
--> above. Additional SVR4 variants might not be too
--> hard to add.
@@ -1426,6 +1426,22 @@
#endif /* DARWIN */
+#ifdef HAIKU
+#include <kernel/image.h>
+
+GC_INNER void GC_register_dynamic_libraries()
+{
+ image_info info;
+ int32 cookie = 0;
+ while (get_next_image_info(0, &cookie, &info) == B_OK)
+ {
+ void *data = info.data;
+ GC_add_roots_inner(data, data + info.data_size, TRUE);
+ }
+}
+
+#endif /* HAIKU */
+
#elif defined(PCR)
# include "il/PCR_IL.h"
diff -urN gc-7.2/include/gc_config_macros.h gc-7.2-haiku/include/gc_config_macros.h
--- gc-7.2/include/gc_config_macros.h 2012-08-09 13:25:13.028835840 -0700
+++ gc-7.2-haiku/include/gc_config_macros.h 2013-03-27 00:51:21.900726784 -0700
@@ -68,7 +68,8 @@
|| defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
|| defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \
|| defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \
- || defined(GC_WIN32_THREADS) || defined(GC_RTEMS_PTHREADS)
+ || defined(GC_WIN32_THREADS) || defined(GC_RTEMS_PTHREADS) \
+ || defined(GC_HAIKU_THREADS)
# ifndef GC_THREADS
# define GC_THREADS
# endif
diff -urN gc-7.2/include/private/config.h.in gc-7.2-haiku/include/private/config.h.in
--- gc-7.2/include/private/config.h.in 2012-08-09 13:25:13.029884416 -0700
+++ gc-7.2-haiku/include/private/config.h.in 2013-03-27 00:44:56.633602048 -0700
@@ -48,6 +48,9 @@
/* Define to support GNU pthreads. */
#undef GC_GNU_THREADS
+/* Define to support Haiku pthreads. */
+#undef GC_HAIKU_THREADS
+
/* Define if backtrace information is supported. */
#undef GC_HAVE_BUILTIN_BACKTRACE
diff -urN gc-7.2/include/private/gcconfig.h gc-7.2-haiku/include/private/gcconfig.h
--- gc-7.2/include/private/gcconfig.h 2012-08-09 13:25:13.030408704 -0700
+++ gc-7.2-haiku/include/private/gcconfig.h 2013-03-27 00:45:52.350748672 -0700
@@ -234,6 +234,11 @@
# define BEOS
# define mach_type_known
# endif
+# if defined(__HAIKU__) && defined(_X86_)
+# define I386
+# define HAIKU
+# define mach_type_known
+# endif
# if defined(OPENBSD) && defined(__amd64__)
# define X86_64
# define mach_type_known
@@ -1115,6 +1120,15 @@
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# endif
+# ifdef HAIKU
+# define OS_TYPE "HAIKU"
+# include <OS.h>
+# define GETPAGESIZE() B_PAGE_SIZE
+ extern int etext[];
+# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
+# define DYNAMIC_LOADING
+# define MPROTECT_VDB
+# endif
# ifdef SOLARIS
# define OS_TYPE "SOLARIS"
extern int _etext[], _end[];
@@ -2404,7 +2418,7 @@
#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)
+ || defined(AIX) || defined(DARWIN) || defined(OSF1) || defined(HAIKU)
# define UNIX_LIKE /* Basic Unix-like system calls work. */
#endif
@@ -2482,7 +2496,8 @@
#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
|| defined(OPENBSD) || defined(ARM32) \
- || defined(MIPS) || defined(AVR32))) \
+ || defined(MIPS) || defined(AVR32) \
+ || defined(HAIKU))) \
|| (defined(LINUX) && (defined(SPARC) || defined(M68K))) \
|| (defined(RTEMS) && defined(I386))) && !defined(NO_GETCONTEXT)
# define NO_GETCONTEXT
@@ -2789,6 +2804,9 @@
# elif defined(SN_TARGET_PS3)
void *ps3_get_mem(size_t size);
# define GET_MEM(bytes) (struct hblk*)ps3_get_mem(bytes)
+# elif defined(HAIKU)
+ ptr_t GC_haiku_get_mem(GC_word bytes);
+# define GET_MEM(bytes) (struct hblk*)GC_haiku_get_mem(bytes)
# else
ptr_t GC_unix_get_mem(GC_word bytes);
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
diff -urN gc-7.2/include/private/thread_local_alloc.h gc-7.2-haiku/include/private/thread_local_alloc.h
--- gc-7.2/include/private/thread_local_alloc.h 2012-08-09 13:25:13.029884416 -0700
+++ gc-7.2-haiku/include/private/thread_local_alloc.h 2013-03-27 00:49:11.605290496 -0700
@@ -47,7 +47,8 @@
# define USE_COMPILER_TLS
# elif defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) \
|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
- || defined(GC_NETBSD_THREADS) || defined(GC_RTEMS_PTHREADS)
+ || defined(GC_NETBSD_THREADS) || defined(GC_RTEMS_PTHREADS) \
+ || || defined(GC_HAIKU_THREADS)
# define USE_PTHREAD_SPECIFIC
# elif defined(GC_HPUX_THREADS)
# ifdef __GNUC__
diff -urN gc-7.2/os_dep.c gc-7.2-haiku/os_dep.c
--- gc-7.2/os_dep.c 2012-08-09 13:25:13.034340864 -0700
+++ gc-7.2-haiku/os_dep.c 2013-03-27 00:46:12.884998144 -0700
@@ -790,7 +790,7 @@
}
#endif /* !MSWIN32 */
-#ifdef BEOS
+#if defined(BEOS) || defined(HAIKU)
# include <kernel/OS.h>
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
@@ -801,7 +801,7 @@
return GC_SUCCESS;
}
# define HAVE_GET_STACK_BASE
-#endif /* BEOS */
+#endif /* BEOS || HAIKU */
#ifdef OS2
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
@@ -1138,7 +1138,7 @@
# define GET_MAIN_STACKBASE_SPECIAL
#elif !defined(BEOS) && !defined(AMIGA) && !defined(OS2) \
&& !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) \
- && !defined(GC_OPENBSD_THREADS) \
+ && !defined(GC_OPENBSD_THREADS) && !defined(HAIKU) \
&& (!defined(GC_SOLARIS_THREADS) || defined(_STRICT_STDC))
# if defined(LINUX) && defined(USE_GET_STACKBASE_FOR_MAIN)
@@ -2001,7 +2001,7 @@
# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MSWIN32) \
&& !defined(MSWINCE) && !defined(MACOS) && !defined(DOS4GW) \
&& !defined(NONSTOP) && !defined(SN_TARGET_PS3) && !defined(RTEMS) \
- && !defined(__CC_ARM)
+ && !defined(__CC_ARM) && !defined(HAIKU)
# define SBRK_ARG_T ptrdiff_t
@@ -2326,6 +2326,19 @@
}
#endif
+#ifdef HAIKU
+#include <stdlib.h>
+
+ptr_t GC_haiku_get_mem(word bytes)
+{
+ void* mem;
+ if (posix_memalign(&mem, GC_page_size, bytes) == 0)
+ return mem;
+ else
+ return NULL;
+}
+#endif
+
#ifdef USE_MUNMAP
/* For now, this only works on Win32/WinCE and some Unix-like */
@@ -2927,7 +2940,9 @@
# elif !defined(MSWIN32) && !defined(MSWINCE)
# include <sys/mman.h>
# include <signal.h>
-# include <sys/syscall.h>
+# if !defined(HAIKU)
+# include <sys/syscall.h>
+# endif
# define PROTECT(addr, len) \
if (mprotect((caddr_t)(addr), (size_t)(len), \
@@ -3086,6 +3101,8 @@
/* Empirically c.trapno == 14, on IA32, but is that useful? */
/* Should probably consider alignment issues on other */
/* architectures. */
+# elif defined(HAIKU)
+# define CODE_OK TRUE
# elif defined(HPUX)
# define CODE_OK (si -> si_code == SEGV_ACCERR \
|| si -> si_code == BUS_ADRERR \
diff -urN gc-7.2/pthread_support.c gc-7.2-haiku/pthread_support.c
--- gc-7.2/pthread_support.c 2012-08-09 13:25:13.048234496 -0700
+++ gc-7.2-haiku/pthread_support.c 2013-03-27 00:46:12.896794624 -0700
@@ -999,7 +999,8 @@
GC_nprocs = pthread_num_processors_np();
# elif defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \
|| defined(GC_SOLARIS_THREADS) || defined(GC_GNU_THREADS) \
- || defined(PLATFORM_ANDROID) || defined(NACL)
+ || defined(PLATFORM_ANDROID) || defined(NACL) \
+ || defined(GC_HAIKU_THREADS)
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1;
# elif defined(GC_IRIX_THREADS)