[arch-commits] Commit in gc/repos (8 files)

Bartłomiej Piotrowski bpiotrowski at archlinux.org
Sat Dec 5 15:31:07 UTC 2015


    Date: Saturday, December 5, 2015 @ 16:31:07
  Author: bpiotrowski
Revision: 252426

archrelease: copy trunk to staging-i686, staging-x86_64

Added:
  gc/repos/staging-i686/
  gc/repos/staging-i686/PKGBUILD
    (from rev 252425, gc/trunk/PKGBUILD)
  gc/repos/staging-i686/gc-7.4.2-Export-GC-push-all-eager.patch
    (from rev 252425, gc/trunk/gc-7.4.2-Export-GC-push-all-eager.patch)
  gc/repos/staging-i686/noelision.patch
    (from rev 252425, gc/trunk/noelision.patch)
  gc/repos/staging-x86_64/
  gc/repos/staging-x86_64/PKGBUILD
    (from rev 252425, gc/trunk/PKGBUILD)
  gc/repos/staging-x86_64/gc-7.4.2-Export-GC-push-all-eager.patch
    (from rev 252425, gc/trunk/gc-7.4.2-Export-GC-push-all-eager.patch)
  gc/repos/staging-x86_64/noelision.patch
    (from rev 252425, gc/trunk/noelision.patch)

--------------------------------------------------------+
 staging-i686/PKGBUILD                                  |   51 ++++++
 staging-i686/gc-7.4.2-Export-GC-push-all-eager.patch   |   38 ++++
 staging-i686/noelision.patch                           |  127 +++++++++++++++
 staging-x86_64/PKGBUILD                                |   51 ++++++
 staging-x86_64/gc-7.4.2-Export-GC-push-all-eager.patch |   38 ++++
 staging-x86_64/noelision.patch                         |  127 +++++++++++++++
 6 files changed, 432 insertions(+)

Copied: gc/repos/staging-i686/PKGBUILD (from rev 252425, gc/trunk/PKGBUILD)
===================================================================
--- staging-i686/PKGBUILD	                        (rev 0)
+++ staging-i686/PKGBUILD	2015-12-05 15:31:07 UTC (rev 252426)
@@ -0,0 +1,51 @@
+# $Id$
+# Maintainer: Daniel Isenmann <daniel [at] archlinux.org>
+# Contributor: dorphell <dorphell at gmx.net>
+
+pkgname=gc
+pkgver=7.4.2
+pkgrel=4
+pkgdesc="A garbage collector for C and C++"
+arch=('i686' 'x86_64')
+url="http://www.hboehm.info/gc/"
+license=('GPL')
+depends=('gcc-libs' 'libatomic_ops')
+source=("http://www.hboehm.info/gc/gc_source/${pkgname}-${pkgver}.tar.gz"
+        noelision.patch
+		gc-7.4.2-Export-GC-push-all-eager.patch)
+md5sums=('12c05fd2811d989341d8c6d81f66af87'
+         '0be354bf60cc18363dc4c1601697717b'
+         '26984d81b4ab2b0281583a5442c26863')
+
+prepare() {
+  cd ${pkgname}-${pkgver}
+
+  # https://bugs.archlinux.org/task/39631
+  # https://github.com/ivmai/bdwgc/pull/51
+  patch -p1 -i ../noelision.patch
+
+  patch -p1 -i ../gc-7.4.2-Export-GC-push-all-eager.patch
+
+  sed -i 's#pkgdata#doc#' doc/doc.am
+}
+
+build() {
+  cd ${pkgname}-${pkgver}
+  autoreconf -fi
+  ./configure --prefix=/usr --enable-cplusplus --disable-static
+  make
+}
+
+check() {
+  cd ${pkgname}-${pkgver}
+  make check
+}
+
+package() {
+  cd ${pkgname}-${pkgver}
+  make DESTDIR="${pkgdir}" install
+
+  sed -i -e 's/GC_MALLOC 1L/gc 3/' doc/gc.man
+  install -m755 -d "${pkgdir}/usr/share/man/man3"
+  install -m644 doc/gc.man "${pkgdir}/usr/share/man/man3/gc.3"
+}

