[Pixman] [PATCH 4/4] Expand TLS support beyond __thread to __declspec(thread)
Matt Turner
mattst88 at gmail.com
Wed Mar 14 16:39:14 PDT 2012
On Thu, Mar 8, 2012 at 12:41 PM, Jeremy Huddleston <jeremyhu at apple.com> wrote:
> This code was pretty much coppied from a similar commit that I made to
> xorg-server in April.
>
> cf: xorg/xserver: bb4d145bd25e2aee988b100ecf1105ea3b6a40b8
>
> Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> ---
> configure.ac | 26 ++++++++++++++------------
> pixman/pixman-compiler.h | 4 ++--
> 2 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 1ca3c02..a920be2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -788,25 +788,27 @@ fi
> dnl =====================================
> dnl Thread local storage
>
> -support_for__thread=no
> -
> -AC_MSG_CHECKING(for __thread)
> -AC_LINK_IFELSE([AC_LANG_SOURCE([[
> +AC_MSG_CHECKING(for thread local storage (TLS) support)
> +AC_CACHE_VAL(ac_cv_tls, [
> + ac_cv_tls=none
> + keywords="__thread __declspec(thread)"
> + for kw in $keywords ; do
> + AC_TRY_COMPILE([
> #if defined(__MINGW32__) && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
> #error This MinGW version has broken __thread support
> #endif
> #ifdef __OpenBSD__
> #error OpenBSD has broken __thread support
> #endif
> -static __thread int x ;
> -int main () { x = 123; return x; }
> -]])], support_for__thread=yes)
>
> -if test $support_for__thread = yes; then
> - AC_DEFINE([TOOLCHAIN_SUPPORTS__THREAD],[],[Whether the tool chain supports __thread])
> -fi
> +int $kw test;], [], ac_cv_tls=$kw)
> + done
> +])
> +AC_MSG_RESULT($ac_cv_tls)
>
> -AC_MSG_RESULT($support_for__thread)
> +if test "$ac_cv_tls" != "none"; then
> + AC_DEFINE_UNQUOTED([TLS], $pixman_tls, [The compiler supported TLS storage class])
> +fi
>
> dnl
> dnl posix tls
> @@ -858,7 +860,7 @@ AC_DEFUN([PIXMAN_CHECK_PTHREAD],[dnl
> fi
> ])
>
> -if test $support_for__thread = no; then
> +if test $ac_cv_tls = none ; then
> support_for_pthread_setspecific=no
>
> AC_MSG_CHECKING(for pthread_setspecific)
> diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
> index 5b568e1..ffd5172 100644
> --- a/pixman/pixman-compiler.h
> +++ b/pixman/pixman-compiler.h
> @@ -97,10 +97,10 @@
> # define PIXMAN_GET_THREAD_LOCAL(name) \
> (&name)
>
> -#elif defined(TOOLCHAIN_SUPPORTS__THREAD)
> +#elif defined(TLS)
>
> # define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \
> - static __thread type name
> + static TLS type name
> # define PIXMAN_GET_THREAD_LOCAL(name) \
> (&name)
>
> --
> 1.7.9
This causes test failures
/bin/sh: line 5: 10408 Segmentation fault ${dir}$tst
FAIL: scaling-test
/bin/sh: line 5: 10429 Floating point exception${dir}$tst
FAIL: affine-test
---- Test 6293333 failed ----
Operator: CONJOINT_ATOP
Source: solid
Mask: solid
Destination: a1r1g1b1, 1x1
R G B A Rounded
Source color: 1.000 1.000 1.000 0.000 1.000 1.000 1.000 0.000
Mask color: 0.000 0.000 0.000 1.000 0.000 0.000 0.000 1.000
Dest. color: 0.000 0.000 0.000 1.000 0.000 0.000 0.000 1.000
Expected: 1.000 1.000 1.000 1.000
Got: 1 1 1 0 [pixel: 0x00000007]
Min accepted: 1 1 1 1
Max accepted: 1 1 1 1
Test 0x00600755 failed.
FAIL: composite
More information about the Pixman
mailing list