diff options
author | Richard Henderson <rth@redhat.com> | 2005-07-16 19:29:00 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-07-16 19:29:00 -0700 |
commit | 7544a87f135c194395e525c7ca6123f4fd9f51ea (patch) | |
tree | 7eb9ea11806846cc5d60256f51b3b0a1033126fe /libmudflap/mf-impl.h | |
parent | f8820d33eba7e777142fbb8cb0772cc9dc0fe7c2 (diff) | |
download | gcc-7544a87f135c194395e525c7ca6123f4fd9f51ea.zip gcc-7544a87f135c194395e525c7ca6123f4fd9f51ea.tar.gz gcc-7544a87f135c194395e525c7ca6123f4fd9f51ea.tar.bz2 |
gcc.c (MFWRAP_SPEC): Don't wrap pthread_join or pthread_exit.
* gcc.c (MFWRAP_SPEC): Don't wrap pthread_join or pthread_exit.
* acinclude.m4: New file.
* configure.ac: Invoke LIBMUDFLAP_CHECK_TLS.
* configure, config.h.in, Makefile.in, testsuite/Makefile.in: Rebuild.
* mf-hooks1.c (__mf_0fn_malloc): Move body from ...
(__mf_0fn_calloc): ... here.
* mf-hooks3.c (struct pthread_info): Remove.
(__mf_pthread_info, __mf_pthread_info_idx): Remove.
(LIBMUDFLAPTH_THREADS_MAX): Set to 1021.
(struct mf_thread_data): New.
(mf_thread_data, mf_thread_data_lock): New.
(__mf_allocate_blank_threadinfo): Remove.
(__mf_find_threadinfo): Rewrite and simplify. Only use if TLS is
not available.
(__mf_state_perthread): Remove.
(__mf_get_state, __mf_set_state): New.
(__mf_pthread_cleanup): Use &errno, rather than saved pointer.
Update mf_thread_data killing procedure.
(__mf_pthread_spawner): Similarly.
(__mf_0fn_pthread_create): Only use wrapper if necessary. Remove
code to allocate thread stack space.
(__mf_0fn_pthread_join, pthread_join): Remove.
(__mf_0fn_pthread_exit, pthread_exit): Remove.
* mf-impl.h (dyn_pthread_join, dyn_pthread_exit): Remove.
(__mf_state_1): Rename from __mf_state; use TLS when available.
(__mf_get_state, __mf_set_state): New. Update all users.
* mf-runtime.c (begin_recursion_protect1): New.
(BEGIN_RECURSION_PROTECT): Use it.
(__mf_state_1): Rename from __mf_state; use TLS when available.
(threads_active_p): Remove.
(__mf_usage): Compute it directly.
From-SVN: r102108
Diffstat (limited to 'libmudflap/mf-impl.h')
-rw-r--r-- | libmudflap/mf-impl.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/libmudflap/mf-impl.h b/libmudflap/mf-impl.h index 47abdf6..53c25b3 100644 --- a/libmudflap/mf-impl.h +++ b/libmudflap/mf-impl.h @@ -207,9 +207,7 @@ enum __mf_dynamic_index dyn_munmap, dyn_realloc, dyn_INITRESOLVE, /* Marker for last init-time resolution. */ #ifdef LIBMUDFLAPTH - dyn_pthread_create, - dyn_pthread_join, - dyn_pthread_exit + dyn_pthread_create #endif }; @@ -233,12 +231,25 @@ extern pthread_mutex_t __mf_biglock; #define UNLOCKTH() do {} while (0) #endif -#ifdef LIBMUDFLAPTH -extern enum __mf_state_enum *__mf_state_perthread (); -#define __mf_state (* __mf_state_perthread ()) +#if defined(LIBMUDFLAPTH) && !defined(HAVE_TLS) +extern enum __mf_state_enum __mf_get_state (void); +extern void __mf_set_state (enum __mf_state_enum); #else -extern enum __mf_state_enum __mf_state; +# ifdef LIBMUDFLAPTH +extern __thread enum __mf_state_enum __mf_state_1; +# else +extern enum __mf_state_enum __mf_state_1; +# endif +static inline enum __mf_state_enum __mf_get_state (void) +{ + return __mf_state_1; +} +static inline void __mf_set_state (enum __mf_state_enum s) +{ + __mf_state_1 = s; +} #endif + extern int __mf_starting_p; extern struct __mf_options __mf_opts; @@ -362,7 +373,7 @@ ret __mfwrap_ ## fname (__VA_ARGS__) { \ return CALL_BACKUP(fname, __VA_ARGS__); \ } \ - else if (UNLIKELY (__mf_state == reentrant)) \ + else if (UNLIKELY (__mf_get_state () == reentrant)) \ { \ extern unsigned long __mf_reentrancy; \ __mf_reentrancy ++; \ |