X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FRts.h;h=d6f5eb9b1d9a1d52ea3126b4f417b756663a67b5;hb=b9d46a06dce3bf3bdeb805f35c35e0e68ab2f2d0;hp=c8dcaaefbdd0e6fd14eb5e8a40cb86a48b392772;hpb=438596897ebbe25a07e1c82085cfbc5bdb00f09e;p=ghc-hetmet.git diff --git a/ghc/includes/Rts.h b/ghc/includes/Rts.h index c8dcaae..d6f5eb9 100644 --- a/ghc/includes/Rts.h +++ b/ghc/includes/Rts.h @@ -1,5 +1,7 @@ /* ----------------------------------------------------------------------------- - * $Id: Rts.h,v 1.2 1998/12/02 13:21:21 simonm Exp $ + * $Id: Rts.h,v 1.22 2002/12/19 17:57:39 panne Exp $ + * + * (c) The GHC Team, 1998-1999 * * Top-level include file for the RTS itself * @@ -8,61 +10,73 @@ #ifndef RTS_H #define RTS_H -#ifndef NO_REGS -#define NO_REGS /* don't define fixed registers */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef IN_STG_CODE +#define IN_STG_CODE 0 #endif #include "Stg.h" /* ----------------------------------------------------------------------------- - Miscellaneous garbage + RTS Exit codes -------------------------------------------------------------------------- */ -#if ! defined(EXIT_SUCCESS) || ! defined(EXIT_FAILURE) -/* "stdlib.h" should have defined these; but at least - on SunOS 4.1.3, this is not so. -*/ -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 -#endif +/* 255 is allegedly used by dynamic linkers to report linking failure */ +#define EXIT_INTERNAL_ERROR 254 +#define EXIT_DEADLOCK 253 +#define EXIT_INTERRUPTED 252 +#define EXIT_HEAPOVERFLOW 251 +#define EXIT_KILLED 250 + +/* ----------------------------------------------------------------------------- + Miscellaneous garbage + -------------------------------------------------------------------------- */ /* declarations for runtime flags/values */ #define MAX_RTS_ARGS 32 +#ifdef _WIN32 +/* On the yucky side..suppress -Wmissing-declarations warnings when + * including + */ +extern void* GetCurrentFiber ( void ); +extern void* GetFiberData ( void ); +#endif + /* ----------------------------------------------------------------------------- - Useful typedefs + Assertions and Debuggery -------------------------------------------------------------------------- */ -typedef unsigned int nat; /* at least 32 bits (like int) */ -typedef unsigned long lnat; /* at least 32 bits */ -typedef unsigned long long ullong; /* at least 32 bits */ - -typedef enum { - rtsFalse = 0, - rtsTrue -} rtsBool; +#define IF_RTSFLAGS(c,s) if (RtsFlags.c) { s; } /* ----------------------------------------------------------------------------- Assertions and Debuggery -------------------------------------------------------------------------- */ -#ifndef DEBUG -#define ASSERT(predicate) /* nothing */ +#ifdef DEBUG +#define IF_DEBUG(c,s) if (RtsFlags.DebugFlags.c) { s; } #else +#define IF_DEBUG(c,s) doNothing() +#endif -void _stgAssert (char *, unsigned int); - -#define ASSERT(predicate) \ - if (predicate) \ - /*null*/; \ - else \ - _stgAssert(__FILE__, __LINE__) +#ifdef DEBUG +#define DEBUG_ONLY(s) s +#else +#define DEBUG_ONLY(s) doNothing() +#endif -#endif /* DEBUG */ +#if defined(GRAN) && defined(DEBUG) +#define IF_GRAN_DEBUG(c,s) if (RtsFlags.GranFlags.Debug.c) { s; } +#else +#define IF_GRAN_DEBUG(c,s) doNothing() +#endif -#ifndef DEBUG -#define IF_DEBUG(c,s) doNothing() +#if defined(PAR) && defined(DEBUG) +#define IF_PAR_DEBUG(c,s) if (RtsFlags.ParFlags.Debug.c) { s; } #else -#define IF_DEBUG(c,s) if (RtsFlags.DebugFlags.c) { s; } +#define IF_PAR_DEBUG(c,s) doNothing() #endif /* ----------------------------------------------------------------------------- @@ -70,7 +84,7 @@ void _stgAssert (char *, unsigned int); -------------------------------------------------------------------------- */ #ifdef __GNUC__ /* Avoid spurious warnings */ -#if __GNUC__ >= 2 && __GNUC_MINOR__ >= 7 +#if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3 #define STG_NORETURN __attribute__ ((noreturn)) #define STG_UNUSED __attribute__ ((unused)) #else @@ -86,18 +100,13 @@ void _stgAssert (char *, unsigned int); Useful macros and inline functions -------------------------------------------------------------------------- */ -/* - * Use this on the RHS of macros which expand to nothing - * to make sure that the macro can be used in a context which - * demands a non-empty statement. - */ - -#define doNothing() do { } while (0) - #define stg_min(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _a : _b; }) #define stg_max(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _b : _a; }) +/* -------------------------------------------------------------------------- */ -#define UNUSED __attribute__((unused)) +#ifdef __cplusplus +} +#endif -#endif RTS_H +#endif /* RTS_H */