Copied: gc/repos/staging-i686/gc-7.4.2-Export-GC-push-all-eager.patch (from rev 252425, gc/trunk/gc-7.4.2-Export-GC-push-all-eager.patch)
===================================================================
--- staging-i686/gc-7.4.2-Export-GC-push-all-eager.patch	                        (rev 0)
+++ staging-i686/gc-7.4.2-Export-GC-push-all-eager.patch	2015-12-05 15:31:07 UTC (rev 252426)
@@ -0,0 +1,38 @@
+From e2a14481796cd4b073298a9c895b03015c72e02c Mon Sep 17 00:00:00 2001
+From: Ivan Maidanski <ivmai at mail.ru>
+Date: Tue, 23 Jun 2015 15:17:27 +0300
+Subject: [PATCH] Export GC_push_all_eager
+
+* include/gc_mark.h (GC_push_all_eager): New API function declaration.
+* mark.c (GC_push_all_eager): Add GC_API, GC_CALL; change arguments
+type from ptr_t to char*.
+---
+ include/gc_mark.h | 1 +
+ mark.c            | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/gc_mark.h b/include/gc_mark.h
+index dcadf42..0b19ea9 100644
+--- a/include/gc_mark.h
++++ b/include/gc_mark.h
+@@ -276,6 +276,7 @@ GC_API void GC_CALL GC_set_mark_bit(const void *) GC_ATTR_NONNULL(1);
+ /* (GC_push_conditional pushes either all or only dirty pages depending */
+ /* on the third argument.)                                              */
+ GC_API void GC_CALL GC_push_all(char * /* bottom */, char * /* top */);
++GC_API void GC_CALL GC_push_all_eager(char * /* bottom */, char * /* top */);
+ GC_API void GC_CALL GC_push_conditional(char * /* bottom */, char * /* top */,
+                                         int /* bool all */);
+ 
+diff --git a/mark.c b/mark.c
+index 80d09cf..89f64cc 100644
+--- a/mark.c
++++ b/mark.c
+@@ -1488,7 +1488,7 @@ void GC_print_trace(word gc_no)
+  * and scans the entire region immediately, in case the contents
+  * change.
+  */
+-GC_INNER void GC_push_all_eager(ptr_t bottom, ptr_t top)
++GC_API void GC_CALL GC_push_all_eager(char *bottom, char *top)
+ {
+     word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
+     word * t = (word *)(((word) top) & ~(ALIGNMENT-1));

Copied: gc/repos/staging-i686/noelision.patch (from rev 252425, gc/trunk/noelision.patch)
===================================================================
--- staging-i686/noelision.patch	                        (rev 0)
+++ staging-i686/noelision.patch	2015-12-05 15:31:07 UTC (rev 252426)
@@ -0,0 +1,127 @@
+diff --git c/include/private/gc_priv.h w/include/private/gc_priv.h
+index 0ad92fc..b877fac 100644
+--- c/include/private/gc_priv.h
++++ w/include/private/gc_priv.h
+@@ -2368,6 +2368,7 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
+   /* GC_notify_all_builder() is called when GC_fl_builder_count         */
+   /* reaches 0.                                                         */
+ 
++  GC_INNER void GC_setup_mark_lock(void);
+   GC_INNER void GC_acquire_mark_lock(void);
+   GC_INNER void GC_release_mark_lock(void);
+   GC_INNER void GC_notify_all_builder(void);
+diff --git c/include/private/gcconfig.h w/include/private/gcconfig.h
+index c753cc2..b5ed075 100644
+--- c/include/private/gcconfig.h
++++ w/include/private/gcconfig.h
+@@ -1357,6 +1357,11 @@
+ #         define PREFETCH_FOR_WRITE(x) \
+             __asm__ __volatile__ ("prefetchw %0" : : "m"(*(char *)(x)))
+ #       endif
++#       if defined(__GLIBC__)
++          /* Workaround lock elision implementation for some glibc.     */
++#         define GLIBC_2_19_TSX_BUG
++#         include <gnu/libc-version.h> /* for gnu_get_libc_version() */
++#       endif
+ #   endif
+ #   ifdef CYGWIN32
+ #       define OS_TYPE "CYGWIN32"
+@@ -2257,6 +2262,11 @@
+           /* FIXME: This seems to be fixed in GLibc v2.14.              */
+ #         define GETCONTEXT_FPU_EXCMASK_BUG
+ #       endif
++#       if defined(__GLIBC__)
++          /* Workaround lock elision implementation for some glibc.     */
++#         define GLIBC_2_19_TSX_BUG
++#         include <gnu/libc-version.h> /* for gnu_get_libc_version() */
++#       endif
+ #   endif
+ #   ifdef DARWIN
+ #     define OS_TYPE "DARWIN"
+diff --git c/include/private/pthread_support.h w/include/private/pthread_support.h
+index 525a9aa..017f194 100644
+--- c/include/private/pthread_support.h
++++ w/include/private/pthread_support.h
+@@ -148,6 +148,8 @@ GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread(
+                                         struct GC_stack_base *sb, void *arg);
+ GC_INNER_PTHRSTART void GC_thread_exit_proc(void *);
+ 
++GC_INNER void GC_setup_mark_lock(void);
++
+ #endif /* GC_PTHREADS && !GC_WIN32_THREADS */
+ 
+ #endif /* GC_PTHREAD_SUPPORT_H */
+diff --git c/misc.c w/misc.c
+index df434a1..3aca41d 100644
+--- c/misc.c
++++ w/misc.c
+@@ -875,6 +875,9 @@ GC_API void GC_CALL GC_init(void)
+         /* else */ InitializeCriticalSection (&GC_allocate_ml);
+      }
+ #   endif /* GC_WIN32_THREADS */
++#   if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS)
++      GC_setup_mark_lock();
++#   endif /* GC_PTHREADS */
+ #   if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS)
+       InitializeCriticalSection(&GC_write_cs);
+ #   endif
+diff --git c/pthread_support.c w/pthread_support.c
+index c00b93d..8a7c50b 100644
+--- c/pthread_support.c
++++ w/pthread_support.c
+@@ -1979,6 +1979,55 @@ GC_INNER void GC_lock(void)
+ 
+ static pthread_cond_t builder_cv = PTHREAD_COND_INITIALIZER;
+ 
++#ifdef GLIBC_2_19_TSX_BUG
++  /* Parse string like <major>[.<minor>[<tail>]] and return major value. */
++  static int parse_version(int *pminor, const char *pverstr) {
++    char *endp;
++    unsigned long value = strtoul(pverstr, &endp, 10);
++    int major = (int)value;
++
++    if (major < 0 || (char *)pverstr == endp || (unsigned)major != value) {
++      /* Parse error */
++      return -1;
++    }
++    if (*endp != '.') {
++      /* No minor part. */
++      *pminor = -1;
++    } else {
++      value = strtoul(endp + 1, &endp, 10);
++      *pminor = (int)value;
++      if (*pminor < 0 || (unsigned)(*pminor) != value) {
++        return -1;
++      }
++    }
++    return major;
++  }
++#endif /* GLIBC_2_19_TSX_BUG */
++
++GC_INNER void GC_setup_mark_lock(void)
++{
++# ifdef GLIBC_2_19_TSX_BUG
++    pthread_mutexattr_t mattr;
++    int glibc_minor = -1;
++    int glibc_major = parse_version(&glibc_minor, gnu_get_libc_version());
++
++    if (glibc_major > 2 || (glibc_major == 2 && glibc_minor >= 19)) {
++      /* TODO: disable this workaround for glibc with fixed TSX */
++      /* This disables lock elision to workaround a bug in glibc 2.19+  */
++      if (0 != pthread_mutexattr_init(&mattr)) {
++        ABORT("pthread_mutexattr_init failed");
++      }
++      if (0 != pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_NORMAL)) {
++        ABORT("pthread_mutexattr_settype failed");
++      }
++      if (0 != pthread_mutex_init(&mark_mutex, &mattr)) {
++        ABORT("pthread_mutex_init failed");
++      }
++      pthread_mutexattr_destroy(&mattr);
++    }
++# endif
++}
++
+ GC_INNER void GC_acquire_mark_lock(void)
+ {
+     GC_ASSERT(GC_mark_lock_holder != NUMERIC_THREAD_ID(pthread_self()));

Copied: gc/repos/staging-x86_64/PKGBUILD (from rev 252425, gc/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2015-12-05 15:31:07 UTC (rev 252426)
@@ -0,0 +1,51 @@
+# $Id$
+# Maintainer: Daniel Isenmann <daniel [at] archlinux.org>
+# Contributor: dorphell <dorphell at gmx.net>
+
+pkgname=gc
+pkgver=7.4.2
+pkgrel=4
+pkgdesc="A garbage collector for C and C++"
+arch=('i686' 'x86_64')
+url="http://www.hboehm.info/gc/"
+license=('GPL')
+depends=('gcc-libs' 'libatomic_ops')
+source=("http://www.hboehm.info/gc/gc_source/${pkgname}-${pkgver}.tar.gz"
+        noelision.patch
+		gc-7.4.2-Export-GC-push-all-eager.patch)
+md5sums=('12c05fd2811d989341d8c6d81f66af87'
+         '0be354bf60cc18363dc4c1601697717b'
+         '26984d81b4ab2b0281583a5442c26863')
+
+prepare() {
+  cd ${pkgname}-${pkgver}
+
+  # https://bugs.archlinux.org/task/39631
+  # https://github.com/ivmai/bdwgc/pull/51
+  patch -p1 -i ../noelision.patch
+
+  patch -p1 -i ../gc-7.4.2-Export-GC-push-all-eager.patch
+
+  sed -i 's#pkgdata#doc#' doc/doc.am
+}
+
+build() {
+  cd ${pkgname}-${pkgver}
+  autoreconf -fi
+  ./configure --prefix=/usr --enable-cplusplus --disable-static
+  make
+}
+
+check() {
+  cd ${pkgname}-${pkgver}
+  make check
+}
+
+package() {
+  cd ${pkgname}-${pkgver}
+  make DESTDIR="${pkgdir}" install
+
+  sed -i -e 's/GC_MALLOC 1L/gc 3/' doc/gc.man
+  install -m755 -d "${pkgdir}/usr/share/man/man3"
+  install -m644 doc/gc.man "${pkgdir}/usr/share/man/man3/gc.3"
+}

Copied: gc/repos/staging-x86_64/gc-7.4.2-Export-GC-push-all-eager.patch (from rev 252425, gc/trunk/gc-7.4.2-Export-GC-push-all-eager.patch)
===================================================================
--- staging-x86_64/gc-7.4.2-Export-GC-push-all-eager.patch	                        (rev 0)
+++ staging-x86_64/gc-7.4.2-Export-GC-push-all-eager.patch	2015-12-05 15:31:07 UTC (rev 252426)
@@ -0,0 +1,38 @@
+From e2a14481796cd4b073298a9c895b03015c72e02c Mon Sep 17 00:00:00 2001
+From: Ivan Maidanski <ivmai at mail.ru>
+Date: Tue, 23 Jun 2015 15:17:27 +0300
+Subject: [PATCH] Export GC_push_all_eager
+
+* include/gc_mark.h (GC_push_all_eager): New API function declaration.
+* mark.c (GC_push_all_eager): Add GC_API, GC_CALL; change arguments
+type from ptr_t to char*.
+---
+ include/gc_mark.h | 1 +
+ mark.c            | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/gc_mark.h b/include/gc_mark.h
+index dcadf42..0b19ea9 100644
+--- a/include/gc_mark.h
++++ b/include/gc_mark.h
+@@ -276,6 +276,7 @@ GC_API void GC_CALL GC_set_mark_bit(const void *) GC_ATTR_NONNULL(1);
+ /* (GC_push_conditional pushes either all or only dirty pages depending */
+ /* on the third argument.)                                              */
+ GC_API void GC_CALL GC_push_all(char * /* bottom */, char * /* top */);
++GC_API void GC_CALL GC_push_all_eager(char * /* bottom */, char * /* top */);
+ GC_API void GC_CALL GC_push_conditional(char * /* bottom */, char * /* top */,
+                                         int /* bool all */);
+ 
+diff --git a/mark.c b/mark.c
+index 80d09cf..89f64cc 100644
+--- a/mark.c
++++ b/mark.c
+@@ -1488,7 +1488,7 @@ void GC_print_trace(word gc_no)
+  * and scans the entire region immediately, in case the contents
+  * change.
+  */
+-GC_INNER void GC_push_all_eager(ptr_t bottom, ptr_t top)
++GC_API void GC_CALL GC_push_all_eager(char *bottom, char *top)
+ {
+     word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
+     word * t = (word *)(((word) top) & ~(ALIGNMENT-1));

Copied: gc/repos/staging-x86_64/noelision.patch (from rev 252425, gc/trunk/noelision.patch)
===================================================================
--- staging-x86_64/noelision.patch	                        (rev 0)
+++ staging-x86_64/noelision.patch	2015-12-05 15:31:07 UTC (rev 252426)
@@ -0,0 +1,127 @@
+diff --git c/include/private/gc_priv.h w/include/private/gc_priv.h
+index 0ad92fc..b877fac 100644
+--- c/include/private/gc_priv.h
++++ w/include/private/gc_priv.h
+@@ -2368,6 +2368,7 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
+   /* GC_notify_all_builder() is called when GC_fl_builder_count         */
+   /* reaches 0.                                                         */
+ 
++  GC_INNER void GC_setup_mark_lock(void);
+   GC_INNER void GC_acquire_mark_lock(void);
+   GC_INNER void GC_release_mark_lock(void);
+   GC_INNER void GC_notify_all_builder(void);
+diff --git c/include/private/gcconfig.h w/include/private/gcconfig.h
+index c753cc2..b5ed075 100644
+--- c/include/private/gcconfig.h
++++ w/include/private/gcconfig.h
+@@ -1357,6 +1357,11 @@
+ #         define PREFETCH_FOR_WRITE(x) \
+             __asm__ __volatile__ ("prefetchw %0" : : "m"(*(char *)(x)))
+ #       endif
++#       if defined(__GLIBC__)
++          /* Workaround lock elision implementation for some glibc.     */
++#         define GLIBC_2_19_TSX_BUG
++#         include <gnu/libc-version.h> /* for gnu_get_libc_version() */
++#       endif
+ #   endif
+ #   ifdef CYGWIN32
+ #       define OS_TYPE "CYGWIN32"
+@@ -2257,6 +2262,11 @@
+           /* FIXME: This seems to be fixed in GLibc v2.14.              */
+ #         define GETCONTEXT_FPU_EXCMASK_BUG
+ #       endif
++#       if defined(__GLIBC__)
++          /* Workaround lock elision implementation for some glibc.     */
++#         define GLIBC_2_19_TSX_BUG
++#         include <gnu/libc-version.h> /* for gnu_get_libc_version() */
++#       endif
+ #   endif
+ #   ifdef DARWIN
+ #     define OS_TYPE "DARWIN"
+diff --git c/include/private/pthread_support.h w/include/private/pthread_support.h
+index 525a9aa..017f194 100644
+--- c/include/private/pthread_support.h
++++ w/include/private/pthread_support.h
+@@ -148,6 +148,8 @@ GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread(
+                                         struct GC_stack_base *sb, void *arg);
+ GC_INNER_PTHRSTART void GC_thread_exit_proc(void *);
+ 
++GC_INNER void GC_setup_mark_lock(void);
++
+ #endif /* GC_PTHREADS && !GC_WIN32_THREADS */
+ 
+ #endif /* GC_PTHREAD_SUPPORT_H */
+diff --git c/misc.c w/misc.c
+index df434a1..3aca41d 100644
+--- c/misc.c
++++ w/misc.c
+@@ -875,6 +875,9 @@ GC_API void GC_CALL GC_init(void)
+         /* else */ InitializeCriticalSection (&GC_allocate_ml);
+      }
+ #   endif /* GC_WIN32_THREADS */
++#   if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS)
++      GC_setup_mark_lock();
++#   endif /* GC_PTHREADS */
+ #   if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS)
+       InitializeCriticalSection(&GC_write_cs);
+ #   endif
+diff --git c/pthread_support.c w/pthread_support.c
+index c00b93d..8a7c50b 100644
+--- c/pthread_support.c
++++ w/pthread_support.c
+@@ -1979,6 +1979,55 @@ GC_INNER void GC_lock(void)
+ 
+ static pthread_cond_t builder_cv = PTHREAD_COND_INITIALIZER;
+ 
++#ifdef GLIBC_2_19_TSX_BUG
++  /* Parse string like <major>[.<minor>[<tail>]] and return major value. */
++  static int parse_version(int *pminor, const char *pverstr) {
++    char *endp;
++    unsigned long value = strtoul(pverstr, &endp, 10);
++    int major = (int)value;
++
++    if (major < 0 || (char *)pverstr == endp || (unsigned)major != value) {
++      /* Parse error */
++      return -1;
++    }
++    if (*endp != '.') {
++      /* No minor part. */
++      *pminor = -1;
++    } else {
++      value = strtoul(endp + 1, &endp, 10);
++      *pminor = (int)value;
++      if (*pminor < 0 || (unsigned)(*pminor) != value) {
++        return -1;
++      }
++    }
++    return major;
++  }
++#endif /* GLIBC_2_19_TSX_BUG */
++
++GC_INNER void GC_setup_mark_lock(void)
++{
++# ifdef GLIBC_2_19_TSX_BUG
++    pthread_mutexattr_t mattr;
++    int glibc_minor = -1;
++    int glibc_major = parse_version(&glibc_minor, gnu_get_libc_version());
++
++    if (glibc_major > 2 || (glibc_major == 2 && glibc_minor >= 19)) {
++      /* TODO: disable this workaround for glibc with fixed TSX */
++      /* This disables lock elision to workaround a bug in glibc 2.19+  */
++      if (0 != pthread_mutexattr_init(&mattr)) {
++        ABORT("pthread_mutexattr_init failed");
++      }
++      if (0 != pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_NORMAL)) {
++        ABORT("pthread_mutexattr_settype failed");
++      }
++      if (0 != pthread_mutex_init(&mark_mutex, &mattr)) {
++        ABORT("pthread_mutex_init failed");
++      }
++      pthread_mutexattr_destroy(&mattr);
++    }
++# endif
++}
++
+ GC_INNER void GC_acquire_mark_lock(void)
+ {
+     GC_ASSERT(GC_mark_lock_holder != NUMERIC_THREAD_ID(pthread_self()));



More information about the arch-commits mailing list