From: simonmar Date: Tue, 19 Dec 2000 12:55:18 +0000 (+0000) Subject: [project @ 2000-12-19 12:55:18 by simonmar] X-Git-Tag: Approximately_9120_patches~3058 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b1bbd55b3398136c4944cdca9df05cb12eda03ba;p=ghc-hetmet.git [project @ 2000-12-19 12:55:18 by simonmar] - Add setHeapSize (for -H support, works with ghc-4.08+) - Add enableGhcTiming (for -Rghc-timing, works with ghc-4.11+) Both of these are no-ops for older compilers. --- diff --git a/ghc/compiler/parser/hschooks.c b/ghc/compiler/parser/hschooks.c index b44c049..6d94290 100644 --- a/ghc/compiler/parser/hschooks.c +++ b/ghc/compiler/parser/hschooks.c @@ -10,6 +10,44 @@ in instead of the defaults. #include "rtsdefs.h" #endif +#if __GLASGOW_HASKELL__ >= 408 +#include "../rts/RtsFlags.h" +#include "HsFFI.h" +#endif + +void +defaultsHook (void) +{ +#if __GLASGOW_HASKELL__ >= 408 + RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE; +#endif +#if __GLASGOW_HASKELL__ >= 411 + RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS; + RtsFlags.GcFlags.statsFile = stderr; +#endif +} + +void +enableTimingStats( void ) /* called from the driver */ +{ +#if __GLASGOW_HASKELL__ >= 411 + RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS; +#endif + /* ignored when bootstrapping with an older GHC */ +} + +void +setHeapSize( HsInt size ) +{ +#if __GLASGOW_HASKELL__ >= 408 + RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE; + if (RtsFlags.GcFlags.heapSizeSuggestion > + RtsFlags.GcFlags.maxHeapSize) { + RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion; + } +#endif +} + #if __GLASGOW_HASKELL__ >= 303 void diff --git a/ghc/compiler/parser/hschooks.h b/ghc/compiler/parser/hschooks.h new file mode 100644 index 0000000..38a7d9f --- /dev/null +++ b/ghc/compiler/parser/hschooks.h @@ -0,0 +1,9 @@ +/* ----------------------------------------------------------------------------- + * $Id: hschooks.h,v 1.1 2000/12/19 12:55:18 simonmar Exp $ + * + * Hooks into the RTS from the compiler. + * + * ----------------------------------------------------------------------------- + +void enableTimingStats( void ); +void setHeapSize( HsInt size );