From 1828f852e0da737d285bfbfce3bfac26203f4ef5 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 18 Jan 2006 10:31:50 +0000 Subject: [PATCH] [project @ 2006-01-18 10:31:50 by simonmar] - fix a mixup in Capability.c regarding signals: signals_pending() is not used in THREADED_RTS - some cleanups and warning removal while I'm here --- ghc/configure.ac | 2 +- ghc/includes/Rts.h | 24 ++++++++++++++++++++++++ ghc/rts/Capability.c | 29 +++++++---------------------- ghc/rts/Schedule.c | 24 +++++------------------- ghc/rts/posix/Signals.h | 1 - 5 files changed, 37 insertions(+), 43 deletions(-) diff --git a/ghc/configure.ac b/ghc/configure.ac index b6d9a4c..029234a 100644 --- a/ghc/configure.ac +++ b/ghc/configure.ac @@ -1,5 +1,5 @@ # Initialise and check sanity. -AC_INIT([The Glorious Glasgow Haskell Compilation System], [6.5], [glasgow-haskell-bugs@haskell.org], [ghc]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [6.5.20060117], [glasgow-haskell-bugs@haskell.org], [ghc]) AC_CONFIG_SRCDIR([ghc.spec.in]) # duplicate from ../configure.ac diff --git a/ghc/includes/Rts.h b/ghc/includes/Rts.h index ebc2f23..3b5af21 100644 --- a/ghc/includes/Rts.h +++ b/ghc/includes/Rts.h @@ -70,6 +70,30 @@ extern void _assertFail (char *, unsigned int); #define doNothing() do { } while (0) +#ifdef SMP +#define USED_IF_SMP +#define USED_IF_NOT_SMP STG_UNUSED +#else +#define USED_IF_SMP STG_UNUSED +#define USED_IF_NOT_SMP +#endif + +#ifdef DEBUG +#define USED_IF_DEBUG +#define USED_IF_NOT_DEBUG STG_UNUSED +#else +#define USED_IF_DEBUG STG_UNUSED +#define USED_IF_NOT_DEBUG +#endif + +#ifdef THREADED_RTS +#define USED_IF_THREADS +#define USED_IF_NOT_THREADS STG_UNUSED +#else +#define USED_IF_THREADS STG_UNUSED +#define USED_IF_NOT_THREADS +#endif + /* ----------------------------------------------------------------------------- Include everything STG-ish -------------------------------------------------------------------------- */ diff --git a/ghc/rts/Capability.c b/ghc/rts/Capability.c index 5ca2f51..f3bbefe 100644 --- a/ghc/rts/Capability.c +++ b/ghc/rts/Capability.c @@ -1,6 +1,6 @@ /* --------------------------------------------------------------------------- * - * (c) The GHC Team, 2003-2005 + * (c) The GHC Team, 2003-2006 * * Capabilities * @@ -39,29 +39,15 @@ Capability *capabilities = NULL; // locking, so we don't do that. Capability *last_free_capability; -#ifdef SMP -#define UNUSED_IF_NOT_SMP -#else -#define UNUSED_IF_NOT_SMP STG_UNUSED -#endif - -#ifdef RTS_USER_SIGNALS -#define UNUSED_IF_NOT_THREADS -#else -#define UNUSED_IF_NOT_THREADS STG_UNUSED -#endif - - +#if defined(THREADED_RTS) STATIC_INLINE rtsBool globalWorkToDo (void) { return blackholes_need_checking || interrupted -#if defined(RTS_USER_SIGNALS) - || signals_pending() -#endif ; } +#endif #if defined(THREADED_RTS) STATIC_INLINE rtsBool @@ -213,7 +199,7 @@ initCapabilities( void ) #if defined(THREADED_RTS) STATIC_INLINE void -giveCapabilityToTask (Capability *cap, Task *task) +giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task) { ASSERT_LOCK_HELD(&cap->lock); ASSERT(task->cap == cap); @@ -295,7 +281,7 @@ releaseCapability_ (Capability* cap) } void -releaseCapability (Capability* cap UNUSED_IF_NOT_THREADS) +releaseCapability (Capability* cap USED_IF_THREADS) { ACQUIRE_LOCK(&cap->lock); releaseCapability_(cap); @@ -303,7 +289,7 @@ releaseCapability (Capability* cap UNUSED_IF_NOT_THREADS) } static void -releaseCapabilityAndQueueWorker (Capability* cap UNUSED_IF_NOT_THREADS) +releaseCapabilityAndQueueWorker (Capability* cap USED_IF_THREADS) { Task *task; @@ -341,8 +327,7 @@ releaseCapabilityAndQueueWorker (Capability* cap UNUSED_IF_NOT_THREADS) * * ------------------------------------------------------------------------- */ void -waitForReturnCapability (Capability **pCap, - Task *task UNUSED_IF_NOT_THREADS) +waitForReturnCapability (Capability **pCap, Task *task) { #if !defined(THREADED_RTS) diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index c4b253f..21bd59b 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -72,20 +72,6 @@ # define STATIC_INLINE static #endif -#ifdef THREADED_RTS -#define USED_WHEN_THREADED_RTS -#define USED_WHEN_NON_THREADED_RTS STG_UNUSED -#else -#define USED_WHEN_THREADED_RTS STG_UNUSED -#define USED_WHEN_NON_THREADED_RTS -#endif - -#ifdef SMP -#define USED_WHEN_SMP -#else -#define USED_WHEN_SMP STG_UNUSED -#endif - /* ----------------------------------------------------------------------------- * Global variables * -------------------------------------------------------------------------- */ @@ -730,8 +716,8 @@ schedulePreLoop(void) #ifdef SMP static void -schedulePushWork(Capability *cap USED_WHEN_SMP, - Task *task USED_WHEN_SMP) +schedulePushWork(Capability *cap USED_IF_SMP, + Task *task USED_IF_SMP) { Capability *free_caps[n_capabilities], *cap0; nat i, n_free_caps; @@ -854,7 +840,7 @@ scheduleStartSignalHandlers(Capability *cap STG_UNUSED) * ------------------------------------------------------------------------- */ static void -scheduleCheckBlockedThreads(Capability *cap USED_WHEN_NON_THREADED_RTS) +scheduleCheckBlockedThreads(Capability *cap USED_IF_NOT_THREADS) { #if !defined(THREADED_RTS) // @@ -1882,7 +1868,7 @@ scheduleDoHeapProfile( rtsBool ready_to_gc STG_UNUSED ) * -------------------------------------------------------------------------- */ static void -scheduleDoGC( Capability *cap, Task *task USED_WHEN_SMP, rtsBool force_major ) +scheduleDoGC( Capability *cap, Task *task USED_IF_SMP, rtsBool force_major ) { StgTSO *t; #ifdef SMP @@ -2022,7 +2008,7 @@ rtsSupportsBoundThreads(void) * ------------------------------------------------------------------------- */ StgBool -isThreadBound(StgTSO* tso USED_WHEN_THREADED_RTS) +isThreadBound(StgTSO* tso USED_IF_THREADS) { #if defined(THREADED_RTS) return (tso->bound != NULL); diff --git a/ghc/rts/posix/Signals.h b/ghc/rts/posix/Signals.h index 3c5564b..39477f8 100644 --- a/ghc/rts/posix/Signals.h +++ b/ghc/rts/posix/Signals.h @@ -18,7 +18,6 @@ extern StgPtr *next_pending_handler; #define signals_pending() (next_pending_handler != pending_handler_buf) void startSignalHandlers(Capability *cap); - #endif extern StgInt *signal_handlers; -- 1.7.10.4