summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-11-29 16:51:30 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-29 16:51:30 -0500
commit428e152be6bb0fd3867e41cee82a6d5968a11a26 (patch)
treee43d217c10c052704f872cd7e1df4d335c12d376 /includes
parent56d74515396c8b6360ba7898cbc4b68f0f1fb2ea (diff)
downloadhaskell-428e152be6bb0fd3867e41cee82a6d5968a11a26.tar.gz
Use C99's bool
Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699
Diffstat (limited to 'includes')
-rw-r--r--includes/Cmm.h5
-rw-r--r--includes/rts/Flags.h76
-rw-r--r--includes/rts/Hpc.h2
-rw-r--r--includes/rts/OSThreads.h10
-rw-r--r--includes/rts/Threads.h2
-rw-r--r--includes/rts/Types.h8
-rw-r--r--includes/rts/storage/ClosureMacros.h10
-rw-r--r--includes/rts/storage/GC.h4
8 files changed, 58 insertions, 59 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 9b7a4e4608..0623c3eeb6 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -50,6 +50,7 @@
CInt has the same size as an int in C on this platform
CLong has the same size as a long in C on this platform
+ CBool has the same size as a bool in C on this platform
--------------------------------------------------------------------------- */
@@ -95,6 +96,8 @@
#error Unknown long size
#endif
+#define CBool bits8
+
#define F_ float32
#define D_ float64
#define L_ bits64
@@ -229,7 +232,7 @@
* Note the syntax is slightly different to the C version of this macro.
*/
#ifdef DEBUG
-#define IF_DEBUG(c,s) if (RtsFlags_DebugFlags_##c(RtsFlags) != 0::I32) { s; }
+#define IF_DEBUG(c,s) if (RtsFlags_DebugFlags_##c(RtsFlags) != 0::CBool) { s; }
#else
#define IF_DEBUG(c,s) /* nothing */
#endif
diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h
index c66aed90a3..21ff2ab1c5 100644
--- a/includes/rts/Flags.h
+++ b/includes/rts/Flags.h
@@ -45,22 +45,22 @@ typedef struct _GC_FLAGS {
uint32_t nurseryChunkSize; /* in *blocks* */
uint32_t minOldGenSize; /* in *blocks* */
uint32_t heapSizeSuggestion; /* in *blocks* */
- rtsBool heapSizeSuggestionAuto;
+ bool heapSizeSuggestionAuto;
double oldGenFactor;
double pcFreeHeap;
uint32_t generations;
- rtsBool squeezeUpdFrames;
+ bool squeezeUpdFrames;
- rtsBool compact; /* True <=> "compact all the time" */
+ bool compact; /* True <=> "compact all the time" */
double compactThreshold;
- rtsBool sweep; /* use "mostly mark-sweep" instead of copying
+ bool sweep; /* use "mostly mark-sweep" instead of copying
* for the oldest generation */
- rtsBool ringBell;
+ bool ringBell;
Time idleGCDelayTime; /* units: TIME_RESOLUTION */
- rtsBool doIdleGC;
+ bool doIdleGC;
StgWord heapBase; /* address to ask the OS for memory */
@@ -72,29 +72,29 @@ typedef struct _GC_FLAGS {
* raise it again.
*/
- rtsBool numa; /* Use NUMA */
+ bool numa; /* Use NUMA */
StgWord numaMask;
} GC_FLAGS;
/* See Note [Synchronization of flags and base APIs] */
typedef struct _DEBUG_FLAGS {
/* flags to control debugging output & extra checking in various subsystems */
- rtsBool scheduler; /* 's' */
- rtsBool interpreter; /* 'i' */
- rtsBool weak; /* 'w' */
- rtsBool gccafs; /* 'G' */
- rtsBool gc; /* 'g' */
- rtsBool block_alloc; /* 'b' */
- rtsBool sanity; /* 'S' warning: might be expensive! */
- rtsBool stable; /* 't' */
- rtsBool prof; /* 'p' */
- rtsBool linker; /* 'l' the object linker */
- rtsBool apply; /* 'a' */
- rtsBool stm; /* 'm' */
- rtsBool squeeze; /* 'z' stack squeezing & lazy blackholing */
- rtsBool hpc; /* 'c' coverage */
- rtsBool sparks; /* 'r' */
- rtsBool numa; /* '--debug-numa' */
+ bool scheduler; /* 's' */
+ bool interpreter; /* 'i' */
+ bool weak; /* 'w' */
+ bool gccafs; /* 'G' */
+ bool gc; /* 'g' */
+ bool block_alloc; /* 'b' */
+ bool sanity; /* 'S' warning: might be expensive! */
+ bool stable; /* 't' */
+ bool prof; /* 'p' */
+ bool linker; /* 'l' the object linker */
+ bool apply; /* 'a' */
+ bool stm; /* 'm' */
+ bool squeeze; /* 'z' stack squeezing & lazy blackholing */
+ bool hpc; /* 'c' coverage */
+ bool sparks; /* 'r' */
+ bool numa; /* '--debug-numa' */
} DEBUG_FLAGS;
/* See Note [Synchronization of flags and base APIs] */
@@ -125,10 +125,10 @@ typedef struct _PROFILING_FLAGS {
Time heapProfileInterval; /* time between samples */
uint32_t heapProfileIntervalTicks; /* ticks between samples (derived) */
- rtsBool includeTSOs;
+ bool includeTSOs;
- rtsBool showCCSOnException;
+ bool showCCSOnException;
uint32_t maxRetainerSetSize;
@@ -151,12 +151,12 @@ typedef struct _PROFILING_FLAGS {
/* See Note [Synchronization of flags and base APIs] */
typedef struct _TRACE_FLAGS {
int tracing;
- rtsBool timestamp; /* show timestamp in stderr output */
- rtsBool scheduler; /* trace scheduler events */
- rtsBool gc; /* trace GC events */
- rtsBool sparks_sampled; /* trace spark events by a sampled method */
- rtsBool sparks_full; /* trace spark events 100% accurately */
- rtsBool user; /* trace user events (emitted from Haskell code) */
+ bool timestamp; /* show timestamp in stderr output */
+ bool scheduler; /* trace scheduler events */
+ bool gc; /* trace GC events */
+ bool sparks_sampled; /* trace spark events by a sampled method */
+ bool sparks_full; /* trace spark events 100% accurately */
+ bool user; /* trace user events (emitted from Haskell code) */
} TRACE_FLAGS;
/* See Note [Synchronization of flags and base APIs] */
@@ -177,8 +177,8 @@ typedef struct _CONCURRENT_FLAGS {
/* See Note [Synchronization of flags and base APIs] */
typedef struct _MISC_FLAGS {
Time tickInterval; /* units: TIME_RESOLUTION */
- rtsBool install_signal_handlers;
- rtsBool machineReadable;
+ bool install_signal_handlers;
+ bool machineReadable;
StgWord linkerMemBase; /* address to ask the OS for memory
* for the linker, NULL ==> off */
} MISC_FLAGS;
@@ -186,12 +186,12 @@ typedef struct _MISC_FLAGS {
/* See Note [Synchronization of flags and base APIs] */
typedef struct _PAR_FLAGS {
uint32_t nCapabilities; /* number of threads to run simultaneously */
- rtsBool migrate; /* migrate threads between capabilities */
+ bool migrate; /* migrate threads between capabilities */
uint32_t maxLocalSparks;
- rtsBool parGcEnabled; /* enable parallel GC */
+ bool parGcEnabled; /* enable parallel GC */
uint32_t parGcGen; /* do parallel GC in this generation
* and higher only */
- rtsBool parGcLoadBalancingEnabled;
+ bool parGcLoadBalancingEnabled;
/* enable load-balancing in the
* parallel GC */
uint32_t parGcLoadBalancingGen;
@@ -209,12 +209,12 @@ typedef struct _PAR_FLAGS {
/* Use this many threads for parallel
* GC (default: use all nNodes). */
- rtsBool setAffinity; /* force thread affinity with CPUs */
+ bool setAffinity; /* force thread affinity with CPUs */
} PAR_FLAGS;
/* See Note [Synchronization of flags and base APIs] */
typedef struct _TICKY_FLAGS {
- rtsBool showTickyStats;
+ bool showTickyStats;
FILE *tickyFile;
} TICKY_FLAGS;
diff --git a/includes/rts/Hpc.h b/includes/rts/Hpc.h
index 80ad47eadf..d70d1db829 100644
--- a/includes/rts/Hpc.h
+++ b/includes/rts/Hpc.h
@@ -20,7 +20,7 @@ typedef struct _HpcModuleInfo {
StgWord32 tickCount; // number of ticks
StgWord32 hashNo; // Hash number for this module's mix info
StgWord64 *tixArr; // tix Array; local for this module
- rtsBool from_file; // data was read from the .tix file
+ bool from_file; // data was read from the .tix file
struct _HpcModuleInfo *next;
} HpcModuleInfo;
diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h
index efd24066b6..2ebbd1e0f1 100644
--- a/includes/rts/OSThreads.h
+++ b/includes/rts/OSThreads.h
@@ -171,17 +171,17 @@ typedef void OSThreadProcAttr OSThreadProc(void *);
extern int createOSThread ( OSThreadId* tid, char *name,
OSThreadProc *startProc, void *param);
-extern rtsBool osThreadIsAlive ( OSThreadId id );
-extern void interruptOSThread (OSThreadId id);
+extern bool osThreadIsAlive ( OSThreadId id );
+extern void interruptOSThread (OSThreadId id);
//
// Condition Variables
//
extern void initCondition ( Condition* pCond );
extern void closeCondition ( Condition* pCond );
-extern rtsBool broadcastCondition ( Condition* pCond );
-extern rtsBool signalCondition ( Condition* pCond );
-extern rtsBool waitCondition ( Condition* pCond, Mutex* pMut );
+extern bool broadcastCondition ( Condition* pCond );
+extern bool signalCondition ( Condition* pCond );
+extern bool waitCondition ( Condition* pCond, Mutex* pMut );
//
// Mutexes
diff --git a/includes/rts/Threads.h b/includes/rts/Threads.h
index 866c4692bd..f45d351c2b 100644
--- a/includes/rts/Threads.h
+++ b/includes/rts/Threads.h
@@ -36,7 +36,7 @@ StgTSO *createStrictIOThread (Capability *cap, W_ stack_size,
StgClosure *closure);
// Suspending/resuming threads around foreign calls
-void * suspendThread (StgRegTable *, rtsBool interruptible);
+void * suspendThread (StgRegTable *, bool interruptible);
StgRegTable * resumeThread (void *);
//
diff --git a/includes/rts/Types.h b/includes/rts/Types.h
index 08baceb1cf..4b0e680ae5 100644
--- a/includes/rts/Types.h
+++ b/includes/rts/Types.h
@@ -15,21 +15,17 @@
#define RTS_TYPES_H
#include <stddef.h>
+#include <stdbool.h>
// Deprecated, use uint32_t instead.
typedef unsigned int nat __attribute__((deprecated)); /* uint32_t */
/* ullong (64|128-bit) type: only include if needed (not ANSI) */
-#if defined(__GNUC__)
+#if defined(__GNUC__)
#define LL(x) (x##LL)
#else
#define LL(x) (x##L)
#endif
-
-typedef enum {
- rtsFalse = 0,
- rtsTrue
-} rtsBool;
typedef struct StgClosure_ StgClosure;
typedef struct StgInfoTable_ StgInfoTable;
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
index e485246206..f5ca5cd850 100644
--- a/includes/rts/storage/ClosureMacros.h
+++ b/includes/rts/storage/ClosureMacros.h
@@ -258,18 +258,18 @@ TAG_CLOSURE(StgWord tag,StgClosure * p)
make sense...
-------------------------------------------------------------------------- */
-INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR_NOT_NULL (StgWord p)
+INLINE_HEADER bool LOOKS_LIKE_INFO_PTR_NOT_NULL (StgWord p)
{
StgInfoTable *info = INFO_PTR_TO_STRUCT((StgInfoTable *)p);
- return (info->type != INVALID_OBJECT && info->type < N_CLOSURE_TYPES) ? rtsTrue : rtsFalse;
+ return info->type != INVALID_OBJECT && info->type < N_CLOSURE_TYPES;
}
-INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR (StgWord p)
+INLINE_HEADER bool LOOKS_LIKE_INFO_PTR (StgWord p)
{
- return (p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p))) ? rtsTrue : rtsFalse;
+ return p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p));
}
-INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (const void *p)
+INLINE_HEADER bool LOOKS_LIKE_CLOSURE_PTR (const void *p)
{
return LOOKS_LIKE_INFO_PTR((StgWord)
(UNTAG_CONST_CLOSURE((const StgClosure *)(p)))->header.info);
diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h
index 6dc483f1ff..f15fd2a7cf 100644
--- a/includes/rts/storage/GC.h
+++ b/includes/rts/storage/GC.h
@@ -248,7 +248,7 @@ typedef struct _GCStats {
StgDouble wall_seconds;
} GCStats;
void getGCStats (GCStats *s);
-rtsBool getGCStatsEnabled (void);
+bool getGCStatsEnabled (void);
// These don't change over execution, so do them elsewhere
// StgDouble init_cpu_seconds;
@@ -288,7 +288,7 @@ void dirty_MUT_VAR(StgRegTable *reg, StgClosure *p);
/* set to disable CAF garbage collection in GHCi. */
/* (needed when dynamic libraries are used). */
-extern rtsBool keepCAFs;
+extern bool keepCAFs;
INLINE_HEADER void initBdescr(bdescr *bd, generation *gen, generation *dest)
{