--- Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.h.orig +++ Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.h @@ -105,20 +105,14 @@ static inline pas_thread_local_cache* pas_thread_local_cache_try_get(void) { pas_thread_local_cache* cache = pas_thread_local_cache_try_get_impl(); -#if !PAS_OS(DARWIN) if (((uintptr_t)cache) == PAS_THREAD_LOCAL_CACHE_DESTROYED) return NULL; -#endif return cache; } static inline bool pas_thread_local_cache_can_set(void) { -#if PAS_OS(DARWIN) - return !pthread_self_is_exiting_np() && !pas_msl_is_enabled(); -#else return ((uintptr_t)pas_thread_local_cache_try_get_impl()) != PAS_THREAD_LOCAL_CACHE_DESTROYED; -#endif } static inline void pas_thread_local_cache_set_impl(pas_thread_local_cache* thread_local_cache) --- Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c.orig +++ Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c @@ -147,7 +147,6 @@ if (verbose) pas_log("[%d] Destructor call for TLS %p\n", getpid(), thread_local_cache); -#if !PAS_OS(DARWIN) /* If pthread_self_is_exiting_np does not exist, we set PAS_THREAD_LOCAL_CACHE_DESTROYED in the TLS so that subsequent calls of pas_thread_local_cache_try_get() can detect whether TLS is destroyed. Since PAS_THREAD_LOCAL_CACHE_DESTROYED is a non-null value, pthread will call this destructor again (up to @@ -155,7 +154,6 @@ PAS_THREAD_LOCAL_CACHE_DESTROYED in the TLS each time to continue to indicate that destroy() has already been called once. */ pas_thread_local_cache_set_impl((pas_thread_local_cache*)PAS_THREAD_LOCAL_CACHE_DESTROYED); PAS_ASSERT(!pas_thread_local_cache_can_set()); -#endif if (((uintptr_t)thread_local_cache) != PAS_THREAD_LOCAL_CACHE_DESTROYED) destroy(thread_local_cache, pas_lock_is_not_held);