X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsUtils.c;h=4d3724df3fe36e89a92d015d15aa73edd7dcea79;hb=de75026f5a48d3d052135a973ab4dff76c5b20f5;hp=7048e94cd0cf193ff12dee2b72ad3fc9f925730d;hpb=150cc9e2e4657cc58bd7ec4c15e5cb72f2e1c0f6;p=ghc-hetmet.git diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index 7048e94..4d3724d 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -13,11 +13,19 @@ #include "RtsFlags.h" #include "RtsUtils.h" #include "Ticky.h" +#include "Schedule.h" #ifdef HAVE_TIME_H #include #endif +/* HACK: On Mac OS X 10.4 (at least), time.h doesn't declare ctime_r with + * _POSIX_C_SOURCE. If this is the case, we declare it ourselves. + */ +#if HAVE_CTIME_R && !HAVE_DECL_CTIME_R +extern char *ctime_r(const time_t *, char *); +#endif + #ifdef HAVE_FCNTL_H #include #endif @@ -265,15 +273,14 @@ stackOverflow(void) void heapOverflow(void) { - /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ - OutOfHeapHook(0/*unknown request size*/, - RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE); - -#if defined(TICKY_TICKY) - if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo(); -#endif + if (!heap_overflow) + { + /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ + OutOfHeapHook(0/*unknown request size*/, + RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE); - stg_exit(EXIT_HEAPOVERFLOW); + heap_overflow = rtsTrue; + } } /* ----------------------------------------------------------------------------- @@ -316,7 +323,6 @@ resetGenSymZh(void) /* it's your funeral */ Get the current time as a string. Used in profiling reports. -------------------------------------------------------------------------- */ -#if defined(PROFILING) || defined(DEBUG) || defined(PAR) || defined(GRAN) char * time_str(void) { @@ -335,7 +341,6 @@ time_str(void) } return nowstr; } -#endif /* ----------------------------------------------------------------------------- * Reset a file handle to blocking mode. We do this for the standard @@ -462,3 +467,38 @@ int genericRaise(int sig) { return raise(sig); #endif } + +static void mkRtsInfoPair(char *key, char *val) { + /* XXX should check for "s, \s etc in key and val */ + printf(" ,(\"%s\", \"%s\")\n", key, val); +} + +/* This little bit of magic allows us to say TOSTRING(SYM) and get + * "5" if SYM is 5 */ +#define TOSTRING2(x) #x +#define TOSTRING(x) TOSTRING2(x) + +void printRtsInfo(void) { + /* The first entry is just a hack to make it easy to get the + * commas right */ + printf(" [(\"GHC RTS\", \"YES\")\n"); + mkRtsInfoPair("GHC version", ProjectVersion); + mkRtsInfoPair("RTS way", RtsWay); + mkRtsInfoPair("Host platform", HostPlatform); + mkRtsInfoPair("Host architecture", HostArch); + mkRtsInfoPair("Host OS", HostOS); + mkRtsInfoPair("Host vendor", HostVendor); + mkRtsInfoPair("Build platform", BuildPlatform); + mkRtsInfoPair("Build architecture", BuildArch); + mkRtsInfoPair("Build OS", BuildOS); + mkRtsInfoPair("Build vendor", BuildVendor); + mkRtsInfoPair("Target platform", TargetPlatform); + mkRtsInfoPair("Target architecture", TargetArch); + mkRtsInfoPair("Target OS", TargetOS); + mkRtsInfoPair("Target vendor", TargetVendor); + mkRtsInfoPair("Word size", TOSTRING(WORD_SIZE_IN_BITS)); + mkRtsInfoPair("Compiler unregisterised", GhcUnregisterised); + mkRtsInfoPair("Tables next to code", GhcEnableTablesNextToCode); + printf(" ]\n"); +} +